title: QImage RGB32 to QImage RGB24, bad result with some kind of image
body: <p>I try to convert the <code>QImage</code> with RGB32 to <code>QImage</code> with RGB24. 
  My code doesn't work in this case:</p>
  
  <p>When the image has an additional 1024 bytes in the BMP header, the size of the image is X*Y*3+54+an unknown 1024 byte.</p>
  
  <p><strong>The strange thing is that the code works if the image resolution x == resolution y, for example: 512x512 or 1024x1024. Whatever the situation: when I have or don't have the additional 1024 Byte in the header.</strong></p>
  
  <p>If the BMP does not have the additional 1024 byte in the header, every thing works fine even if resolution x is different than resolution y. My code :</p>
  
  <pre><code>QImage * img=new QImage("test.jpg");//load img as RGB32 32bit per pixel whatever the format of input
  
  QImage * tmp_img=new QImage(img-&gt;width(),img-&gt;height(),QImage::Format_RGB888);// image dest 24bit per pixel
  
       uchar * ptr1=img-&gt;bits();
       uchar * ptr2=tmp_img-&gt;bits();
  
       for( int k1=0,k2=0;k1&lt;img-&gt;width()*img-&gt;height()*4;k1+=4,k2+=3)//increment k1 by 4 because img format is RGB32
                                                    //increment k2 by 3 because tmp_img format is RGB888
       {
           ptr2[k2]=ptr1[k1];
           ptr2[k2+1]=ptr1[k1+1];
           ptr2[k2+2]=ptr1[k1];
       }
  </code></pre>