revoltchat / backend

Monorepo for Revolt backend services.
https://developers.revolt.chat/api/
Other
1.23k stars 140 forks source link

feat: blurhash of image files #353

Open insertish opened 7 months ago

legoraft commented 4 months ago

How would you like to see this implemented? There are crates that implement the blurhash algorithm, which can just be used as a crate to add a field to an image. How would this need to be implemented?

insertish commented 1 month ago

Just need an extra field on the FileHash object that includes the hash, that can be included&served to clients

TheRockettek commented 1 month ago

I would recommend using thumbhash as an alternative to blurhash as blurhash does not have transparency support. https://github.com/evanw/thumbhash

legoraft commented 1 month ago

I would recommend using thumbhash as an alternative to blurhash as blurhash does not have transparency support. https://github.com/evanw/thumbhash

It seems like the project isn't maintained very actively, so I don't know if it is smart to use.

legoraft commented 1 month ago

Just need an extra field on the FileHash object that includes the hash, that can be included&served to clients

Could it be smarter to include a blurhash field to the Image struct within the metadata of a file? This can be implemented in the generate_metadata() field within autumn. Something like blurhash-rs could be used, together with the generated width and height. Would this implementation be correct?

TheRockettek commented 1 month ago

Discord and presumably many other companies are activly using this implementation (see https://github.com/discord/lilliput/blob/master/thumbhash.cpp). The same about active maintaining could be said about blurhash too. Having to use blurhash also means extra information such as width and height will have to be stored instead of just using a single string.

It is an implementation that really does not need much maintainence once implemented as what is going to change?

I would recommend using thumbhash as an alternative to blurhash as blurhash does not have transparency support. https://github.com/evanw/thumbhash

It seems like the project isn't maintained very actively, so I don't know if it is smart to use.

legoraft commented 1 month ago

Discord and presumably many other companies are activly using this implementation (see https://github.com/discord/lilliput/blob/master/thumbhash.cpp). The same about active maintaining could be said about blurhash too. Having to use blurhash also means extra information such as width and height will have to be stored instead of just using a single string.

It is an implementation that really does not need much maintainence once implemented as what is going to change?

I would recommend using thumbhash as an alternative to blurhash as blurhash does not have transparency support. https://github.com/evanw/thumbhash

It seems like the project isn't maintained very actively, so I don't know if it is smart to use.

Wasn't aware of that. Width and height are already stored in revolt, though (see file_hashes). I would say that the final choice is up to insert.