Comments (10)
@Solido I agree that most of the time you would want to do this server side but there are cases like ours where it makes a lot of sense to generate the hash on a Flutter based desktop client. Computing power is not the problem there but we could optimize further by wrapping the C library. Would you accept a PR doing the encoding?
@aytunch I am currently using a cloud function to generate the hash using the Python package which also wraps the C library.
from flutter_blurhash.
@Solido @cbenhagen I just found out about this package which seems to do the encoding part in Dart. It does not have a nice Widget wrapper though.
from flutter_blurhash.
My approach to this problem is base on economics ...
Expensive low level operations are better handled by optimised langs like go, rust or C.
On the long run it's much more cheap.
If would advise to run FAAS using
https://github.com/woltapp/blurhash/tree/master/C
Having a dart encoder on the server side has few advantages and the case of encoding should not be handled by the client.
Thanks for sharing your idea.
from flutter_blurhash.
@Solido thanks for your reply, it makes sense.
For my last part of the question regarding cloud functions which I am not experienced with, do you have any idea if it is possible to encode the images calling the C library you provided above? Do you have plans on working with the Firestore Cloud Functions part of this great package?
from flutter_blurhash.
@cbenhagen Ben, thanks a lot for these. Just to make sure, is this the way to upload your Python package to Cloud Functions?
Cloud Functions - Python Quickstart
from flutter_blurhash.
Yes that should get you started. Be sure to checkout the links at the bottom of that document to see more in depth guides on cloud functions.
from flutter_blurhash.
Inside of the BlurHash Algorithm details they have an example of Swift Decoder and Swift Encoder. I believe Swift is not a backend language. Maybe this can help porting the encoder code to dart from swift.
from flutter_blurhash.
@cbenhagen I see the kind of solutions your working on and for some reasons it appears that desktop encoding is the way to go.
We have 3 solutions
- pure dart
- plugin
- ffi
Do you think the last two have any advantages compared to resizing assets and sampling with dart ?
from flutter_blurhash.
I'd highly prefer a pure Dart solution which uses whatever Flutter provides for resizing. Not sure if the slight speed increase a native solution might bring would justify the burden of maintaining it for all the platforms.
from flutter_blurhash.
Let's go for a pure dart implementation yet I'll keep an eye on FFI/Rust later on.
from flutter_blurhash.
Related Issues (20)
- How to get hash HOT 3
- Update packages
- Bad state: Cannot clone a disposed image HOT 6
- [Feature] add header for download image HOT 2
- BlurHash string validation HOT 1
- [Feature] add errorBuilder HOT 2
- Version 0.6.6 - Huge memory consumption and Crash HOT 2
- Cannot clone a disposed image HOT 1
- errorBuilder isn't used if hash is invalid
- How to use with flutter_blurhash CachedNetworkImage? HOT 1
- Get the hash from an image? HOT 4
- Universal BlurHash widget HOT 1
- borderRadius suport HOT 2
- Build failed on Flutter Master channel HOT 2
- CacheManager
- Project Update Inquiry HOT 1
- Build Error with flutter_blurhash: 'DecoderCallback' Type Not Found on iOS Build HOT 3
- Error: Type 'DecoderCallback' not found. blurhash_widget.dart:218 HOT 1
- Blurhash octoimage bug HOT 1
- Not Working with Flutter version 3.19.5, Dart version 3.3.3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flutter_blurhash.