Sign in to follow this  

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

This topic is 4342 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

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--

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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--

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

This topic is 4342 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this