[MDX/C#] SurfaceLoader.Save as .bmp not working in 16bpp.

Started by
2 comments, last by jollyjeffers 18 years, 2 months ago
Took me a while to figure out what was going on, but I'm writing a method to save screenshots. Other filetypes like .jpg, .tga, and .png work fine at any time, but .bmp seems to only work when in 32 bits per pixel. If I'm in 16 bpp, the image saves, but there must be some problem because I can't open it in any programs. Is there any way to save when in 16 bpp. Hah, I guess I should specify, I'm using: Surface backbuffer = device.GetBackBuffer(0, 0, BackBufferType.Mono); SurfaceLoader.Save(fileName, ImageFileFormat.Bmp, backbuffer); Thanks for any pointers. --Vic--
Advertisement
Someone else was asking about 16bpp bitmaps recently - I did a bit of digging around, and I couldn't find much information on the format. I think it might simply be a case that it's a rarely supported format - most bitmaps are either 24bpp or 8pp (palettized) in my experience.

Following the DX SDK documentation to here yields this interesting fragment:
Quote:BMP is a standard format used by Windows to store device-independent and application-independent images. The number of bits per pixel (1, 4, 8, 15, 24, 32, or 64) for a given BMP file is specified in a file header.
Emphasis mine. It could just be a typo of course - but it could indicate that only the 555 format is allowed.

If I were you I'd pick a different format - PNG is one of my favourites [smile]

hth
Jack

<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>

Personally, I usually just use .png or .jpg if quality is not an issue, but I'm writing a screen shot taking method in the engine. I guess I'll just document that .bmps only work in 32 bpp and throw an exception if the user tries to save a .bmp in 16. Thanks for the tip. I tried to look around google and the docs but couldn't find anything, and was a little hesitant to ask about something that seemed so basic.

--Vic--
PNG is a lossless compressed file format - it should be fine for screenshots. It's JPG that you want to be careful of [wink]

Although, if you need to see the "pure" data that is in the frame buffer (stored in the exact pixel format that you rendered to) then DDS is your only guaranteed/safe choice.

hth
Jack

<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>

This topic is closed to new replies.

Advertisement