Photoshop: Error in ImagesSize parameter with export to BMP

  • 1
  • Problem
  • Updated 3 weeks ago
  • (Edited)
There are 3 types of structures on a BMP file. These are "BITMAPINFOHEADER", "BITMAPV4HEADER" and "BITMAPV5HEADER". M

Photoshop's file is based on "BITMAPINFOHEADER", but there is an error in the parameter of "ImageSize". The "ImageSize" must be a multiple of 4, but the parameter in the Photoshop is "0x0802." This is a bug Adobe should fix.
Photo of kevino z

kevino z

  • 5 Posts
  • 0 Reply Likes

Posted 4 weeks ago

  • 1
Photo of Jeffrey Tranberry

Jeffrey Tranberry, Sr. Product Manager, Digital Imaging

  • 14625 Posts
  • 1948 Reply Likes
There are several ways to save a BMP file. Are you using Save As..., Export As..., or Save for Web...?
Photo of kevino z

kevino z

  • 5 Posts
  • 0 Reply Likes
I did save as. I can not attach the file since the website refuses to accept a BMP. not too useful, now...
Photo of Jeffrey Tranberry

Jeffrey Tranberry, Sr. Product Manager, Digital Imaging

  • 14625 Posts
  • 1948 Reply Likes
Could you also please post a BMP that exhibits this behavior for us to troubleshoot? Thanks!

Photo of kevino z

kevino z

  • 5 Posts
  • 0 Reply Likes
https://img42.com/F2Z7r+  should be the one that doesn't work - created by photoshop
https://img42.com/pqZfo+  should be the one that does work - took photoshop BMP above, opened in MS Paint, clicked one pixel to make it black, and saved it.

Apparently a difference in how the header is formed. As I stated above, Photoshop doesn't set the parameter correctly for the ImageSize.
Photo of Foster Brereton

Foster Brereton, Programmer

  • 42 Posts
  • 14 Reply Likes
Thanks for the bug report.

The Photoshop-created BMP you posted has a DIB header size of 108, implying a header is of type BITMAPV4HEADER. According to https://msdn.microsoft.com/en-us/windows/desktop/dd183380, I see no requirements that the height, width, or image size fields need to be a multiple of 4. (Nevertheless, the image size field in the Photoshop BMP is already 2048, which is a multiple of 4.) Between the Photoshop-BMP and the MSPaint-BMP, the height, width, and image size fields are all the same values (64, 235, and 2048 respectively.)

If I am missing something here, please clarify.
Photo of kevino z

kevino z

  • 5 Posts
  • 0 Reply Likes
Sorry. I made a mistake.

Tthis is an example of a BMP file from photoshop. It has a completely different header. It is not a type of "BITMAPV4HEADER", but a "BITMAPINFOHEADER". My mistake on uploading the wrong file the first attempt

Here is a proper one: 
https://img42.com/bi8Ee+

my friend who is helping me said the photoshop BMPs actually have BITMAPINFOHEADER with header size of 40 bytes, not the 108.

Also, He made a 235x64 pixels bitmap file. Checking the header info and the image data using binary editor, the result was the header size is 40 bytes, and the size of image data is 2050 instead of 2048.