title: How to resize a bitmap
body: <pre><code>    // determine padding for scanlines
  int padding =  (4 - (bi.biWidth * sizeof(RGBTRIPLE)) % 4) % 4;
  
  // iterate over infile's scanlines
  for (int i = 0, biHeight = abs(bi.biHeight); i &lt; biHeight; i++)
  {
      for(int q = 0; q &lt; n; q++)
      {
          // iterate over pixels in scanline
          for (int j = 0; j &lt; bi.biWidth; j++)
          {
              // temporary storage
              RGBTRIPLE triple;
  
              // read RGB triple from infile
              fread(&amp;triple, sizeof(RGBTRIPLE), 1, inptr);
  
              // write RGB triple to outfile
              for (int r = 0; r &lt; n; r++)
                  fwrite(&amp;triple, sizeof(RGBTRIPLE), 1, outptr);
  
          }
  
      // skip over padding, if any
      fseek(inptr, padding, SEEK_CUR);
  
      //then add it back (to demonstrate how)
      for (int k = 0; k &lt; padding; k++)
          fputc(0x00, outptr);
     }
  }
  </code></pre>
  
  <p>I'm trying to alter code so that I can resize a bmp by a factor of n (adding n triples to the the width and the height).  I have found a way to iterate a for loop that will resize the width: <code>for (int r = 0; r &lt; n; r++)</code>.   I tried to do the same thing with height and I can't figure out why it won't work.  <code>for (int q = 0; q &lt; n; q++)</code></p>