title: CMYK images turn negative with TCPDF
body: <p>I have a problem using TCPDF to generate PDF images containing a CMYK PNG file.</p>
  
  <p>The system allows the user to upload photos, which can be JPG, GIF or PNG. ImageMagick converts these images into CMYK from RGB where necessary. The image is then uploaded to the fileserver (Amazon S3).</p>
  
  <p>When presented, the image is simply displayed on the screen in HTML on the "preview" page, and clicking a button generates the PDF.</p>
  
  <p>The PDF is the point where the image goes negative (colours invert). From what I can tell, the  image remains as expected until the point where TCPDF inserts the image into the document:</p>
  
  <pre><code>$tcpdf-&gt;Image($path_to_image, 0, 3.5, '42', '22', $file_extension, '', '', false, 300, '', false, false, 0, false, false, false);
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/Lx0Rk.png" alt="enter image description here"> <code>----&gt;</code> <img src="https://i.stack.imgur.com/WUtzB.png" alt="enter image description here"></p>
  
  <p>The file type is PNG, extension is <code>png</code>. Colour profile is CMYK. When opened in the browser, the image looks fine.</p>
  
  <p>I also have not been able to replicate this on my local development environment, it only seems to occur on the live site which makes it even more difficult to replicate. This only seems to occur with PNG files.</p>
  
  <p>The OP of <a href="http://sourceforge.net/p/tcpdf/discussion/435311/thread/c21108f9#0ab1" rel="noreferrer">this article</a> passes over this issue in one of his ranting posts, but doesn't seem to resolve it.</p>
  
  <p>Has anyone encountered this issue and worked out how to resolve it? I guess it's happening somewhere in the TCPDF (v5.9.103) class as the source file is fine.</p>