Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use BlurHash in Hydrus #394

Closed
thatfuckingbird opened this issue Jul 19, 2020 · 10 comments
Closed

Use BlurHash in Hydrus #394

thatfuckingbird opened this issue Jul 19, 2020 · 10 comments
Labels
feature-request system:api API related issues system:user-interface Looks and actions of the user interface
Milestone

Comments

@thatfuckingbird
Copy link
Collaborator

What is BlurHash?

blurhash

In short, BlurHash takes an image, and gives you a short string (only 20-30 characters!) that represents the placeholder for this image. You do this on the backend of your service, and store the string along with the image. When you send data to your client, you send both the URL to the image, and the BlurHash string. Your client then takes the string, and decodes it into an image that it shows while the real image is loading over the network. The string is short enough that it comfortably fits into whatever data format you use. For instance, it can easily be added as a field in a JSON object.

See the website https://blurha.sh/ for images and further explanation. There is also a Python implementation available.

This can be used in the Hydrus UI itself as placeholders until thumbnails load. It would also be very useful to make it accessible through the API so clients can display the blurhash until the thumbnail loads.

@pozieuto
Copy link

This could also have limited applications for blurring "objectionable" media that you do not normally want to see if they happen to come up in searches (eg. "cannot be unseen" content types), but that you still want to store and tag for archiving or rare usage.

@imtbl imtbl added system:api API related issues system:user-interface Looks and actions of the user interface labels Jul 21, 2020
@hydrusnetwork
Copy link
Owner

This is very interesting, thank you. I like the idea a lot. I will make a job to mock up a test for this, so we can see how much CPU it takes to render that blur IRL.

@thatfuckingbird
Copy link
Collaborator Author

Found a pure Python impl that has both the encoder and decoder: https://github.com/halcy/blurhash-python

@DonaldTsang
Copy link

DonaldTsang commented Jul 31, 2020

  1. What about https://axe312ger.github.io/sqip/ ?
  2. Is it possible to apply the same principle to GIF/APNG/WebP?

@floogulinc
Copy link
Collaborator

  1. Is it possible to apply the same principle to GIF/APNG/WebP?

I would expect the blurhash to be calculated from existing Hydrus thumbnail images so anything Hydrus can make a thumbnail for would get a blurhash.

@DonaldTsang
Copy link

@floogulinc notice how all the formats I listed are animated, I was asking an animated equivalent of blurhash.

@floogulinc
Copy link
Collaborator

floogulinc commented Aug 6, 2020

@floogulinc notice how all the formats I listed are animated, I was asking an animated equivalent of blurhash.

@DonaldTsang, Hydrus doesn't provide animated thumbnails for animated files either and a blurhash is really just supposed to be a very small amount of data to load an approximation of the thumbnails before the real thumbnail is loaded. It would only be shown for a couple of seconds at most. Animating a blurhash would be excessive, increasing the size by a lot, and useless since it would just be replaced by a static thumbnail as soon as that loads.

@Senju-vilis
Copy link

If you do implement it - make it optional. It's hard on my eyes.

@DonaldTsang
Copy link

DonaldTsang commented Aug 17, 2020

@floogulinc it does not have to show the full animation either. A video or animated image can be "summarized" into just a small collection of images, which can reduce size while maintaining some information (assuming such placeholders can be used to help confirm the existence of files by memory).
For context https://github.com/Breakthrough/PySceneDetect

@floogulinc
Copy link
Collaborator

floogulinc commented Aug 17, 2020

@floogulinc it does not have to show the full animation either. A video or animated image can be "summarized" into just a small collection of images, which can reduce size while maintaining some information (assuming such placeholders can be used to help confirm the existence of files by memory).
For context https://github.com/Breakthrough/PySceneDetect

@DonaldTsang This is irrelevant to the use of blurhash. If you want animated thumbnails that should be a separate issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request system:api API related issues system:user-interface Looks and actions of the user interface
Projects
None yet
Development

No branches or pull requests

7 participants