Problem with 32 Bit Surfaces and SDL_SaveBMP

Hello !

When i save a 32 Bit Surface with SDL_SaveBMP,
it only saves it as a 24 Bit BMP File.

If SDL_SaveBMP can save 32 Bit BMPs at the moment,
then this is a bug, or if it is not able to save them,
then it should return an error.

CU

Hi Torsten,

If you have saved the file as a *.BMP and that is the format you
intended to save it as, the behaviour is correct.

BMP does not support an alpha channel; BMP is a ‘flat’ 24-bit RGB
(8-bits per channel).

If you wish to save the alpha channel, you need to use a different
format - commonly PNG for loss-less, JPEG for lossy.

Google “image file formats” for more background.

Jitsu Love,

Eddy

Torsten Giebl wrote:> Hello !

When i save a 32 Bit Surface with SDL_SaveBMP,
it only saves it as a 24 Bit BMP File.

If SDL_SaveBMP can save 32 Bit BMPs at the moment,
then this is a bug, or if it is not able to save them,
then it should return an error.

CU


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Hello,

That’s not quite right. The BMP format supports a whole bunch of pixel
formats, from 1 bit per pixel all the way up to 32 bits including
alpha channel (although that’s a fairly recent addition and support
for it isn’t so great).

I’ve found SDL’s support of BMP to be somewhat incomplete. If I
remember correctly, I’ve had difficulty loading 4 bit RLE bitmaps
before, even though they could be viewed/loaded fine in IrfanView and
Pro Motion.

Peter

2008/6/9 Edward Cullen :> Hi Torsten,

If you have saved the file as a *.BMP and that is the format you intended to
save it as, the behaviour is correct.

BMP does not support an alpha channel; BMP is a ‘flat’ 24-bit RGB (8-bits
per channel).

If you wish to save the alpha channel, you need to use a different format -
commonly PNG for loss-less, JPEG for lossy.

Google “image file formats” for more background.

Jitsu Love,

Eddy

Torsten Giebl wrote:

Hello !

When i save a 32 Bit Surface with SDL_SaveBMP,
it only saves it as a 24 Bit BMP File.

If SDL_SaveBMP can save 32 Bit BMPs at the moment,
then this is a bug, or if it is not able to save them,
then it should return an error.

CU


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Ahh… Jitsu Love in action!

Thanks for that Peter.

Took me a while, but I managed to find info on the v.5 format on MSDN.

I stand corrected.

I also note that the specification of SDL_SaveBMP() is not specific
about formats.

Now THERE’s a funny thing; 10 years on, people still think of BMP as a
flat 24-bit format… It’s also interesting to note the the ‘v5 BMP
format’ can actually be a wrapper around JPG or a PNG! Gotta love M$ LOL.

I stand by my original recommendation for file formats, minus the Jpeg
for lossy, as it doesn’t actually support alpha in the ‘standard’ format
(don’t ask why I thought that, 'cos I honestly don’t know… musta been
a brain-fart :slight_smile:

The ‘extended’ jpeg2000 format does support alpha, but it is,
apparently, not very common.

Eddy

Peter Mackay wrote:> Hello,

That’s not quite right. The BMP format supports a whole bunch of pixel
formats, from 1 bit per pixel all the way up to 32 bits including
alpha channel (although that’s a fairly recent addition and support
for it isn’t so great).
http://en.wikipedia.org/wiki/BMP_file_format

I’ve found SDL’s support of BMP to be somewhat incomplete. If I
remember correctly, I’ve had difficulty loading 4 bit RLE bitmaps
before, even though they could be viewed/loaded fine in IrfanView and
Pro Motion.

Peter

2008/6/9 Edward Cullen :

Hi Torsten,

If you have saved the file as a *.BMP and that is the format you intended to
save it as, the behaviour is correct.

BMP does not support an alpha channel; BMP is a ‘flat’ 24-bit RGB (8-bits
per channel).

If you wish to save the alpha channel, you need to use a different format -
commonly PNG for loss-less, JPEG for lossy.

Google “image file formats” for more background.

Jitsu Love,

Eddy

Torsten Giebl wrote:

Hello !

When i save a 32 Bit Surface with SDL_SaveBMP,
it only saves it as a 24 Bit BMP File.

If SDL_SaveBMP can save 32 Bit BMPs at the moment,
then this is a bug, or if it is not able to save them,
then it should return an error.

CU


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org