Photos are legible, but with this vertical black stripes
// determine biHeight, biWight and padding for infile scanlines
int InPadding = (4 - (bi.biWidth * sizeof(RGBTRIPLE)) % 4) % 4;
int biHeightInfile = bi.biHeight;
int biWightInfile = bi.biWidth;
int InfileScanline = InPadding + (biWightInfile * 3);
// determine biHeight, biWight and padding for outfile scanlines
bi.biWidth = bi.biWidth * n;
int OutPadding = (4 - (bi.biWidth * sizeof(RGBTRIPLE)) % 4) % 4;
bi.biHeight = bi.biHeight * n;
bi.biSizeImage = abs(bi.biHeight) * (bi.biWidth*3 + OutPadding);
bf.bfSize = bf.bfOffBits + bi.biSizeImage;
// write outfile's BITMAPFILEHEADER
fwrite(&bf, sizeof(BITMAPFILEHEADER), 1, outptr);
// write outfile's BITMAPINFOHEADER
fwrite(&bi, sizeof(BITMAPINFOHEADER), 1, outptr);
// iterate over infile's scanlines
for (int i = 1; i <= abs(biHeightInfile*n); i++)
{
// iterate over pixels in infile scanline
for (int j = 0; j < biWightInfile; j++)
{
// temporary storage
RGBTRIPLE triple;
// read RGB triple from infile
fread(&triple, sizeof(RGBTRIPLE), 1, inptr);
// write RGB triple to outfile
fwrite(&triple, sizeof(RGBTRIPLE), n, outptr);
}
// skip over padding in infile, if any
fseek(inptr, InPadding, SEEK_CUR);
// then add padding zeroes to outfile, if any
for (int k = 0; k < OutPadding; k++)
{
fputc(0x00, outptr);
}
//move infile's pointer back to repeat the horizontal resizing
......