buddycloud / buddycloud-media-server

Share files in a buddycloud channel
http://buddycloud.com
28 stars 16 forks source link

make avatars higher quality #18

Closed imaginator closed 10 years ago

imaginator commented 11 years ago

Avatars look blured.

Perhaps it makes sense to have the server generate higher quality avatars - I think I saw an option in the media library to optimise for quality over CPU use. And since we are only doing this once and then caching, it makes sense to use the highest quality setting.

rodrigods commented 11 years ago

It is currently using the ULTRA_QUALITY flag... Maybe the lib isn't able to do better than this

imaginator commented 11 years ago

I did some reading on the issue. You are right - I don't think we will get a higher quality from this library.

Long-term, let's switch over to using an imagemagick-based solution. This gives us other benefits too (like creating a preview for uploaded files like PDFs etc).

Notes:

imagemagick / convert binaries can easily be installed on the server.

imaginator commented 11 years ago

Pull requests for this gratefully accepted

imaginator commented 11 years ago

So it looks like we want: Lanczos 3 scaling (Gimp and Photoshop use this for high quality scaling) and it is explained here: http://blog.nobel-joergensen.com/2008/12/20/downscaling-images-in-java/

Yes, it takes longer to scale the image, but we're storing the results so I'm less concerned about the CPU hit on this one.

This has some feedback too: http://stackoverflow.com/questions/14115950/quality-of-image-after-resize-very-low-java/14116909#14116909 - again they recommend Lancoz resampling.

As far as I can find, the best library right now is this one: https://code.google.com/p/java-image-scaling/

rodrigods commented 10 years ago

Fixed by using https://code.google.com/p/java-image-scaling/ as resizing lib