How does xthreads handle image compression when producing thumbnails? Currently my resized pics are looking very grainy though the full-size are very clear. Is there any way to increase the quality?
Ugh... I can't see much different. Probably because I'm not a graphics designer.
Does it happens to your thumbnail if you use MyBB attachments?
Here you can see compressed (top) vs resized in photoshop (bottom).
http://i.imgur.com/JdMBU.jpg
Regular MyBB attachments are compressed as well, but they are so small so it doesn't matter ...
I'll ask at MyBB how image compression is handled and if it can be controlled. Thanks!
What I know is (I can be wrong), XThreads use MyBB's thumbnail generation to create a thumbnail. Again, I can be wrong. I think you need to wait Yumi to answer your question.
Yes, it uses MyBB's resize functions to do the job.
Note that there's two primary factors affecting quality in scaling:
- scaling algorithm used (I suspect PHP's GD does a simple Bilinear scale)
- for JPEG, there's further quantization applied to the image - this is probably the source of graininess.
http://php.net/manual/en/function.imagejpeg.php
MyBB doesn't supply a quality argument, so it'd be using the default of 75%. If you wanted better quality, you'd have to edit the
imagejpeg calls, including a higher quality (say 90%) - note that this would affect all MyBB thumbnails too
Alternatively, if images are uploaded as PNG, there won't be further quantization, so no further quality reduction.
Thanks for the details; I got an answer on how to fix on MyBB as well
It doesn't set interlacing/progressive mode, so whatever the default is.
Unfortunately, I can't tell what it is from the documentation, because the following statement is contradictory:
Quote:If you want to output Progressive JPEGs, you need to set interlacing on with imageinterlace().
Taking an image from the gallery here seems to show that JPEGs are interlaced. I doubt you'll get much of a size difference for typical thumbnails though (I got <0.5% size reduction for a quick test image).
If you want to change it yourself though, open inc/xthreads/xt_image.php, and before the line
PHP Code:
imagejpeg($im, $fn, $this->_jpeg_quality);
|
add
PHP Code:
@imageinterlace($im, false);
|
I suspect progressive JPEGs aren't as widely supported as interlaced, though it shouldn't be much of an issue with today's web.