-
Bug
-
Resolution: Not an Issue
-
P3
-
6.0, 7, 8, 9
-
None
OS: Ubuntu 14 Linux, JDK9 b100, JDK8 b132
Please run the following test:
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.*;
import javax.imageio.ImageIO;
public class Test {
public static void main(String[] args) throws IOException {
testWrite("bmp", BufferedImage.TYPE_INT_RGB);
testWrite("bmp", BufferedImage.TYPE_INT_ARGB);
testWrite("bmp", BufferedImage.TYPE_INT_BGR);
testWrite("bmp", BufferedImage.TYPE_INT_ARGB_PRE);
}
private static final String[] biTypeNames = {
"CUSTOM", "INT_RGB", "INT_ARGB", "INT_ARGB_PRE", "INT_BGR", "3BYTE_BGR",
"4BYTE_ABGR", "4BYTE_ABGR_PRE", "USHORT_565_RGB", "USHORT_555_RGB",
"BYTE_GRAY", "USHORT_GRAY", "BYTE_BINARY", "BYTE_INDEXED"};
private static void testWrite(String format, int type) throws IOException {
BufferedImage bi = new BufferedImage(100, 100, type);
Graphics2D g = bi.createGraphics();
g.setColor(Color.GREEN);
g.fillRect(0, 0, 100, 100);
String name = "Test_" + biTypeNames[type] + "." + format;
System.out.println("Creating " + name);
ImageIO.write(bi, format, new File(name));
}
}
Output:
Creating Test_INT_RGB.bmp
Creating Test_INT_ARGB.bmp
Creating Test_INT_BGR.bmp
Creating Test_INT_BGR_PRE.bmp
"echo $?" returns 0, no exceptions are thrown, but only 2 files are created:
Test_INT_BGR.bmp
Test_INT_RGB.bmp
(Test_INT_ARGB.bmp, Test_INT_ARGB_PRE.bmp are absent)
Please run the following test:
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.*;
import javax.imageio.ImageIO;
public class Test {
public static void main(String[] args) throws IOException {
testWrite("bmp", BufferedImage.TYPE_INT_RGB);
testWrite("bmp", BufferedImage.TYPE_INT_ARGB);
testWrite("bmp", BufferedImage.TYPE_INT_BGR);
testWrite("bmp", BufferedImage.TYPE_INT_ARGB_PRE);
}
private static final String[] biTypeNames = {
"CUSTOM", "INT_RGB", "INT_ARGB", "INT_ARGB_PRE", "INT_BGR", "3BYTE_BGR",
"4BYTE_ABGR", "4BYTE_ABGR_PRE", "USHORT_565_RGB", "USHORT_555_RGB",
"BYTE_GRAY", "USHORT_GRAY", "BYTE_BINARY", "BYTE_INDEXED"};
private static void testWrite(String format, int type) throws IOException {
BufferedImage bi = new BufferedImage(100, 100, type);
Graphics2D g = bi.createGraphics();
g.setColor(Color.GREEN);
g.fillRect(0, 0, 100, 100);
String name = "Test_" + biTypeNames[type] + "." + format;
System.out.println("Creating " + name);
ImageIO.write(bi, format, new File(name));
}
}
Output:
Creating Test_INT_RGB.bmp
Creating Test_INT_ARGB.bmp
Creating Test_INT_BGR.bmp
Creating Test_INT_BGR_PRE.bmp
"echo $?" returns 0, no exceptions are thrown, but only 2 files are created:
Test_INT_BGR.bmp
Test_INT_RGB.bmp
(Test_INT_ARGB.bmp, Test_INT_ARGB_PRE.bmp are absent)
- relates to
-
JDK-6694709 BMP writer won't write 32-bit images
-
- Open
-