Skip to content

ImageUtil.createRotated() unexpectedly adds an alpha channel #1019

@whowrotethiscode

Description

@whowrotethiscode

Hello,

TwelveMonkeys version: 3.10.1

ImageUtil.createRotated() unexpectedly adds an alpha channel to the result image
when the source image does not have an alpha channel.

For example:

BufferedImage source = new BufferedImage(100, 50, BufferedImage.TYPE_INT_RGB);
assertEquals(100, source.getWidth());
assertEquals(50, source.getHeight());
assertFalse(source.getColorModel().hasAlpha());

BufferedImage result = ImageUtil.createRotated(source, 90);
assertEquals(50, result.getWidth());
assertEquals(100, result.getHeight());
assertFalse(result.getColorModel().hasAlpha()); // Unexpectedly fails

I noticed this after rotating a JPEG source image
then saving the result image as a JPEG
produces a IIOException: Bogus input colorspace

Obviously we can manually remove the alpha channel
after using ImageUtil.createRotated()

But it is suprising that an alpha channel has been added to the result image
after rotating a source image which does not have an alpha channel.

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions