javax.imageio.plugins.bmp.BMPImageWriteParam Java Examples

The following examples show how to use javax.imageio.plugins.bmp.BMPImageWriteParam. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TopDownTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private static void writeWithCompression(BufferedImage src,
                                         String compression) throws IOException
{
    System.out.println("Compression: " + compression);
    ImageWriter writer = ImageIO.getImageWritersByFormatName("BMP").next();
    if (writer == null) {
        throw new RuntimeException("Test failed: no bmp writer available");
    }
    File fout = File.createTempFile(compression + "_", ".bmp",
                                    new File("."));

    ImageOutputStream ios = ImageIO.createImageOutputStream(fout);
    writer.setOutput(ios);

    BMPImageWriteParam param = (BMPImageWriteParam)
            writer.getDefaultWriteParam();
    param.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
    param.setCompressionType(compression);
    param.setTopDown(true);
    writer.write(null, new IIOImage(src, null, null), param);
    writer.dispose();
    ios.flush();
    ios.close();

    BufferedImage dst = ImageIO.read(fout);

    verify(dst);
}
 
Example #2
Source File: TopDownTest.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
private static void writeWithCompression(BufferedImage src,
                                         String compression) throws IOException
{
    System.out.println("Compression: " + compression);
    ImageWriter writer = ImageIO.getImageWritersByFormatName("BMP").next();
    if (writer == null) {
        throw new RuntimeException("Test failed: no bmp writer available");
    }
    File fout = File.createTempFile(compression + "_", ".bmp",
                                    new File("."));

    ImageOutputStream ios = ImageIO.createImageOutputStream(fout);
    writer.setOutput(ios);

    BMPImageWriteParam param = (BMPImageWriteParam)
            writer.getDefaultWriteParam();
    param.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
    param.setCompressionType(compression);
    param.setTopDown(true);
    writer.write(null, new IIOImage(src, null, null), param);
    writer.dispose();
    ios.flush();
    ios.close();

    BufferedImage dst = ImageIO.read(fout);

    verify(dst);
}
 
Example #3
Source File: TopDownTest.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private static void writeWithCompression(BufferedImage src,
                                         String compression) throws IOException
{
    System.out.println("Compression: " + compression);
    ImageWriter writer = ImageIO.getImageWritersByFormatName("BMP").next();
    if (writer == null) {
        throw new RuntimeException("Test failed: no bmp writer available");
    }
    File fout = File.createTempFile(compression + "_", ".bmp",
                                    new File("."));

    ImageOutputStream ios = ImageIO.createImageOutputStream(fout);
    writer.setOutput(ios);

    BMPImageWriteParam param = (BMPImageWriteParam)
            writer.getDefaultWriteParam();
    param.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
    param.setCompressionType(compression);
    param.setTopDown(true);
    writer.write(null, new IIOImage(src, null, null), param);
    writer.dispose();
    ios.flush();
    ios.close();

    BufferedImage dst = ImageIO.read(fout);

    verify(dst);
}
 
Example #4
Source File: TopDownTest.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
private static void writeWithCompression(BufferedImage src,
                                         String compression) throws IOException
{
    System.out.println("Compression: " + compression);
    ImageWriter writer = ImageIO.getImageWritersByFormatName("BMP").next();
    if (writer == null) {
        throw new RuntimeException("Test failed: no bmp writer available");
    }
    File fout = File.createTempFile(compression + "_", ".bmp",
                                    new File("."));

    ImageOutputStream ios = ImageIO.createImageOutputStream(fout);
    writer.setOutput(ios);

    BMPImageWriteParam param = (BMPImageWriteParam)
            writer.getDefaultWriteParam();
    param.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
    param.setCompressionType(compression);
    param.setTopDown(true);
    writer.write(null, new IIOImage(src, null, null), param);
    writer.dispose();
    ios.flush();
    ios.close();

    BufferedImage dst = ImageIO.read(fout);

    verify(dst);
}
 
Example #5
Source File: BMPCompressionTest.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
private Test(BMPImageWriteParam p, IIOMetadata md, BufferedImage i) {
    param = p;
    meta = md;
    img = i;


    description = "Compression type is " + p.getCompressionType();
}
 
Example #6
Source File: TopDownTest.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private static void writeWithCompression(BufferedImage src,
                                         String compression) throws IOException
{
    System.out.println("Compression: " + compression);
    ImageWriter writer = ImageIO.getImageWritersByFormatName("BMP").next();
    if (writer == null) {
        throw new RuntimeException("Test failed: no bmp writer available");
    }
    File fout = File.createTempFile(compression + "_", ".bmp",
                                    new File("."));

    ImageOutputStream ios = ImageIO.createImageOutputStream(fout);
    writer.setOutput(ios);

    BMPImageWriteParam param = (BMPImageWriteParam)
            writer.getDefaultWriteParam();
    param.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
    param.setCompressionType(compression);
    param.setTopDown(true);
    writer.write(null, new IIOImage(src, null, null), param);
    writer.dispose();
    ios.flush();
    ios.close();

    BufferedImage dst = ImageIO.read(fout);

    verify(dst);
}
 
Example #7
Source File: TopDownTest.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private static void writeWithCompression(BufferedImage src,
                                         String compression) throws IOException
{
    System.out.println("Compression: " + compression);
    ImageWriter writer = ImageIO.getImageWritersByFormatName("BMP").next();
    if (writer == null) {
        throw new RuntimeException("Test failed: no bmp writer available");
    }
    File fout = File.createTempFile(compression + "_", ".bmp",
                                    new File("."));

    ImageOutputStream ios = ImageIO.createImageOutputStream(fout);
    writer.setOutput(ios);

    BMPImageWriteParam param = (BMPImageWriteParam)
            writer.getDefaultWriteParam();
    param.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
    param.setCompressionType(compression);
    param.setTopDown(true);
    writer.write(null, new IIOImage(src, null, null), param);
    writer.dispose();
    ios.flush();
    ios.close();

    BufferedImage dst = ImageIO.read(fout);

    verify(dst);
}
 
Example #8
Source File: TopDownTest.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private static void writeWithCompression(BufferedImage src,
                                         String compression) throws IOException
{
    System.out.println("Compression: " + compression);
    ImageWriter writer = ImageIO.getImageWritersByFormatName("BMP").next();
    if (writer == null) {
        throw new RuntimeException("Test failed: no bmp writer available");
    }
    File fout = File.createTempFile(compression + "_", ".bmp",
                                    new File("."));

    ImageOutputStream ios = ImageIO.createImageOutputStream(fout);
    writer.setOutput(ios);

    BMPImageWriteParam param = (BMPImageWriteParam)
            writer.getDefaultWriteParam();
    param.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
    param.setCompressionType(compression);
    param.setTopDown(true);
    writer.write(null, new IIOImage(src, null, null), param);
    writer.dispose();
    ios.flush();
    ios.close();

    BufferedImage dst = ImageIO.read(fout);

    verify(dst);
}
 
Example #9
Source File: TopDownTest.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private static void writeWithCompression(BufferedImage src,
                                         String compression) throws IOException
{
    System.out.println("Compression: " + compression);
    ImageWriter writer = ImageIO.getImageWritersByFormatName("BMP").next();
    if (writer == null) {
        throw new RuntimeException("Test failed: no bmp writer available");
    }
    File fout = File.createTempFile(compression + "_", ".bmp",
                                    new File("."));

    ImageOutputStream ios = ImageIO.createImageOutputStream(fout);
    writer.setOutput(ios);

    BMPImageWriteParam param = (BMPImageWriteParam)
            writer.getDefaultWriteParam();
    param.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
    param.setCompressionType(compression);
    param.setTopDown(true);
    writer.write(null, new IIOImage(src, null, null), param);
    writer.dispose();
    ios.flush();
    ios.close();

    BufferedImage dst = ImageIO.read(fout);

    verify(dst);
}
 
Example #10
Source File: BMPCompressionTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private Test(BMPImageWriteParam p, IIOMetadata md, BufferedImage i) {
    param = p;
    meta = md;
    img = i;


    description = "Compression type is " + p.getCompressionType();
}
 
Example #11
Source File: TopDownTest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private static void writeWithCompression(BufferedImage src,
                                         String compression) throws IOException
{
    System.out.println("Compression: " + compression);
    ImageWriter writer = ImageIO.getImageWritersByFormatName("BMP").next();
    if (writer == null) {
        throw new RuntimeException("Test failed: no bmp writer available");
    }
    File fout = File.createTempFile(compression + "_", ".bmp",
                                    new File("."));

    ImageOutputStream ios = ImageIO.createImageOutputStream(fout);
    writer.setOutput(ios);

    BMPImageWriteParam param = (BMPImageWriteParam)
            writer.getDefaultWriteParam();
    param.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
    param.setCompressionType(compression);
    param.setTopDown(true);
    writer.write(null, new IIOImage(src, null, null), param);
    writer.dispose();
    ios.flush();
    ios.close();

    BufferedImage dst = ImageIO.read(fout);

    verify(dst);
}
 
Example #12
Source File: TopDownTest.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
private static void writeWithCompression(BufferedImage src,
                                         String compression) throws IOException
{
    System.out.println("Compression: " + compression);
    ImageWriter writer = ImageIO.getImageWritersByFormatName("BMP").next();
    if (writer == null) {
        throw new RuntimeException("Test failed: no bmp writer available");
    }
    File fout = File.createTempFile(compression + "_", ".bmp",
                                    new File("."));

    ImageOutputStream ios = ImageIO.createImageOutputStream(fout);
    writer.setOutput(ios);

    BMPImageWriteParam param = (BMPImageWriteParam)
            writer.getDefaultWriteParam();
    param.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
    param.setCompressionType(compression);
    param.setTopDown(true);
    writer.write(null, new IIOImage(src, null, null), param);
    writer.dispose();
    ios.flush();
    ios.close();

    BufferedImage dst = ImageIO.read(fout);

    verify(dst);
}
 
Example #13
Source File: TopDownTest.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private static void writeWithCompression(BufferedImage src,
                                         String compression) throws IOException
{
    System.out.println("Compression: " + compression);
    ImageWriter writer = ImageIO.getImageWritersByFormatName("BMP").next();
    if (writer == null) {
        throw new RuntimeException("Test failed: no bmp writer available");
    }
    File fout = File.createTempFile(compression + "_", ".bmp",
                                    new File("."));

    ImageOutputStream ios = ImageIO.createImageOutputStream(fout);
    writer.setOutput(ios);

    BMPImageWriteParam param = (BMPImageWriteParam)
            writer.getDefaultWriteParam();
    param.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
    param.setCompressionType(compression);
    param.setTopDown(true);
    writer.write(null, new IIOImage(src, null, null), param);
    writer.dispose();
    ios.flush();
    ios.close();

    BufferedImage dst = ImageIO.read(fout);

    verify(dst);
}
 
Example #14
Source File: TopDownTest.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private static void writeWithCompression(BufferedImage src,
                                         String compression) throws IOException
{
    System.out.println("Compression: " + compression);
    ImageWriter writer = ImageIO.getImageWritersByFormatName("BMP").next();
    if (writer == null) {
        throw new RuntimeException("Test failed: no bmp writer available");
    }
    File fout = File.createTempFile(compression + "_", ".bmp",
                                    new File("."));

    ImageOutputStream ios = ImageIO.createImageOutputStream(fout);
    writer.setOutput(ios);

    BMPImageWriteParam param = (BMPImageWriteParam)
            writer.getDefaultWriteParam();
    param.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
    param.setCompressionType(compression);
    param.setTopDown(true);
    writer.write(null, new IIOImage(src, null, null), param);
    writer.dispose();
    ios.flush();
    ios.close();

    BufferedImage dst = ImageIO.read(fout);

    verify(dst);
}
 
Example #15
Source File: TopDownTest.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private static void writeWithCompression(BufferedImage src,
                                         String compression) throws IOException
{
    System.out.println("Compression: " + compression);
    ImageWriter writer = ImageIO.getImageWritersByFormatName("BMP").next();
    if (writer == null) {
        throw new RuntimeException("Test failed: no bmp writer available");
    }
    File fout = File.createTempFile(compression + "_", ".bmp",
                                    new File("."));

    ImageOutputStream ios = ImageIO.createImageOutputStream(fout);
    writer.setOutput(ios);

    BMPImageWriteParam param = (BMPImageWriteParam)
            writer.getDefaultWriteParam();
    param.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
    param.setCompressionType(compression);
    param.setTopDown(true);
    writer.write(null, new IIOImage(src, null, null), param);
    writer.dispose();
    ios.flush();
    ios.close();

    BufferedImage dst = ImageIO.read(fout);

    verify(dst);
}
 
Example #16
Source File: BMPImageWriter.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
public ImageWriteParam getDefaultWriteParam() {
    return new BMPImageWriteParam();
}
 
Example #17
Source File: BMPImageWriter.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
public ImageWriteParam getDefaultWriteParam() {
    return new BMPImageWriteParam();
}
 
Example #18
Source File: BMPImageWriter.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
public ImageWriteParam getDefaultWriteParam() {
    return new BMPImageWriteParam();
}
 
Example #19
Source File: BMPImageWriter.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
public ImageWriteParam getDefaultWriteParam() {
    return new BMPImageWriteParam();
}
 
Example #20
Source File: BMPImageWriter.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public ImageWriteParam getDefaultWriteParam() {
    return new BMPImageWriteParam();
}
 
Example #21
Source File: BMPCompressionTest.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
public static Iterator createTestSet(ImageWriter w) {
    List l = new LinkedList();

    Test.iw = w;

    // variate compression types
    BMPImageWriteParam param = (BMPImageWriteParam)iw.getDefaultWriteParam();
    param.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
    param.setCompressionType("BI_RGB");
    if (param.canWriteCompressed()) {
        String[] cTypes = param.getCompressionTypes();
        String[] cDescr = param.getCompressionQualityDescriptions();
        float[] cValues = param.getCompressionQualityValues();

        if (cDescr == null) {
            System.out.println("There are no compression quality description!");
        } else {
            for(int i=0; i<cDescr.length; i++) {
                System.out.println("Quality[" + i + "]=\""+cDescr[i]+"\"");
            }
        }
        if (cValues == null) {
            System.out.println("There are no compression quality values!");
        } else {
            for(int i=0; i<cValues.length; i++) {
                System.out.println("Value["+i+"]=\""+cValues[i]+"\"");
            }
        }

        for(int i=0; i<cTypes.length; i++) {
            String compressionType = cTypes[i];
            BufferedImage img = null;

            int type = BufferedImage.TYPE_INT_BGR;
            try {
                img = createTestImage(type);
                if (compressionType.equals("BI_RLE8")) {
                    img = createTestImage2(8, DataBuffer.TYPE_BYTE);
                } else if (compressionType.equals("BI_RLE4")) {
                    img = createTestImage3(4, DataBuffer.TYPE_BYTE);
                } else if (compressionType.equals("BI_BITFIELDS")) {
                    img = createTestImage4(32);
                }

            } catch (IOException ex) {
                throw new RuntimeException("Unable to create test image");
            }
            BMPImageWriteParam p = (BMPImageWriteParam)iw.getDefaultWriteParam();
            System.out.println("Current compression type is \""+cTypes[i]+"\"");
            p.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
            p.setCompressionType(compressionType);

            IIOMetadata md = iw.getDefaultImageMetadata(new ImageTypeSpecifier(img), p);

            l.add( new Test(p, md, img));
        }
    }
    //     }
    return l.iterator();

}
 
Example #22
Source File: BMPImageWriter.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
public ImageWriteParam getDefaultWriteParam() {
    return new BMPImageWriteParam();
}
 
Example #23
Source File: BMPImageWriter.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public ImageWriteParam getDefaultWriteParam() {
    return new BMPImageWriteParam();
}
 
Example #24
Source File: BMPImageWriter.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public ImageWriteParam getDefaultWriteParam() {
    return new BMPImageWriteParam();
}
 
Example #25
Source File: BMPImageWriter.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public ImageWriteParam getDefaultWriteParam() {
    return new BMPImageWriteParam();
}
 
Example #26
Source File: BMPImageWriter.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
public ImageWriteParam getDefaultWriteParam() {
    return new BMPImageWriteParam();
}
 
Example #27
Source File: BMPImageWriter.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
public ImageWriteParam getDefaultWriteParam() {
    return new BMPImageWriteParam();
}
 
Example #28
Source File: BMPImageWriter.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public ImageWriteParam getDefaultWriteParam() {
    return new BMPImageWriteParam();
}
 
Example #29
Source File: BMPImageWriter.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
public ImageWriteParam getDefaultWriteParam() {
    return new BMPImageWriteParam();
}
 
Example #30
Source File: BMPImageWriter.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
public ImageWriteParam getDefaultWriteParam() {
    return new BMPImageWriteParam();
}