title: ImageMagick jpeg quality extremely low
body: <p>I have the following image <code>188_f.jpg</code>:</p>
  
  <p><img src="https://i.stack.imgur.com/BDBk3.jpg" alt="enter image description here"></p>
  
  <p>And the following code:</p>
  
  <pre><code>&lt;?php
      $ss = "convert 188_f.jpg -quality 95% -set colorspace RGB -colorspace CMYK 188_f_cmyk.jpg 2&gt;&amp;1";
      echo "&gt;" . $ss . "&lt;br /&gt;";
      echo system($ss);
  ?&gt;
  </code></pre>
  
  <p>When I run this code, I get this image as output:</p>
  
  <p><img src="https://i.stack.imgur.com/r6Npp.jpg" alt="enter image description here"></p>
  
  <p>Which is indeed in CMYK, but when viewed at 100% there is a significant loss in quality. (Wasn't sure if SE did any conversions when uploading, so I uploaded the above images via FTP so you can examine them directly if needed.)</p>
  
  <p><img src="https://i.stack.imgur.com/pHPNs.png" alt="enter image description here"></p>
  
  <p>I tried moving the quality argument around, with and without the percent sign, and I also looked through the Imagick guide, but I couldn't find any explanation for why the quality goes down. The output file has the same number of pixels.</p>
  
  <p><strong>EDIT:</strong> Making no other changes to the script except changing the colorspace options, here were the results:</p>
  
  <p><img src="https://i.stack.imgur.com/crZMN.png" alt="enter image description here"></p>
  
  <p><strong>EDIT 2:</strong> Also tried multiple different profiles, using this:</p>
  
  <pre><code>convert 188_f.jpg -quality 95% -profile profiles\\UncoatedFOGRA29.icc -colorspace CMYK 188_f_cmyk.jpg 2&gt;&amp;
  </code></pre>
  
  <p>None of them got rid of the pixelatedness.</p>