usnistgov / pyramidio

Image pyramid reader and writer
Other
34 stars 20 forks source link

java.lang.IllegalArgumentException: Unknown image type 0 #7

Open robertlight opened 6 years ago

robertlight commented 6 years ago

I am getting an "unknown image type 0" when processing a .png file.

OS: Linux/Ubuntu

Command line: $ java -Xmx4096m -jar pyramidio-cli-1.1.0.jar -i test.png -o test

stacktrace: java.lang.IllegalArgumentException: Unknown image type 0 at sun.reflect.GeneratedConstructorAccessor1.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:526) at java.util.concurrent.ForkJoinTask.getThrowableException(ForkJoinTask.java:533) at java.util.concurrent.ForkJoinTask.reportResult(ForkJoinTask.java:596) at java.util.concurrent.ForkJoinTask.join(ForkJoinTask.java:640) at gov.nist.isg.pyramidio.TileBuilder$TileBuilderTask.compute(TileBuilder.java:199) at gov.nist.isg.pyramidio.TileBuilder$TileBuilderTask.compute(TileBuilder.java:123) at java.util.concurrent.RecursiveTask.exec(RecursiveTask.java:93) at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:334) at java.util.concurrent.ForkJoinWorkerThread.execTask(ForkJoinWorkerThread.java:604) at java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:785) at java.util.concurrent.ForkJoinPool.work(ForkJoinPool.java:647) at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:398)

robertlight commented 6 years ago

it is a hack...but since I know I'm using a png file, if I make the following change in pyramidio.tools.ImageResizerHelper line 78 change: BufferedImage result = new BufferedImage(width, height, img.getType()); to: BufferedImage result = new BufferedImage(width, height, img.getType()==0?5:img.getType());

and it works just fine.

NoorKhan commented 4 years ago

This is the funniest thing I've ever seen and it actually worked

Allan-Klein commented 4 years ago

Hello,

I do not know if I am related to the subject but I had a similar error while trying to find the solution to my problem.

Okay, I'm leaving from the start.

I am looking to transfer a texture pack that I bought at microsoft for the minecraft version of windows 10 to the Java version of minecraft.

I buy the texture pack download it to finally have all my files.

Only the texture files are composed of .png that none of my software can open (photos, paint, gimp, photoshop, illustrator, google chrome)

I can not open it in any way but yet minecraft windows 10 does it well how is it? Are the files encrypted? I saw that among the .png files there were .tga I opened one of my .png files on google which displayed a white square, and I saved it as a .tga.

When I wanted to reopen it on gimp it showed me the same error you had.

I'm really stuck: /

Ps: Translation by Google

Wolven168 commented 5 months ago

it is a hack...but since I know I'm using a png file, if I make the following change in pyramidio.tools.ImageResizerHelper line 78 change: BufferedImage result = new BufferedImage(width, height, img.getType()); to: BufferedImage result = new BufferedImage(width, height, img.getType()==0?5:img.getType());

and it works just fine.

So I managed to fix my current issue with this method, but now the image's empty parts were replaced with black pixels, so maybe the reason why it's throwing the exception is because it can't read the empty parts?