Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm working on a project and I'm using some 3rd party sprites just to get it off the ground; recently I've come into a hitch. Slick2D doesn't seem to want to load my images. That is, it will warn me that images are the wrong bit-depth. All the images are in 16-bit PNG form (PNG is required for transparency). Is there any way I can disable the warning (being the bad guy programmer (the console print for each individual load REALLY SLOWS DOWN the image)) or is there another solution?

I was thinking about converting all images (using imagemagick) to .gif (with an alpha channel). Would there be any loss in quality between formats?

EDIT: I tried using imagemagick but some of the sprites use pure black so I can't do that without wrecking the image.

EDIT2: using "identify" on any of the images show them as being 8-bit.. but Slick2D won't load them. What the hell? D:

EDIT3: Issue solved (ish). If you are googling this then just disable the java png loader from slick by sticking this somewhere in your code (like the main method):

System.setProperty("org.newdawn.slick.pngloader", "false");
share|improve this question
    
Is this 16-bit per channel or 16-bit total for all channels? ImageMagick has a tendency to say 8-bit for most of the formats below 8 bits per channel. –  Lars Viklund Dec 2 '12 at 16:18
    
16-bit total per for all channels. I managed to fix the issue though (well, hack-fix) by disabling the pure java png loader in slick2d –  Dan Pantry Dec 2 '12 at 16:19

2 Answers 2

You really should just convert all your images to 8 bit PNG.

PNG16 bit PNG uses 16 bits for Red, 16 Green, 16 blue, and 16 alpha. So 64 bits/pixel.

PNG8 uses R8G8B8A8, 8 bits for each of red, green blue, alpha. Or 32 bits/pixel.

With PNG8, you get much less color depth. But for a mobile game, you don't need it, and the display format will very likely be R8G8B8A8 anyway. PNG16 bloats file size anyway, so at the end of the day you really do want to use PNG8 these days.

In Photoshop, to save as an 8-bit PNG, you have to convert to 8 bits/channel useing Image/Mode/8 Bits/Channel:

enter image description here

GIF uses 1 bit for alpha (transparent or not) and is largely outdated and superceeded by PNG. I would advise never use GIF.

share|improve this answer
up vote 1 down vote accepted

See main post - Disabled the Slick PNG loader by sticking this in the Main method:

System.setProperty("org.newdawn.slick.pngloader", "false");
share|improve this answer
2  
You should mark your are answer as the appropriate one. –  Liosan Jan 1 '13 at 19:40

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.