# fromPath static method

ImageRef? fromPath(

1. String path, {
2. PathImageLoadOptions? options,

})

Creates ImageRef from the path to an image.

## Implementation

    static ImageRef? fromPath(String path, {PathImageLoadOptions? options}) {
      return using((Arena arena) {
        PathImageLoadOptions resolvedOptions = options ?? PathImageLoadOptions();
        Pointer<Utf8> pPath = path.toNativeUtf8(allocator: arena);
        Pointer<CPathImageLoadOptions> pConfig = arena<CPathImageLoadOptions>();
        pConfig.ref.roi.x = resolvedOptions.roi.left;
        pConfig.ref.roi.y = resolvedOptions.roi.top;
        pConfig.ref.roi.width = resolvedOptions.roi.width;
        pConfig.ref.roi.height = resolvedOptions.roi.height;
        pConfig.ref.loadMode = resolvedOptions.loadMode.index;
        pConfig.ref.encryptionMode = resolvedOptions.encryptionMode.index;

        String? uuid = _consumeString(_nativeCreateFromPath(pPath, pConfig));
        if (uuid == null) {
          return null;
        }

        ImageRef ref = ImageRef._(uuid);
        return ref;
      });
    }