AndreaVitale / av.imageview

Titanium native ImageView module that extends the default Titanium ImageView with more capabilities and a different caching system.
MIT License
96 stars 29 forks source link

How would I implement blurhash? #112

Open ffMathy opened 3 years ago

ffMathy commented 3 years ago

I'm interested in implementing https://blurha.sh for my images while they are loading.

For that, I'll need to be able to load an array of pixel colors into the image view. Is that possible?

That's all that's required for me to get this working.

m1ga commented 3 years ago

I think you should create an own module for that. Look at the official Kotlin demo: https://github.com/woltapp/blurhash/blob/master/Kotlin/demo/src/main/java/com/wolt/blurhashapp/MainActivity.kt#L18 it will return a Bitmap from the string you've entered. So it should be trivial to set it as an image to av.imageview or even a normal imageview.

Inside TiBlob there is a blobFromImage: https://github.com/appcelerator/titanium_mobile/blob/master/android/titanium/src/java/org/appcelerator/titanium/TiBlob.java#L137

You might even be able to do this with Hyperloop without creating a module.

edit: and of course: join us at tislack.org (#module-development)