title: Local Imagemagick not converting to DDS (DXT5) correctly
body: <p>I'm having some difficulty using the ImageMagick command line utility to properly convert a png to a DDS file with the DXT5 compression algorithm.</p>
  
  <pre><code>convert -format dds -define dds:compression=dxt5 leia.png leia.dds
  </code></pre>
  
  <p>This was done using <code>Version: ImageMagick 6.8.9-10 Q16 x86_64 2016-09-14</code>. I am able to view the file locally, so it appears correct. When I load it into OpenGL however, I just see artifacts all over the place (random color pixels). To confirm the generated file was a DDS file:</p>
  
  <pre><code>od -bc leia.dds | head
  </code></pre>
  
  <p>Which generated:</p>
  
  <pre><code>$ od -bc leia.dds | head
  0000000   104 104 123 040 174 000 000 000 007 020 010 000 356 002 000 000
             D   D   S       |  \0  \0  \0  \a 020  \b  \0 356 002  \0  \0
  0000020   024 003 000 000 120 014 000 000 000 000 000 000 001 000 000 000
           024 003  \0  \0   P  \f  \0  \0  \0  \0  \0  \0 001  \0  \0  \0
  0000040   111 115 101 107 105 115 101 107 111 103 113 000 000 000 000 000
             I   M   A   G   E   M   A   G   I   C   K  \0  \0  \0  \0  \0
  0000060   000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000
            \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0
  0000100   000 000 000 000 000 000 000 000 000 000 000 000 040 000 000 000
            \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0      \0  \0  \0
  </code></pre>
  
  <p>You can see the first part of the header which contains the <code>DDS</code> header.</p>
  
  <p>So for giggles, I decided, hey, maybe I should try converting this image using <a href="http://www.aconvert.com/image/png-to-dds/" rel="nofollow noreferrer">a separate utility</a>, just to make sure there is nothing wrong with the file.  When I then loaded in this file to OpenGL, it worked correctly.</p>
  
  <p>When the file downloaded, I also checked the header again and saw:</p>
  
  <pre><code>od -bc leia-online.dds | head
  0000000   104 104 123 040 174 000 000 000 007 020 010 000 356 002 000 000
             D   D   S       |  \0  \0  \0  \a 020  \b  \0 356 002  \0  \0
  0000020   024 003 000 000 300 012 011 000 000 000 000 000 001 000 000 000
           024 003  \0  \0 300  \n  \t  \0  \0  \0  \0  \0 001  \0  \0  \0
  0000040   111 115 101 107 105 115 101 107 111 103 113 000 000 000 000 000
             I   M   A   G   E   M   A   G   I   C   K  \0  \0  \0  \0  \0
  0000060   000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000
            \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0
  0000100   000 000 000 000 000 000 000 000 000 000 000 000 040 000 000 000
            \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0      \0  \0  \0
  </code></pre>
  
  <ol>
  <li>It appears the online tool is using ImageMagick, same as I.</li>
  <li>If you look at the first result it, Octals 20-23 are: <code>120 014 000 000</code> vs the online result of: <code>300 012 011 000</code>. According to <a href="http://atlantica.wikia.com/wiki/Forum:Ndoors_DDS_image_format_dissection" rel="nofollow noreferrer">this</a> indexes 20-23 point to the 'byte count'</li>
  </ol>
  
  <p>So basically, my underlying question is this: <strong>How do I properly convert a png file to a dds texture using ImageMagick?</strong></p>
  
  <p><strong>Update:</strong> </p>
  
  <p>The online imagemagick generated the image header with: </p>
  
  <pre><code>width: 788 height: 750 linearSize: 592576 mipmap_count: 1
  </code></pre>
  
  <p>My local version of imagemagick generated the image header with: </p>
  
  <pre><code>width: 788 height: 750 linearSize: 3152 mipmap_count: 1
  </code></pre>
  
  <p>So I wonder if I'm missing a flag somewhere to get it to correctly write the header that the online version might be using?</p>