0

I've got the header files outputting correctly, and now I'm struggling to understand what exactly needs to be done to accomplish the horizontal resize.

I believe that I need a loop to fwrite RGBTRIPLE to the outfile n (scale factor) times, but implementing a for loop for fwrite causes the output file to return an "invalid or unsupported image format" message.

Before attempting a loop for the fwrite function, I just set the number of blocks in the fwrite function to be "n" rather than 1, but that resulted in an image made up of random colors/blocks.

I'm really struggling with this pset, so any guidance would be much appreciated.

edited out code

0

"invalid or unsupported image format" message.

I'm highly suspicious that you have your header right. The very first thing that a program that displays bitmap images does is to read the file header. If the first field, bfType isn't 'BM', it's going to generate that error. Your code may have changed the field, it may have not copied the header to the output file, or it may be copying the bi and bf headers out in the wrong order (a common error). Another issue could be changing biSize instead of biSizeImage.

Simply put, this error is almost always because of a bad header. Without seeing the code that deals with the headers, it's not possible to definitively determine the problem.

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

2
  • If I use peek, the output of the headers appears as it should be. Also, running the code without the for loop for the fwrite leads to an image that actually opens. So confused! I'll post the code for my headers shortly.
    – klmo8
    Feb 29 '16 at 19:46
  • Silly mistakes were made; please disregard previous posts.. Thank you again for your time Cliff!
    – klmo8
    Feb 29 '16 at 23:28

You must log in to answer this question.

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