I've been working on Resize since last November. (No, seriously) I'm close but I'm not 100%. I can resize the large.bmp and it looks correct and the header files match up with using peek with the staffs version. But when I resize small.bmp it doesn't work correctly.

I've not sought help online before and I'm not 100% sure what to post from my code as I don't want to violate the academic honesty. Here is a link to what I have now.

code removed

Thanks for any help you can provide!

  • Not enough code. If you can post your code elsewhere and post a link, we can help. (You can remove the link and take down the posted code once this is answered.)
    – Cliff B
    Jun 19, 2016 at 23:17
  • I've added a link to the code on github. Thanks.
    – agffth
    Jun 22, 2016 at 18:29

1 Answer 1


So close to success! If you look at the output file created when using a multiplier of 2, the first line is perfect, but then it goes bad from there. Another clue is that there are pixels that are 000000. This means that the padding is getting into the image data.

Take a really close loop at the following line:

fseek(inptr, -biWidthOld * sizeof(RGBTRIPLE) + paddingOld, SEEK_CUR);

See any problems? This line is supposed to move the pointer backwards. Look closely at the second parameter, -biWidthOld * sizeof(RGBTRIPLE) + paddingOld. It says move backwards by biWidthOld, but forward by paddingOld. Anything wrong with that?

If this answers your question, please click on the check mark to accept. Let's keep up on forum maintenance. ;-)

  • THANK YOU! One change and all my tests are passing. How I kept overlooking that I don't know. Thanks again!!
    – agffth
    Jun 22, 2016 at 19:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .