r/cs50•
rupek1995

[resize.c] Can't figure out how to resize vertically (and horizontally with floats)

NOTICE: I'm talking about the more comfortable version of the assignment.

I've been sitting and trying to work this out for 2 days now, and I still can't crack it! I managed to get the headers right (answer was basically given to us in the video) , but I can't get it to resize properly.

I feel stupid for not getting it, and for not figuring it out by now.

Please take a look at the source code if you want.

Here's the output for ./resize 1.2 large.bmp result.bmp... HERE

and output for ./resize 5 large.bmp result.bmp... HERE

It seems that this version of code only resizes horizontally , and multiplying each scanline n times (on line 99) does not work:

// resize scanlines vertically (basically copy them n times)
for (int v_row = 0; v_row < value; v_row++)
{
    ...
}

And if anyone's interested: my older version that didn't seem to work as intended: HERE

Can anyone help me out? I feel like I want to give up already (and look up someone else's code) :(

Posted Feb 16, 2017, 10:49 PM UTC

21
Loading comments…