title: Imagemagick depth convert
body: <p>Having an imgage <code>in.png</code>. Now do the next:</p>
  
  <pre><code>$ convert in.png -strip out.tiff     #convert to tiff
  $ convert out.tiff -strip out.png    #and back
  $ cmp in.png out.png
  $#no output - the images has no difference - theyre same
  
  $ identify in.png out.png
  in.png PNG 300x300 300x300+0+0 16-bit sRGB 1.65KB 0.000u 0:00.000
  out.png[1] PNG 300x300 300x300+0+0 16-bit sRGB 1.65KB 0.000u 0:00.000
  </code></pre>
  
  <p>now trying this via <code>eps</code>. So:</p>
  
  <pre><code>$ convert in.png -strip out2.eps        #convert to eps
  $ convert out2.eps -strip out2.png      #back
  </code></pre>
  
  <p>and the images are different.</p>
  
  <pre><code>$ identify in.png out.png out2.png
  in.png PNG 300x300 300x300+0+0 16-bit sRGB 1.65KB 0.000u 0:00.000
  out.png[1] PNG 300x300 300x300+0+0 16-bit sRGB 1.65KB 0.000u 0:00.000
  out2.png[2] PNG 300x300 300x300+0+0 8-bit sRGB 4c 321B 0.000u 0:00.009
  </code></pre>
  
  <p>As you can see, the conversion eps -> png creates 8-bit png.</p>
  
  <p>Curiosity plus - the EPS is 16 bit!</p>
  
  <pre><code>$ identify out2.eps 
  out2.eps PS 300x300 300x300+0+0 16-bit sRGB 1.42KB 0.000u 0:00.000
  </code></pre>
  
  <p>Questions:</p>
  
  <ul>
  <li>why the <code>eps-&gt;png</code> conversion changes the bit-depth?</li>
  <li>how to convert from eps to png to get 16-bit png? (as from tiff).</li>
  </ul>
  
  <h1>EDIT</h1>
  
  <p>Tested @Rachel recommendation:</p>
  
  <pre><code>$ convert out2.eps -depth 16 out3.png
  $ identify out3.png 
  out3.png PNG 300x300 300x300+0+0 8-bit sRGB 4c 518B 0.000u 0:00.000
  </code></pre>
  
  <p>8 bit again.</p>
  
  <p>My ImageMagick version:</p>
  
  <pre><code>$ convert --version
  Version: ImageMagick 6.8.9-1 Q16 x86_64 2014-06-01 http://www.imagemagick.org
  Copyright: Copyright (C) 1999-2014 ImageMagick Studio LLC
  Features: DPC Modules
  Delegates: bzlib djvu fftw fontconfig freetype gslib gvc jng jp2 jpeg lcms ltdl lzma pangocairo png ps tiff webp wmf x xml zlib
  </code></pre>
  
  <p>If anyone want test, here is my test image:</p>
  
  <p><img src="https://i.stack.imgur.com/V0EwS.png" alt="test image"></p>
  
  <h1>FINAL</h1>
  
  <p>So, @Mark Setchell and @Rachel Gallen's recommendation are good. @Marks command works, so the key is PNG48.</p>
  
  <pre><code>$ convert out2.eps -depth 16 PNG48:out7.png
  $ identify out7.png
  out7.png PNG 300x300 300x300+0+0 16-bit sRGB 1.86KB 0.000u 0:00.000
  </code></pre>
  
  <p><strong>Finally</strong> 16-bit png. What I will <a href="https://stackoverflow.com/questions/24685025/imagemagick-mogrify-strip-changes-image">ask it in another question,</a> why the next:</p>
  
  <pre><code>$ mogrify -strip out7.png
  $ identify out7.png 
  out7.png PNG 300x300 300x300+0+0 8-bit sRGB 4c 321B 0.000u 0:00.000
  </code></pre>
  
  <p>8 bit again. And the <code>-strip</code> should remove only metadata and should <strong>not</strong> change the image itself.</p>