Fixed Wrong Methods Being Used To Set ImageMagick Compression

digitalpoint

Well-known member
In the XenForo_Image_Imagemagick_Pecl class, these lines:
PHP:
&& $this->_image->setCompression(Imagick::COMPRESSION_JPEG)
&& $this->_image->setCompressionQuality($quality);

should be:
PHP:
&& $this->_image->setImageCompression(Imagick::COMPRESSION_JPEG)
&& $this->_image->setImageCompressionQuality($quality);

It's confusing how ImageMagick has the method for the *object* and a different method for the image. Either way, currently XenForo is setting the compression for the object, which does not affect the image. You can test is by setting the $quality to 1 (or 100) and it outputs the same filesize (which is 86 since that's ImageMagick's default).

Using the setImageCompressionQuality method does actually alter the image quality as expected.
 
I doubt that changing the number to a number which is higher will improve the image quality to the naked eye.
 
You should be able to edit library/XenForo/Image/ImageMagick/pecl.php
it should be Pecl.php
Line 211.
I doubt that changing the number to a number which is higher will improve the image quality to the naked eye.
Then what's the point? Getting bigger size file and no difference in quality that you can see?
More people are using retina screens these days and the difference is much noticeable than before.
 
Then what's the point? Getting bigger size file and no difference in quality that you can see?
More people are using retina screens these days and the difference is much noticeable than before.

I just tested this on my iPad with Retna and I stand corrected, the image quality is better as it shows less artifacts.

Note that I made the change as Shawn described in post #1 and changing the quality did not make a difference, so I put back the code as it was and then changing the quality worked.

Changing the quality from 85 to 100 resulted in my avatar increasing from 5KB to 14KB.
 
I just tested this on my iPad with Retna and I stand corrected, the image quality is better as it shows less artifacts.

Note that I made the change as Shawn described in post #1 and changing the quality did not make a difference, so I put back the code as it was and then changing the quality worked.

Changing the quality from 85 to 100 resulted in my avatar increasing from 5KB to 14KB.
Yes, I view my site from a retina iPad and Macbook pro so every artifacts seem to be magnified. The size increase is not a big deal as I use CDN to host the images.

Maybe we should be able to change the quality number from ACP.
 
Yes, I view my site from a retina iPad and Macbook pro so every artifacts seem to be magnified. The size increase is not a big deal as I use CDN to host the images.

Maybe we should be able to change the quality number from ACP.

I agree the size is trivial with today's internet speeds. I left mine set at 100.

As for a setting in the ACP, I think that's asking a bit much, we would have hundreds of additional settings if ones like this were to be included. Hopefully the developers will just change the number from 85 to 100 as more and more users are using computers with high resolution displays.
 
Would this be why after upgrading to xf 1.1.4 my uploaded images are looking like crap? Or at the very least worse then they previously were?
 
Would this be why after upgrading to xf 1.1.4 my uploaded images are looking like crap? Or at the very least worse then they previously were?

I'm not sure when the code was fixed, but 1.1.3 appears to have already been fixed. What version were you on before upgrading?

Are you using Imagemagick or GD?
 
Top Bottom