blurhash icon indicating copy to clipboard operation
blurhash copied to clipboard

Different hashes for same picture

Open vanniktech opened this issue 2 years ago • 2 comments

When using 4x3 on the website with the given image, I get:

Screen Shot 2022-09-09 at 14 09 25
LEHV6nWB2yk8pyo0adR*.7kCMdnj

When I clone the repository, execute yarn run demo and test the Typescript library with the exact same image using 4x3, I get:

Screen Shot 2022-09-09 at 14 10 20
LEHLh[jZ2ykUpyoKadR*.8kCMdnj

The strings are similar, but why aren't they exactly the same?

vanniktech avatar Sep 09 '22 12:09 vanniktech

Also when using a custom picture, I get different results:

flower_noun_002_14403

http://localhost:9000/: LsR_etof*JoytRj[WBay*Ia{R5oz https://blurha.sh/: LsR_etkC*JkBtRj[V@ay*IayR5oz

Again similar but different.

vanniktech avatar Sep 09 '22 12:09 vanniktech

I've also taken the pictures from Python and ran them through localhost and the blurhashes in the Python tests are also different from Typescript.

vanniktech avatar Sep 10 '22 18:09 vanniktech

We had this issue with TypeScript: What we did was create a maxWidth, maxHeight, minWidth, minHeight, in our css wrapper to make sure the blurhash is the same size as the image. Probably best to test this out with inline css. Also you want to set overflow for both x & y hidden as the image and blurhash won't be exact size and you don't want jitter or the div to move around after it swaps from blur to image.

Garabed96 avatar Apr 17 '23 09:04 Garabed96

There'll be variations based on the environment - Environment could be browser, Node.js, Python or other languages. This difference is OK and expected, as a blurhash is an approximation.

Thisen avatar Jun 05 '23 09:06 Thisen