I'm currently working on resize, and for some reason the pixels in each row (except for one, the middle white one) seem to get resized horizontally except that with the resized pixel its a different color. Also, that resized pixel changes color with each running of the code for some reason. (See attached pictures (scale value used was 2)). But when I use a scale value of 1, the code works as it should (copies). Heres my code: https://gist.github.com/AProgrammerZ/bf2035932d7d636dc654663f4c3efe28
I've just started this one today and am currently struggling with vertical resize. I found answer from few years ago that should be helpful:
When writing the rgb triple, unfortunately you can't just say, "write it *4 times". C isn't that smart. It writes it once and then fills the other 3 times with garbage values or unknown values...which is why your colors are strange.
To resize, pseudocode below:
//iterate over infile scanlines for loop
//for loop for vertical resize
//if this isn't the first time through this row to resize vertically //use fseek to reset the cursor back to the start of the row //for loop for horizontal resize //read a single RGB triple in //for loop to write that triple n number of times //add new padding //skip old padding