You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using Scalr to resize images. I have a problem when trying to resize one image. Scalr is changing the color of the resized image (adds red color). The image that I try to resize is in jpg format.
In short, this is the outline of my code.
I read the file from byte array: BufferedImage image = ImageIO.read(bis);
ByteArrayOutputStream baos = new ByteArrayOutputStream(); ImageIO.write(bufferedImage, extension, baos);
The type of the image before and after resizing is same and equals to TYPE_4BYTE_ABGR.
I tried to use this solution #82 by removing the alpha channel before resizing the image, but no luck, the image then turned to black after resizing.
When writing to output file I use the extension of the image to find the right ImageWriter.
I found that using PNGImageWriter is solving the issue. But, is it good solution to use PNGImageWriter to write jpg, jpeg images?
Can you please explain me?
Thank you
The text was updated successfully, but these errors were encountered:
I have the same problem (but with input images of type 2 or 6 bellow, both for JPG/PNG). Both images have in common support for alpha but do not include any transparent background.
I am using Scalr to resize images. I have a problem when trying to resize one image. Scalr is changing the color of the resized image (adds red color). The image that I try to resize is in jpg format.
In short, this is the outline of my code.
I read the file from byte array:
BufferedImage image = ImageIO.read(bis);
Then I resize the image using imgscalr:
Scalr.resize(image, Scalr.Method.ULTRA_QUALITY, Scalr.Mode.AUTOMATIC, targetWidth, targetHeight);
Then, I write it to output file:
ByteArrayOutputStream baos = new ByteArrayOutputStream(); ImageIO.write(bufferedImage, extension, baos);
The type of the image before and after resizing is same and equals to TYPE_4BYTE_ABGR.
I tried to use this solution #82 by removing the alpha channel before resizing the image, but no luck, the image then turned to black after resizing.
When writing to output file I use the extension of the image to find the right ImageWriter.
I found that using PNGImageWriter is solving the issue. But, is it good solution to use PNGImageWriter to write jpg, jpeg images?
Can you please explain me?
Thank you
The text was updated successfully, but these errors were encountered: