Page 1 of 1

Thumbnails image quality

Posted: Sat Jan 19, 2013 7:04 pm
by petersilie
Hello,
What can I do, if the generated thumbnails are too much compressed – they look quite pixelated?
The size of the images, I've uploaded ist 533 x 800px and the thumbnails are 150 x 226px.
Is there any possibility to control the compression? The original pictures are web saved with 80% quality and look excellent, but maybe this is the problem here?
Thank you for any answers:)
petersilie

Re: Thumbnails image quality

Posted: Wed Jan 23, 2013 11:19 am
by Vasiljevski
When thumbnails are created we didn't set any Quality parameter, so it defaults, as written on http://php.net/manual/en/function.imagejpeg.php, to 75% in case of jpeg images.
There is 3 different cases when creating a thumbnail, for JPEG, PNG and GIF.

In case of JPEG we use imagejpeg(), JPG is a lossy compression and default quality is 75%.
You can change this in : [JoomlaRoot]\plugins\content\admirorgallery\admirorgallery\classes\agHelper.php:line 398

Code: Select all

@imagejpeg($dst_img, $thumb_file);
Just add 90 as a third parameter:

Code: Select all

@imagejpeg($dst_img, $thumb_file,90);
Experiment with the quality value and see if the quality of thumbs is improved.

Just be sure to remove the previous generated thumbnails after you make change in quality value. Because thumbnails are recreated only in case dimensions of thumbnails are changed.
Thumbnails are created in [JoomlaRoot]\plugins\content\admirorgallery\admirorgallery\thumbs.

In case of PNG we use imagepng(), and the default compression rate is 6. Different than JPEG, for PNG 0 is no compression (biggest file and best) and 9 is most compressed. But this doesn't affect the image quality because PNG is a lossless image format.
Same as for JPEG you can change the parameters in the function, but it will not produce better images.

In case of GIF we use imagegif(), this is also a lossless compression so quality cannot be changed. And the function dose not have an option to set quality.

Considering the above, you probably use JPEG images so you can try as I suggested for JPEG images.