Skip to content

Transparent background with incorrect file type #1083

@thomaskiesl

Description

@thomaskiesl

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.

javax.imageio.IIOException: Bogus input colorspace
    at java.desktop/com.sun.imageio.plugins.jpeg.JPEGImageWriter.writeImage(Native Method)
    at java.desktop/com.sun.imageio.plugins.jpeg.JPEGImageWriter.writeOnThread(JPEGImageWriter.java:1035)
    at java.desktop/com.sun.imageio.plugins.jpeg.JPEGImageWriter.write(JPEGImageWriter.java:385)
    at com.twelvemonkeys.imageio.plugins.jpeg.JPEGImageWriter.write(JPEGImageWriter.java:175)
    at java.desktop/javax.imageio.ImageWriter.write(ImageWriter.java:613)
    at java.desktop/javax.imageio.ImageIO.doWrite(ImageIO.java:1632)
    at java.desktop/javax.imageio.ImageIO.write(ImageIO.java:1558)

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions