Open jpazardzievska opened 8 years ago
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.
Any idea?
Any fix to this?
according to other issue, it might be happen on coverting ARGB(RGBA?) image and the library process only first 3 color byte. i use the method described in https://stackoverflow.com/questions/44182400/how-to-convert-bufferedimage-rgba-to-bufferedimage-rgb to convert the image into RGB format and work well.
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 https://github.com/rkalla/imgscalr/issues/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