Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

TWild

Photoshop's bmp

This topic is 5822 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Whenever I try to load an image saved in photoshop (8-bit, indexed color) my program crashes. It does fine if I save with PaintShop Pro 7 (demo). I should be able to do this with photoshop, but can''t figure it out. Any ideas?

Share this post


Link to post
Share on other sites
Advertisement
AFAIK, PSP doesn''t do RLE, so that could be your issue. If there isn''t an option to save an uncompressed BMP in PS, Adobe should be collectively castrated.

Share this post


Link to post
Share on other sites
Also, I''ve noticed other programs (like IView) creates a "BM6" header, even if the BMP is 24-bit. Photoshop seems to create a "BM8" header for the same thing (dunno if it adds extra stuff in there, but my converter worked fine when I added BM8 detection.)

2DNow - Specializing in yesterday''s technology today!

Share this post


Link to post
Share on other sites
Well, I''m just starting out :/ I''m using Andre Lamothe''s libraries from Tricks of the Windows Game Programming Gurus, 2nd ed. I finally got a bitmap to the screen! Next step, multiple bitmaps to the screen.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
A bitmap contains 2 ways to save the height/width information of the bitmap image.


  
typedef struct tagBITMAPINFOHEADER{ // bmih

DWORD biSize;
LONG biWidth;
LONG biHeight;
WORD biPlanes;
WORD biBitCount
DWORD biCompression;
DWORD biSizeImage;
LONG biXPelsPerMeter;
LONG biYPelsPerMeter;
DWORD biClrUsed;
DWORD biClrImportant;
} BITMAPINFOHEADER;


The above is a bitmap header definition. Most packages fill out this structure completely. However photoshop does not. If I remember correctly it uses the biXpelsPerMeter and biypelsPerMeter to calculate the biSize of the image. IE, it doesn''t store the biSize of the image in the structure as it should. Now most bitmap readers out there take for granted that the biSize is there and is valid (Aka lamothes BMP reading code), and it uses this to determine how much of the bitmap to read. You can see this can be a minor problem. Your best solution to this problem is to make some modifications to the file loading code that fills in the structure completely based on the data photoshop saved that is valid.

Share this post


Link to post
Share on other sites
The problem with Photoshop''s bmps is that it will always have the biSizeImage to 0. In order to counter this insert this code before you allocate the memmory for the bitmap (before you use the biSizeImage).

  
// Check to make sure that the biSizeImage isn''t empty (which it is if it''s a Photoshop bitmap)

if(bitmapInfoHeader.biSizeImage == 0) {
bitmapInfoHeader.biSizeImage = (int)bitmapInfoHeader.biWidth * bitmapInfoHeader.biHeight * (bitmapInfoHeader.biBitCount / 8);
}

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!