0

I'm SO close (I think!) to being done with "Resize (Less)" after a grueling run. After running check50, I'm a bit kerfuffled. Hexadecimal form of output file seems correct, as do the values of and bfsize and imagesize (I added in printf to check these values). However, check50 is telling me bfsize is wrong, and I'm also getting pixel colors that don't match hexadecimal. More explanation below:

My code (see images attached) compiles. I added in printf for all the header values for clarity. When running for scale factor of "2" with infile "small.bmp" and outfile "large22.bmp" (./resize 2 small.bmp large22.bmp), I get the following error message from check50: "expected 0xae not 0x5a for bfsize." However. My printf for bfSize(outfile) yields 174 (decimal form of 0xae). Also, when I open large22.bmp as hexadecimal, everything looks like a 2x enlarged version of small.bmp, with 2 bytes of padding. HOWEVER. When I open up the .bmp of large22, I see blue and black pixels. This doesn't seem to match up with the hexadecimal form of the file.

Note: I'm having trouble with debug50. When I set breakpoint at line 8, and start going through, it jumps to end as soon as I get to the first "return 1". I try setting breakpoints after (say, line 99), but then it doesn't run at all.

THank you for any insight. I hope my question helps others struggling with the same problems!

1.)

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

  • 1
    Hi. Please edit your question and replace the screen shots of your code with a cut and paste from the IDE. It's impossible to cut and paste code from your images for testing. Also, if you left any printf statements for testing in your code, it will cause the tests to fail. – Cliff B Sep 26 '19 at 16:22
0

Without actaully testing your code, I see a serious issue. While you've calculated new values for the various header fields (I'll assume that you calculated them right), the results were stored in local vars in the program. The header values were NOT updated in the header structs bi and bf before they were written out to the output file!

The headers control how the bitmap image is displayed. If the header values aren't right, the image may not be displayed correctly, even if the image hex data is right.

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

If not, please edit the question as mentioned in my comment.

| improve this answer | |
  • Oy. I was not, after all, "SO close" to being done. I had to go back and do a lot of learning about how to update header structs, and see now how simply storing values in local variables was nowhere near getting to the root of this problem. This one was a doozy! I'm in a good place, now. Thanks for the reminder to copy and paste code in addition to screen shots of it. – LippStick Oct 3 '19 at 15:44

You must log in to answer this question.

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