1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Fixed Wrong Methods Being Used To Set ImageMagick Compression

Discussion in 'Resolved Bug Reports' started by digitalpoint, Jul 23, 2012.

  1. digitalpoint

    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.
     
    D.O.A., Darkimmortal and Andy.N like this.
  2. Andy.N

    Andy.N Well-Known Member

    Shawn,
    Which file/directory is this?
    My grep doesn't return anything.
    Thanks
     
  3. digitalpoint

    digitalpoint Well-Known Member

    library/XenForo/Image/ImageMagick/Pecl.php
     
    Adam Howard, simbolo and Andy.N like this.
  4. Mike

    Mike XenForo Developer Staff Member

    Well that's just confusing, but sorted now. :)
     
  5. Andy.N

    Andy.N Well-Known Member

    Can we change the compression quality to best or 100?
     
  6. Brogan

    Brogan XenForo Moderator Staff Member

    You should be able to edit library/XenForo/Image/ImageMagick/pecl.php

    Line 211.
     
  7. AndyB

    AndyB Well-Known Member

    I doubt that changing the number to a number which is higher will improve the image quality to the naked eye.
     
  8. Andy.N

    Andy.N Well-Known Member

    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.
     
  9. AndyB

    AndyB Well-Known Member

    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.
     
    Andy.N likes this.
  10. Andy.N

    Andy.N Well-Known Member

    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.
     
  11. AndyB

    AndyB Well-Known Member

    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.
     
  12. DBA

    DBA Well-Known Member

    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?
     
  13. CyclingTribe

    CyclingTribe Well-Known Member

    So has the quality changed from the default 86 to some other figure in XF 1.1.4?
     
  14. AndyB

    AndyB Well-Known Member

    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?
     

Share This Page