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; Jun 27 '14 at 17:42
  • What kind of error do you get, because I think I have similar problem, and I can't figure it out. Jun 27 '14 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
    Jun 27 '14 at 19:07
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
    Jun 29 '14 at 15:35
  • updated bi.biSizeImage = ((updated bi.biWidth) * sizeof(RGBTRIPLE) + (updated padding)) * absolute value of (updated bi.biHeight);
    – supeindesu
    Jun 29 '14 at 15:57
  • Thank you very much!. It really solved my problem.
    – HKH
    Jun 29 '14 at 16:14
  • You're welcome.
    – supeindesu
    Jun 29 '14 at 16:42
  • 1
    for updating bi.biSizeImage, why do we need to time size of RGBTRIPLE? Feb 25 '15 at 6:44

You must log in to answer this question.

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