You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wanted to ask if it's feasible to obtain the blurhash string from an image path. In our app, the client calculates the hash before uploading a new profile picture. Currently, we're utilizing the blurhash_dart package for both encoding and decoding. I'd be open to switching to this package if it offers better performance.
In any case, great work!
The text was updated successfully, but these errors were encountered:
In your case, I'm assuming you have a File object of an image, in that case, FileImage as the ImageProvder should work fine, or if you are working with a Local Image, you can use an AssetImage which implements ImageProvider.
here is how you can encode with any ImageProvider instance:
import'package:blurhash_ffi/blurhash_ffi.dart';
/// Encoding a blurhash from an image provider////// You can use any ImageProvider you want, including NetworkImage, FileImage, MemoryImage, AssetImage, etc.final imageProvider =NetworkImage('https://picsum.photos/512');
final imageProvider2 =AssetImage('assets/image.jpg');
/// Signature/// static Future<String> encode(/// ImageProvider imageProvider, {/// int componentX = 4,/// int componentY = 3,/// })/// may throw `BlurhashFFIException` if encoding fails.finalString blurHash =awaitBlurhashFFI.encode(imageProvider);
I also used blurhash_dart previously and found that it was freezing the UI, and using it in a separate isolate also didn't help with performance, that's why I wrote this package, It solved the problem in my app (fast and not freezing UI thread), it is visibly more performant compared to blurhash_dart, but i did not write a performance test #7 to compare both.
Hello,
I wanted to ask if it's feasible to obtain the blurhash string from an image path. In our app, the client calculates the hash before uploading a new profile picture. Currently, we're utilizing the blurhash_dart package for both encoding and decoding. I'd be open to switching to this package if it offers better performance.
In any case, great work!
The text was updated successfully, but these errors were encountered: