Open fishcharlie opened 1 week ago
This is a wonderful idea.
I see that pictrs has blurhash support, although it seems to be on its own dedicated endpoint.
@asonix Would it be possible to return the blurhash with any of the details / image_details responses? If its a low-CPU operation, you probably wouldn't even need to add a setting for generating them, and just do it by default.
If that's not doable, then we can probably use the existing endpoints, and store that.
@dessalines Might need to do some testing on if it is indeed a low CPU operation. Obviously the CPU cost is not nothing.
Just trade offs to consider there.
Please let me know if there is anything I can do to help drive this forward. And I'd be happy to help test this eventually!
Pictrs is the image library lemmy uses, and how we complete it depends on asonix's answer.
I recently added an image_details
table to store things like dimensions returned from pictrs, so its something I can probably handle without too much work. Thx tho!
cc @MV-GH @SleeplessOne1917 as this would be great to eventually add to jerboa and lemmy-ui-leptos also. Seems like there are decoder libraries for blurhash in most languages.
I think pict-rs could probably add blurhash to the image details. I'll look into that this weekend probably.
Requirements
Is your proposal related to a problem?
For users of a Lemmy client on slow internet connections not being able to see images while they are loading can lead to a subpar experience.
Describe the solution you'd like.
I'd love to see Lemmy return blurhash strings for images in the API. That way while images are loading for a client the client can temporarily display the blurhash of the image in place while it's loading.
Describe alternatives you've considered.
There aren't really any alternatives that I can think of here.
Additional context
I noticed that in 0.20.0 alpha it looks like there is a new ImageDetails object which is awesome and super helpful. Maybe a blurhash property could be added to that object?