1

I am getting an error at IDE "Invalid or unsupported file format" for an input "n" equal or greater than:

  • 68 for small.bmp
  • 36 for smiley.bmp
  • 27 for large.bmp

I also tried to peek with staff's solution, and everything at headers seems to be OK.

Edit:

    ...
    // iterate over infile's scanlines
    for (int i = 0, biHeight = abs(bi.biHeight); i < biHeight; i++)
    {
    ...
  • can you post the code were you think you are getting the error from? – myckhel Feb 25 '19 at 15:42
  • just posted.. I have no ideia where is the error, it looks like it is not supporting the image of a certain size! – Bruno F Feb 25 '19 at 18:15
2

Your output file is too large, larger than the header claims. Use input height, not output height for the outermost for loop.

Not sure this can explain the problem you describe, especially those numbers make me wonder. A common mistake would be confusing input and output padding, but all related cases I've seen so far produced some viewable output.

| improve this answer | |
  • TY!!! You're right, I used the outptr biHeight at the outermost for loop, fixing that it worked well even for n=100! – Bruno F Feb 25 '19 at 20:58

You must log in to answer this question.

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