not able to save an image file using c?

前端 未结 2 2028
名媛妹妹
名媛妹妹 2021-01-27 21:20

I tried to clone a bmp image into another bmp image but the final image would not open.

#include 
#include 
#include 

        
相关标签:
2条回答
  • 2021-01-27 21:56

    BMP stores each row in a multiple of 4 bytes. In your case, that means that each rows takes 116 bytes, (2 bytes padding). That gives 116x78x3+54=27198 So you are doing it wrong.

    BTW the header length not always is 54 bytes.

    0 讨论(0)
  • 2021-01-27 22:01

    BMP images need padding so each line is a multiple of 4 bytes.

    Your lines are not a multiple of 4, so you're missing 2 bytes per line, or 162 in total - which is the difference in size.

    0 讨论(0)
提交回复
热议问题