-
-
Notifications
You must be signed in to change notification settings - Fork 319
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
Transparent background with incorrect file type #1083
Comments
Hi Thomas,
I'm afraid I don't understand this issue. Changing the file extension (renaming) files should not matter, as Can you provide a JUnit test case or a minimal program with a PS: I think newer versions of Java don't support reading/writing JPEG with alpha channel, while older versions did. But I don't know the version of Java you use. There's a reason why the issue template asks for this information. 😉 |
Thanks for the information. My application is running on Java 17 (Open JDK). These are the two images (one with jpg and one with png): I reiceive the error with the following code - calling ImageIO.write()
|
Okay, I checked the files, and they are identical (apart from the file name). They are both the same indexed PNG with transparency. My guess is that you are trying to convert the image to JPEG, based on Now, the fun part... When you invoke Unfortunately, I don't see a way to fix this as it is the JDK alone that causes this. PS: Using |
Describe the bug
If png files/images with alpha channels (transparent background) are renamed from .png to .jpg the following exception comes up. Changing the file type to .png it was processed as expected.
It happens on production, because someone tried to upload such a file. Maybe there is an easy way to fix this.
Version information
1The version of the TwelveMonkeys ImageIO library in use.
3.12.0
The text was updated successfully, but these errors were encountered: