Note that there are some explanatory texts on larger screens.

plurals
  1. POImagick::resizeImage and Imagick::scaleImage seem to compress/blur image, even when told not to
    primarykey
    data
    text
    <p>I have come across a strange and nit-picky issue with the PHP Imagick library's <code>resizeImage</code> and <code>scaleImage</code> methods. (client is unhappy, understandably as they are a photographer)</p> <p>Whenever an image is resized, it seems that the image becomes <strong>very slightly</strong> compressed, and dark areas become slightly pixelated due to this compression. This happens even if I tell it to render at full quality as I will explain below.</p> <p>Firstly, here is an example, including a 4x zoomed version where it is easier to see the problem: <img src="https://i.stack.imgur.com/kKngf.jpg" alt="Compression Issue"></p> <p>At first I assumed this was some problem with the interpolation method, but when I dug deeper, I realized that the image infact still becomes compressed <strong>even when resized to exactly the same size!?</strong>.</p> <p>The example shown above is a perfect example of that. It is a 100x100 image which has been resized to 100x100 using this code:</p> <pre><code>$image-&gt;resizeImage($this-&gt;width, 0, Imagick::FILTER_CATROM, 1); </code></pre> <p>This also appears to have the same results, even though I was told it would be better:</p> <pre><code>$image-&gt;scaleImage($this-&gt;width, 0, Imagick::FILTER_CATROM, 1); </code></pre> <p>The fourth argument is <code>blur</code> (<a href="http://www.php.net/manual/en/imagick.resizeimage.php" rel="nofollow noreferrer">see PHP docs</a>), which I understand is so that thumbnail images become aliased, however, even when I reduce this value to as small as 0.001, nothing happens.</p> <p>Even when I add this code in to set the image quality to 100%, it still happens:</p> <pre><code>$image-&gt;setImageCompression(Imagick::COMPRESSION_JPEG); $image-&gt;setImageCompressionQuality(100); </code></pre> <p>Can anyone explain to me why these artifacts are appearing in dark areas of images, and how I can prevent this from happening? These images resize perfectly fine in Photoshop, so it seems a unique issue with Imagick and not the image itself being unsuitable.</p> <p>As I said, I know this is nit-picking, however my client is in fact a photographer and pristine image quality is of high importance to them.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload