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

Jpg picture turns red #27

Open
773618713 opened this issue Jun 11, 2020 · 2 comments
Open

Jpg picture turns red #27

773618713 opened this issue Jun 11, 2020 · 2 comments

Comments

@773618713
Copy link

final boolean isBMP = "bmp".equalsIgnoreCase(imageFormat);
final BufferedImage bufferedImage = getBufferedImage(isBMP ? BufferedImage.TYPE_INT_RGB : BufferedImage.TYPE_INT_ARGB);

Using the above code to convert jpg images, it looks like the image will turn red. Can I change it to the following code?

BufferedImage bufferedImage = this.getBufferedImage(getImageType(imageFormat));
private int getImageType(String imageFormat){
        if ("jpg".equalsIgnoreCase(imageFormat)){
            return BufferedImage.TYPE_3BYTE_BGR;
        }
        if ("bmp".equalsIgnoreCase(imageFormat)){
            return BufferedImage.TYPE_INT_RGB;
        }
        return BufferedImage.BITMASK;
}
@hkirk
Copy link
Owner

hkirk commented Jun 17, 2020

Sounds right - and yes you are welcome

@pizzi80
Copy link

pizzi80 commented Aug 30, 2024

during my work i found a problem with jpg rendering and jvm threw
an exception about "color bug" which i fixed.

So we should investigate again, because at the moment I can't reproduce
this bug on the new committed version.

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

3 participants