I'm currently working on Resize, and it just doesn't work as it should (see picture (scale value used was 2). Any suggestions? Here's my code: https://gist.github.com/AProgrammerZ/039ebc39ff9ab98dde9f92910c3b6a7a.

Thanks! enter image description here

1 Answer 1


Your padding seems to be off, you have to consider it on every line you take as input. Check out how it is nested in copy.c. You'll probably have to correct that pos assignment too, taking this into account.

  • I don't understand how its off. In copy.c, the padding is placed right after the "// iterate over pixels in scanline" for loop (and after the "// skip over padding, if any", which wasnt how it was in my code, so I corrected it, but it still had the same results). So what do you mean? And what do you mean by correcting the pos? Mar 29, 2019 at 0:56
  • It's not off compared to the original file, but you changed the way the pointer navigates through the file, try to imagine how it "walks" in copy.c and compare that with your program "path". You'll have to change it's place, you can't leave it as is, the original one is off. By correcting the pos, I meant your variable that holds the position inside the file, you'll probably need to change that too. I just messed a bit with your code and you're almost there, don't give up. Relax a bit and think more carefully about it.
    – user23369
    Mar 29, 2019 at 1:54

You must log in to answer this question.

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