0

So I've been struggling over this small problem, where my bitmap header and resizing functions seem to work for bitmaps, but check50 says it doesn't work for 1x1 pixel bitmaps. I want to know why this is.

Source code: http://pastebin.com/xmQ8rMmw

Here is the output that check50 gives for my resize.c

:) 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 https://sandbox.cs50.net/checks/8ac3c1b266314e4391b252798c6eb172

Help would be appreciated ^

1

The header calculations are not correct. There are two separate problems, and one masks the other. You should reevaluate how you are calculating biSizeImage and all of its components. Also, give some thought to the units of measure of a pixel vs. the units of padding. This may be cryptic, but what fun would it be if you were just given the answer? ;-)

If this answers your question, please click on the check mark to accept. Let's keep up on forum maintenance. ;-)

| improve this answer | |
  • So are you saying that my resizing function has no problem, just the padding and the headers function? – Leo Noob Lin May 30 '16 at 13:52

You must log in to answer this question.

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