Skip to content

Increase image quality of downscaled images from 70 to 95

Tony Wasserka requested to merge neobrain/funkwhale:develop into develop

django-versatileimagefield will save resized images (such as downscaled cover art) with the default quality settings, 70, hence producing horrible artifacts for many kinds of images.

Since it's hard to pick a good default that works for all cover images, I went for the highest quality recommended in the Pillow documentation. In a testing cover of mine (with high contrast and many flat shaded color areas), 90 produced visible artifacts still, whereas only 97 and upwards were indistinguishable from the losslessly scaled image. 95 is a reasonable compromise, for which artifacts are only visible if you squint your eyes.

In this testing image, the file size increased from 8 KiB to 21 KiB. Since cover art thumbnails make up only a small part of the storage space required for Funkwhale, this seems reasonable.

WARNING: Currently, merging this change will cause all existing cover art to 404. Funkwhale encodes the quality setting in the image URL (which is updated automatically) but won't automatically regenerate any cover art thumbnails. We could flip the create_images_on_demand setting to True, but I'm not sure what effects this may have on performance.

Edited by Agate

Merge request reports