Cannot reproduce Thumbnail quality is not as good as it could be

Kirby

Well-known member
Affected version
2.2.5
When uploading an image that is rotated or has dimensions larger then the allowed maximum, the uploaded files does get resized and/or rotated in XF\Http\Upload::transformImage.

This new image then does get written to the original location of the uploaded file.

Downstream systems like XF\Service\Attachment\Preparer will then take this file and generate the thumbnail, again by resizing the (now already resized and/or rotated) image and writing out a new file.

So the pipeline for JPEG thumbnail generation is basically:
Original Image > Rotate and/or Resize > JPEG Encode > Resize > JPEG Encode

As the image does get resized and encoded to JPEG two times, this doesn't seem ideal.
 
Last edited:
I think theoretically you're correct but after some amount of testing I've been unable to detect a discernible difference, at least not one that is particularly compelling to act upon, so do you have a demonstrable example of the poorer results with the current approach?

In my testing I started with a 3840 x 2160 image and resized it to 1280px wide.

This produced mountain_small.jpg:

mountain_small.webp

I resized that to 300px wide get mountain_thumb_a.jpg:

mountain_thumb_a.webp

I then resized the original 4K image again to 300px to get mountain_thumb_b.jpg:

mountain_thumb_b.webp

There is no discernible difference in this test and certainly not one that justifies the type of refactor you're implying is necessary here.
 
Back
Top Bottom