The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
SDL_LoadBMP unknown pixel format
theGiallo


Joined: 03 Nov 2014
Posts: 11
Location: Genova, IT
I've a problem loading ARGB 32bit bmp images on Windows. On debian and android they load perfectly.
I created them using GIMP and i've tried to save them with the "compatibility option" that does not saves color space information but nothing changes.
I get the error "Unknown pixel format". This is formed into SDL_surface.c

Code:
/* Public routines */
/*
 * Create an empty RGB surface of the appropriate depth
 */
SDL_Surface *
SDL_CreateRGBSurface(Uint32 flags,
                     int width, int height, int depth,
                     Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask)
{
    SDL_Surface *surface;
    Uint32 format;

    /* The flags are no longer used, make the compiler happy */
    (void)flags;

    /* Get the pixel format */
    format = SDL_MasksToPixelFormatEnum(depth, Rmask, Gmask, Bmask, Amask);
    if (format == SDL_PIXELFORMAT_UNKNOWN) {
        SDL_SetError("Unknown pixel format");
        return NULL;
    }


The error occurs only with images that contain pixels with alpha different from 0 or 255.
I tried to change the renderer from accelerated to software and to give video driver hints, but nothing changed.
I'm using SDL 2.0.3 stable.
SDL_LoadBMP unknown pixel format
i8degrees


Joined: 22 Nov 2014
Posts: 39
Hi,
Did a quick peek, and it does look like it is a known bug [1] that has been resolved as of commit rev 9126 [2]. I don’t **think** there has been a release since that rev, so you’d either have to build from mercurial source tree or use SDL_image in the mean time.

1. https://bugzilla.libsdl.org/show_bug.cgi?id=2515
2. https://hg.libsdl.org/SDL/rev/08f3b56969b1
Cheers,
Jeffrey Carpenter
SDL_LoadBMP unknown pixel format
i8degrees


Joined: 22 Nov 2014
Posts: 39
I'm fairly certain I had the same problem some time ago with loading BMP on Windows. Worked fine on OSX. I don't remember the details, but do remember that switching to SDL_image solved the issue for me.


Sounds like a bug to me!

Jeffrey Carpenteri8degrees@gmail.com


On Dec 6, 2014, at 22:03, theGiallo wrote:


Quote:
I've a problem loading ARGB 32bit bmp images on Windows. On debian and android they load perfectly.
I created them using GIMP and i've tried to save them with the "compatibility option" that does not saves color space information but nothing changes.
I get the error "Unknown pixel format". This is formed into SDL_surface.c








Code: /* Public routines */
/*
* Create an empty RGB surface of the appropriate depth
*/
SDL_Surface *
SDL_CreateRGBSurface(Uint32 flags,
int width, int height, int depth,
Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask)
{
SDL_Surface *surface;
Uint32 format;

/* The flags are no longer used, make the compiler happy */
(void)flags;

/* Get the pixel format */
format = SDL_MasksToPixelFormatEnum(depth, Rmask, Gmask, Bmask, Amask);
if (format == SDL_PIXELFORMAT_UNKNOWN) {
SDL_SetError("Unknown pixel format");
return NULL;
}



The error occurs only with images that contain pixels with alpha different from 0 or 255.
I tried to change the renderer from accelerated to software and to give video driver hints, but nothing changed.
I'm using SDL 2.0.3 stable.

_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org