Hot answers tagged


Very common problem. You have only calculated the padding for the input file, but not the putput file. The padding for the output file will be dependent on the scaling and other factors. You need to calculate the output file padding independently. There may be other issues, but this is your first issue. If this answers your question, please click on the ...


You use bi.biWidth (in your case the output width at that point) both in for (int j = 0; j < bi.biWidth; j++) (found twice) and fseek(inptr, (bi.biWidth * sizeof(RGBTRIPLE)) * -1, SEEK_CUR); In both cases, you would have to use input width, not output width. Same is true for the height, though it would cause a larger file, but no visible distortion ...


For starters, it doesn't resize correctly. Next, the header isn't correct. Now, there are two more complex issues. The code only writes out one pixel to the output file when it should write out the entire row. Finally, it's writing out padding after each pixel instead of the end of each line of pixels. A restructuring of the for loops is in order. If ...


There is a problem here fseek(inptr, -(bi.biWidth * 3 + padding ), SEEK_CUR); //send infile cursor back. Has the program read the (infile) padding?

Only top voted, non community-wiki answers of a minimum length are eligible