0

So i am having difficulty understanding why check50 fails here.

I have tested my image result by looking at its properties and it is re-sized correctly and looks the same as the image file I chose to re-size (only its obviously bigger).

Yet i fail every step of the check 50:

:) resize.c and bmp.h exist
:) resize.c compiles
:( doesn't resize 1x1-pixel BMP when n is 1
:( resizes 1x1-pixel BMP to 2x2 correctly when n is 2
:( resizes 1x1-pixel BMP to 3x3 correctly when n is 3
:( resizes 1x1-pixel BMP to 4x4 correctly when n is 4
:( resizes 1x1-pixel BMP to 5x5 correctly when n is 5
:( resizes 2x2-pixel BMP to 4x4 correctly when n is 2

I don't know why this would fail. I can only guess its when setting up the info and file headers.

Removed non-relevant code to highlight the code that was wrong.

This is what I have for my code, is there any mistakes I have made?

// set header size
    bi_new.biSizeImage  = (bi_new.biWidth * sizeof(RGBTRIPLE)) + (newPadding * abs(bi_new.biHeight));          
    bf_new.bfSize       =  bf.bfSize - bi.biSizeImage + bi_new.biSizeImage;

1 Answer 1

1

Did you run the peek function to compare your headers to the staff versions for the same resized images?

I would guess not, as you would have seen that biSizeImage is incorrect. Revisit that calculation. biSizeImage is the size of the scanlines, such that if it's a 6x6 bitmap, the value would be 18 bytes + 2 padding bytes per line, so 120 bytes total.

2
  • Ah i got it. Although one mistake left is bfsize do not match now! One last thing i have to fix ! So close!
    – user7869
    Commented Aug 8, 2015 at 3:16
  • Fixed that now - past all the check50 tests! yay! Thanks for the hint ;)
    – user7869
    Commented Aug 8, 2015 at 3:18

You must log in to answer this question.

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