-
Bug
-
Resolution: Duplicate
-
P3
-
8u261
ADDITIONAL SYSTEM INFORMATION :
java version "1.8.0_271"
Java(TM) SE Runtime Environment (build 1.8.0_271-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.271-b09, mixed mode)
Bug occurred on OSX as well as on CentOS.
A DESCRIPTION OF THE PROBLEM :
The java.awt.image.RescaleOp class produces incorrect results for certain PNG images.
The operation is applied only to a subset of the source image, with greyed out background where a transparent background is expected.
With Oracle JDK 1.8.0_251 the results are still as expected.
This bug occurred with a PNG encoded source image with transparent background.
REGRESSION : Last worked in JDK 1.8.0_251
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
See https://github.com/agawecki/java-rescale-op-test
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Rescale operation applied homogeneously to source image and leaves the transparent background intact.
ACTUAL -
The rescale operation is applied to a subset of the source image and garbles the transparent background.
---------- BEGIN SOURCE ----------
package test;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.awt.image.RescaleOp;
import java.io.File;
public class Main {
public static void main(String[] args) {
System.out.println(System.getProperty("java.version"));
String imageFileName = "test.png";
try {
File imageFile = new File(imageFileName);
BufferedImage image = ImageIO.read(imageFile);
rescale(image, 1.0f, 50.0f);
File outputFile = new File(imageFile.getParent(), "rescaled-" + imageFile.getName());
ImageIO.write(image, "png", outputFile);
} catch (Exception e) {
e.printStackTrace();
}
}
static BufferedImage rescale(BufferedImage img,
float factor,
float offset) {
RescaleOp rescaleOp = new RescaleOp(factor, offset, null);
return rescaleOp.filter(img, img);
}
}
---------- END SOURCE ----------
FREQUENCY : always
java version "1.8.0_271"
Java(TM) SE Runtime Environment (build 1.8.0_271-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.271-b09, mixed mode)
Bug occurred on OSX as well as on CentOS.
A DESCRIPTION OF THE PROBLEM :
The java.awt.image.RescaleOp class produces incorrect results for certain PNG images.
The operation is applied only to a subset of the source image, with greyed out background where a transparent background is expected.
With Oracle JDK 1.8.0_251 the results are still as expected.
This bug occurred with a PNG encoded source image with transparent background.
REGRESSION : Last worked in JDK 1.8.0_251
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
See https://github.com/agawecki/java-rescale-op-test
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Rescale operation applied homogeneously to source image and leaves the transparent background intact.
ACTUAL -
The rescale operation is applied to a subset of the source image and garbles the transparent background.
---------- BEGIN SOURCE ----------
package test;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.awt.image.RescaleOp;
import java.io.File;
public class Main {
public static void main(String[] args) {
System.out.println(System.getProperty("java.version"));
String imageFileName = "test.png";
try {
File imageFile = new File(imageFileName);
BufferedImage image = ImageIO.read(imageFile);
rescale(image, 1.0f, 50.0f);
File outputFile = new File(imageFile.getParent(), "rescaled-" + imageFile.getName());
ImageIO.write(image, "png", outputFile);
} catch (Exception e) {
e.printStackTrace();
}
}
static BufferedImage rescale(BufferedImage img,
float factor,
float offset) {
RescaleOp rescaleOp = new RescaleOp(factor, offset, null);
return rescaleOp.filter(img, img);
}
}
---------- END SOURCE ----------
FREQUENCY : always
- duplicates
-
JDK-8177393 Result of RescaleOp for 4BYTE_ABGR images may be 25% black
- Closed