So.. I'm learning lwjgl currently and I stumbled on this weird error caused by slick-util which seems to be incorrectly displayed.


java.lang.UnsupportedOperationException: Unsupported format for this image
at org.newdawn.slick.opengl.PNGDecoder.decode(PNGDecoder.java:272)
at org.newdawn.slick.opengl.PNGImageData.loadImage(PNGImageData.java:97)
at org.newdawn.slick.opengl.CompositeImageData.loadImage (CompositeImageData.java:62)                       
at org.newdawn.slick.opengl.CompositeImageData.loadImage(CompositeImageData.java:43)
at org.newdawn.slick.opengl.InternalTextureLoader.getTexture(InternalTextureLoader.java:292)
at org.newdawn.slick.opengl.InternalTextureLoader.getTexture(InternalTextureLoader.java:254)
at org.newdawn.slick.opengl.InternalTextureLoader.getTexture(InternalTextureLoader.
at org.newdawn.slick.opengl.TextureLoader.getTexture(TextureLoader.java:64)
at org.newdawn.slick.opengl.TextureLoader.getTexture(TextureLoader.java:24)
at com.saumi.utils.Renderer.loadTexture(Renderer.java:91)
at com.saumi.assets.Assets.<init>(Assets.java:23)
at com.saumi.main.Main.init(Main.java:27)
at com.saumi.main.Main.<init>(Main.java:45)
at com.saumi.main.Main.main(Main.java:71)

The problem is that even though it says unable to read png data, the picture that the error points to is loaded properly and even displayed onto the screen!

I don't know what is is supposed to mean, please help.


My texture loader code :

public static Texture loadTexture(String path , String fileType){
    Texture tex = null;

    InputStream in = ResourceLoader.getResourceAsStream(path);
    try {
        tex = TextureLoader.getTexture(fileType,in);
    } catch (IOException e) {

    return tex;

My Assets code which loads the textures :

public class Assets {

public static Texture playBtn , tutBtn , quitBtn;

public static Texture background;

public static Texture player , missile;

public Assets(){
    playBtn = Renderer.loadTexture("res/PlayBtn.png", "PNG");
    tutBtn = Renderer.loadTexture("res/TutBtn.png", "PNG");
    quitBtn = Renderer.loadTexture("res/QuitBtn.png", "PNG");

    player = Renderer.loadTexture("res/KillSkull.png", "PNG");
    missile = Renderer.loadTexture("res/Missile.png", "PNG");

    background = Renderer.loadTexture("res/Background.png", "PNG");


The Error points to the Background Image , and the order in which it is loaded does not matter, it always points to that image.

  • \$\begingroup\$ Welcome to GDSE. Your error is formatted as code, so that's fine. It might help us to see a minimal, complete, and verifiable example (MCVE) of the problematic code. \$\endgroup\$ – Pikalek Jan 4 '18 at 3:30
  • \$\begingroup\$ Are you trying to read png data from more than one file or source? \$\endgroup\$ – Jay Jan 4 '18 at 4:40
  • \$\begingroup\$ I've edited the post to show my code, and i am loading the image from a file in my res folder. \$\endgroup\$ – Saumi Jan 4 '18 at 4:58
  • \$\begingroup\$ Try substituting one of the other image filenames for Background.png. If that works, then you've narrowed the problem to the image file itself. If that doesn't work, then it suggests something else is wrong. \$\endgroup\$ – Pikalek Jan 4 '18 at 21:38

There are a few solutions to this. Try them until you find one that works for you!

Re-saving the image (Maybe Windows only)

  1. Open the image in your image editing program / re-create the image from scratch.
  2. Copy the entire image to your clipboard from your image editing software (don't save it).
  3. Paste the image into MS Paint (might work with other programs. Tested only with MS Paint) and save the image as a .png.

Change bit-depth to 32 bit (credit to Lemonzap)

  1. Open your image in your image editing software.
  2. Change the bit-depth to 32-bit.
    1. Paint.net: You chance it in the save dialog
    2. Gimp: Should automatically have 32-bit depth if your Image > Mode is RGB.
    3. Photoshop: In the menu Image > Module choose 32 Bits/Channel or set it when you create the image (Image from Zidane)
      photoshop 32-bit
  3. Save like normal.

Set interlacing to none (credit to Paulywog)

  1. Open your image in your image editing software
  2. Change interlacing to none.
    1. Photoshop: You change it in the save dialog.
    2. Gimp:
      gimp how to disable interlacing
  3. Save like normal.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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