av.imageview icon indicating copy to clipboard operation
av.imageview copied to clipboard

How would I implement blurhash?

Open ffMathy opened this issue 3 years ago • 1 comments

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.

ffMathy avatar Jan 22 '21 18:01 ffMathy

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)

m1ga avatar Jan 23 '21 20:01 m1ga