We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 1503

Summary: SDL_image cannot load monochrome or greyscale 8-bit PNG files
Product: SDL_image Reporter: pelya <x.pelya.x>
Component: miscAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: quaker66, rhamph+libsdl
Version: unspecified   
Hardware: All   
OS: All   
Attachments: 2-color grayscale PNG
8-bit greyscale
bug 1503 fix

Description pelya 2012-05-23 08:57:54 UTC
Created attachment 860 [details]
2-color grayscale PNG

Branch default, rev. 330:1230766039be
SDL_image will fail when trying to load the PNG file I've attached, it's in 2-color grayscale format.

I remember opening a very similar bug a while ago.
Comment 1 Adam Olsen 2012-05-25 11:04:24 UTC
Created attachment 861 [details]
8-bit greyscale

Here's an 8-bit greyscale that SDL_image also fails to load (reports "Out of memory").

SDL1.3 trunk of a few weeks ago, SDL_image trunk of today.
Comment 2 Adam Olsen 2012-05-25 11:47:57 UTC
I poked around and SDL_MasksToPixelFormatEnum only supports INDEX8 and RGB332, which isn't what IMG_LoadPNG_RW is asking for.

I'm not sure what the solution is here.  I don't see any greyscale formats listed in SDL_PIXELFORMAT_*.  Maybe the easiest is to pretend it's 8-bit indexed but with a no-op palette that can be ignored?
Comment 3 q66 2013-03-06 10:05:16 UTC
Created attachment 1058 [details]
bug 1503 fix

Hello, just attaching a fix here (by Lee "eihrul" Salzman) to make it noticed :)

DK
Comment 4 q66 2013-03-10 14:26:05 UTC
fixed in http://hg.libsdl.org/SDL_image/rev/9b6ceb2c4a3b