title: Convert with imagemagick a multi layers psd into a merged layer tiff without visible modification
body: <p>I need to automatically convert PSD files with or without multiple layers into a TIFF LZW with only one layer, without noticeable differences.</p>
  
  <p>Here is type of command I tried with Imagemagick 6.9.2-7 : </p>
  
  <pre><code>convert "fontaine_p7p.psd" -compress LZW -define tiff:endian=msb -background none -flatten fontaine_p7p.tif
  </code></pre>
  
  <p>Result is not as expected compare to the one obtained thanks to PhotoShop.
  Layers are correctly merged, sizes of conversions are equivalent but I can see visible modifications on the Imagemagick tiff that are not visible on tiff generated thanks to PhotoShop.</p>
  
  <p>Here are examples of a source PSD and the Tiff obtained via the imagemagick conversion above and where visible modifications are clearly iden : 
  <a href="https://drive.google.com/file/d/0ByRmRqdU-OwbX090WXU3V2hqeVE/view?usp=sharing" rel="nofollow">PSD + TIFF + IdentifyVerbose</a></p>
  
  <p>Here are details on PSD and TIFF files :</p>
  
  <p>PSD : </p>
  
  <pre><code>identify fontaine_p7p.psd
  fontaine_p7p.psd[0] PSD 782x819 782x819+0+0 8-bit CMYK 2.965MB 0.000u 0:00.000
  fontaine_p7p.psd[1] PSD 544x819 544x819+226+0 8-bit CMYK 2.965MB 0.000u 0:00.000
  fontaine_p7p.psd[2] PSD 335x819 335x819+447+0 8-bit CMYK 2.965MB 0.000u 0:00.000
  fontaine_p7p.psd[3] PSD 782x13 782x13+0+806 8-bit CMYK 2.965MB 0.000u 0:00.000
  fontaine_p7p.psd[4] PSD 782x819 782x819+0+0 8-bit CMYK 2.965MB 0.000u 0:00.000
  fontaine_p7p.psd[5] PSD 782x819 782x819+0+0 8-bit CMYK 2.965MB 0.000u 0:00.000
  </code></pre>
  
  <p>TIFF : </p>
  
  <pre><code>identify fontaine_p7p.tif
  fontaine_p7p.tif TIFF 782x819 782x819+0+0 8-bit CMYK 1.552MB 0.000u 0:00.000
  </code></pre>
  
  <p>It seems that imagemagick is not handling transparency is the same way as Photoshop during conversion to Tiff.</p>
  
  <p>Is somebody have proposition to have a better result with such kind of procedure ? I already tried to replace the ("-flatten" option by "-layers merge" but in that case the transparency background is completely lost.</p>
  
  <p>Thanks in advance</p>