ti.blurhash - Blurhash placeholder images for Titanium
August 27, 2021 · View on GitHub
What is BlurHash
BlurHash is a compact representation of a placeholder for an image.
(https://blurha.sh/)
This library allows you to convert an image to a simple string like LEHV6nWB2yk8pyoJadR*.7kCMdnj and that string into a preview image:
→ LEHV6nWB2yk8pyoJadR*.7kCMdnj → 
You app can use those preview images instead of a white or loading spinner.
This Titanium module will use the library from https://github.com/woltapp/blurhash
How to use it:
Currently Android only
var win = Ti.UI.createWindow();
var img = Ti.UI.createImageView({
width: 200,
height: 200,
image: require("ti.blurhash").decode({
width: 200,
height: 200,
text: "LEHV6nWB2yk8pyoJadR*.7kCMdnj"
})
})
win.add(img);
win.open();
Methods
- decode(width:int, height:int, punch:float, useCache:boolen)
- punch can improve the contrast; default: 1
Author
- Michael Gangolf (@MichaelGangolf / Web)