10

In resize problem, we have to update the headers of image. Which attributes should be updated and how do i update bfSize attribute?

3
  • I think it should be something like: bf.bfSize = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER) + bi_new.biSize; Commented Jun 27, 2014 at 17:42
  • What kind of error do you get, because I think I have similar problem, and I can't figure it out. Commented Jun 27, 2014 at 17:43
  • I'm not getting error in code. I reszie the image and it does. But when i check50 program it fails all the checks. That's why i thought something is wrong with my header
    – HKH
    Commented Jun 27, 2014 at 19:07

1 Answer 1

12

You have to update all the attributes that have to change after a resize: bi.biWidth, bi.biHeight, padding, bi.biSizeImage & bf.bfSize.

bf.bfSize = (updated bi.biSizeImage) + 54

6
  • and bi.biSizeImage?
    – HKH
    Commented Jun 29, 2014 at 15:35
  • updated bi.biSizeImage = ((updated bi.biWidth) * sizeof(RGBTRIPLE) + (updated padding)) * absolute value of (updated bi.biHeight);
    – supeindesu
    Commented Jun 29, 2014 at 15:57
  • Thank you very much!. It really solved my problem.
    – HKH
    Commented Jun 29, 2014 at 16:14
  • You're welcome.
    – supeindesu
    Commented Jun 29, 2014 at 16:42
  • 1
    for updating bi.biSizeImage, why do we need to time size of RGBTRIPLE? Commented Feb 25, 2015 at 6:44

You must log in to answer this question.

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