Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
robertlight opened this issue Feb 27, 2018 · 4 comments
Open

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

robertlight opened this issue Feb 27, 2018 · 4 comments

Comments

@robertlight
Copy link

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
Copy link
Author

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
Copy link

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

@Allan-Klein
Copy link

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
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants