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 409

Summary: LBM loading doesn't work for some images
Product: SDL_image Reporter: Dennis Payne <dulsi>
Component: miscAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: unspecified   
Hardware: All   
OS: All   
Attachments: sample image contributed by dulsi

Description Dennis Payne 2007-03-04 13:15:42 UTC
I found some images used in a Bard's Tale Construction Set game that don't load properly.  When the LBM is a packed bitmap the number of planes are set to one.  This causes the number of colors in the palette to be set to 2.  Here is a patch to fix the problem.  I think it is correct but I don't have a lot of LBM files to test with.  Some broken LBMs can be found in Bard's Lore I found at http://bardstale.brotherhood.de/talefiles/cs/files/index.html


--- IMG_lbm.c.orig	2007-03-04 15:56:51.000000000 -0500
+++ IMG_lbm.c	2007-03-04 15:58:45.000000000 -0500
@@ -297,7 +297,8 @@
 			Image->format->palette->colors[i].g = Image->format->palette->colors[i%nbcolors].g;
 			Image->format->palette->colors[i].b = Image->format->palette->colors[i%nbcolors].b;
 		}
-		Image->format->palette->ncolors = nbrcolorsfinal;
+		if ( !pbm )
+			Image->format->palette->ncolors = nbrcolorsfinal;
 	}
 
 	/* Get the bitmap */
Comment 1 Sam Lantinga 2007-07-12 20:21:52 UTC
Can you attach a sample image?
Comment 2 Sam Lantinga 2007-07-14 10:51:44 UTC
Created attachment 226 [details]
sample image contributed by dulsi
Comment 3 Sam Lantinga 2007-07-19 21:38:44 UTC
I tried contacting the author of the previous patch that introduced this bug, but got no response.

Unless someone comes up with a problem with this, I'm checking this in as subversion revision 3341

Thanks!