我一直在用Slick2D制作游戏,最近我开始不得不使用控制台进行调试,我注意到我遇到了这些错误:
Mon Jun 02 16:13:35 BST 2014 WARN:class org.newdawn.slick.opengl.PNGImageData failed to read the data
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.java:187)
at org.newdawn.slick.Image.<init>(Image.java:192)
at org.newdawn.slick.Image.<init>(Image.java:166)
at org.newdawn.slick.Image.<init>(Image.java:154)
at org.newdawn.slick.Image.<init>(Image.java:132)
at luke_r.java.project_alpha.SplashScreenInitiator.init(SplashScreenInitiator.java:27)
at org.newdawn.slick.state.StateBasedGame.init(StateBasedGame.java:171)
at org.newdawn.slick.AppGameContainer.setup(AppGameContainer.java:393)
at org.newdawn.slick.AppGameContainer.start(AppGameContainer.java:317)
at luke_r.java.project_alpha.Core.main(Core.java:21)
Mon Jun 02 16:13:35 BST 2014 INFO:Initialising sounds..
Mon Jun 02 16:13:35 BST 2014 INFO:- Sound works
Mon Jun 02 16:13:35 BST 2014 INFO:- 64 OpenAL source available
Mon Jun 02 16:13:35 BST 2014 INFO:- Sounds source generated
Mon Jun 02 16:13:35 BST 2014 WARN:class org.newdawn.slick.opengl.PNGImageData failed to read the data
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.java:187)
at org.newdawn.slick.Image.<init>(Image.java:192)
at org.newdawn.slick.Image.<init>(Image.java:166)
at org.newdawn.slick.Image.<init>(Image.java:154)
at org.newdawn.slick.Image.<init>(Image.java:132)
at luke_r.java.project_alpha.ImageManager.load(ImageManager.java:14)
at luke_r.java.project_alpha.SplashScreenInitiator.init(SplashScreenInitiator.java:30)
at org.newdawn.slick.state.StateBasedGame.init(StateBasedGame.java:171)
at org.newdawn.slick.AppGameContainer.setup(AppGameContainer.java:393)
at org.newdawn.slick.AppGameContainer.start(AppGameContainer.java:317)
at luke_r.java.project_alpha.Core.main(Core.java:21)
我完全不知道(经过大量研究)可能导致这种情况的原因。请问可以解释一下吗?
编辑:以下是第一个错误不喜欢的行:splash = new Image("res/img/splash.png");
以下是第二个错误不喜欢的行:sandMap = new Image("res/img/map/sandmap.png");
编辑2: Sandmap.png Splash.png
答案 0 :(得分:3)
如果你仍然遇到这个问题,我可能会有一个解决方案。我使用paint.net并遇到了同样的问题。从paint.net保存图像后,选择保存目标后会弹出保存配置窗口。对我来说,我不得不将Bit-Depth从8位更改为32位。自动检测有时会起作用,但只有当它自动检测到它为32位时。我没有测试24位,它也可以工作。希望这会有所帮助。
答案 1 :(得分:0)
org.newdawn.slick.opengl.PNGImageData无法读取数据
此图片的格式不受支持
错误消息说明错了。您的图片已损坏,或不受支持,或未正确保存。你用的是什么样的图像?
答案 2 :(得分:0)
@Anubian是正确的,你的PNG必须是腐败的。尝试重新制作它或使用其他软件来创建它。查看Slick2D抛出异常here的位置。我试图使用Wolfgang Fellger的PNG Analyzer,我甚至无法打开你的形象。