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

Include Blurhash in ImageDetails #5142

Open
5 tasks done
fishcharlie opened this issue Oct 28, 2024 · 6 comments · May be fixed by #5227
Open
5 tasks done

Include Blurhash in ImageDetails #5142

fishcharlie opened this issue Oct 28, 2024 · 6 comments · May be fixed by #5227
Labels
area: media enhancement New feature or request
Milestone

Comments

@fishcharlie
Copy link
Contributor

Requirements

  • Is this a feature request? For questions or discussions use https://lemmy.ml/c/lemmy_support
  • Did you check to see if this issue already exists?
  • Is this only a feature request? Do not put multiple feature requests in one issue.
  • Is this a backend issue? Use the lemmy-ui repo for UI / frontend issues.
  • Do you agree to follow the rules in our Code of Conduct?

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?

@fishcharlie fishcharlie added the enhancement New feature or request label Oct 28, 2024
@dessalines
Copy link
Member

dessalines commented Oct 28, 2024

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.

@fishcharlie
Copy link
Contributor Author

@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!

@dessalines
Copy link
Member

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.

@asonix
Copy link
Collaborator

asonix commented Oct 28, 2024

I think pict-rs could probably add blurhash to the image details. I'll look into that this weekend probably.

@dessalines dessalines added this to the 0.20.0 milestone Nov 1, 2024
@asonix
Copy link
Collaborator

asonix commented Nov 23, 2024

I just merged the change in pict-rs that will include blurhash in the image details responses: https://git.asonix.dog/asonix/pict-rs/pulls/75

Not sure when I'll release another stable version, but it will have this included when I do.

@dessalines
Copy link
Member

Sweet, thx!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: media enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants