MyBB Hacks

Full Version: Image Compression?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
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?
What is the full size of your images, and what is the thumbnail size you use?

It doesn't happen to me. You can look at my images gallery here:
http://www.14.mynie.co.cc/forumdisplay.php?fid=53

Or, you can try it here:
http://mybbhacks.zingaburga.com/forumdisplay.php?fid=26
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 Smile
Sorry to bring this thread back from the dead - but I also have a question about images compression. I was reading that it is preferred to use progressive.jpgs over baseline and that the  http://www.php.net/manual/en/function.im...http://www.php.net/manual/en/function.imageint  is required. Is this included in the XThreads Image Filtering Chains? I could find no reference to it in the Documentation.
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.

Pages: 1 2
Reference URL's