So after quite some fiddling I am at a place where, when resizing both small.bmp and smiley.bmp: 1) in- and out-files look the same; 2) peek matches the staff's implementation; and 3) "diff student.bmp staff bmp" returns no diferences. But, when running check50, resize correctly to some sizes but not others...

Some you win, some you lose

I am at a loss as I cannot figure where the error lies. I am providing a link to my code below. Any input will be greatly appreciated!

here's the updated link to the culprit code...

(Link updated... Thanks for pointing out the issue with the link!)

  • bad link to the culprit code. please edit
    – Cliff B
    Jul 12, 2016 at 3:26
  • Thanks for pointing it out! I have updated the link and found the issue after thinking about it overnight :)
    – dmorali
    Jul 12, 2016 at 16:21

1 Answer 1


Found out that the issue had to do with calculating biSizeImage and bfSize independently and accounting for padding in one but not the other... thus, things matched when the output image had a size that was a multiple of 4 but not otherwise.

To anyone facing similar mixed results in check50, note the differences between how biSizeImage and bfSize are calculated in the broken code...

It's all smileys now!

  • Even I had the same issue and I made the changes in the calculation of biSizeImage and bfSize. But still I am getting the same error in check50. I posted my question at cs50.stackexchange.com/questions/19101/… . If you recognize what is going wrong, please post your answer for the above question. Jul 12, 2016 at 21:28

You must log in to answer this question.

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