Package org.apache.batik.ext.awt.image.codec

Examples of org.apache.batik.ext.awt.image.codec.PNGImageEncoder


                BufferedImage diff =
                    SVGRenderingAccuracyTest.buildDiffImage(ref, img);
                String s = new File(filename).getName();
                s = ("test-references/org/apache/batik/transcoder/image/"+
                     "candidate-variation/"+s);
                PNGImageEncoder encoder
                    = new PNGImageEncoder
                    (new FileOutputStream(s),
                     PNGEncodeParam.getDefaultEncodeParam(diff));
                encoder.encode(diff);
                report.addDescriptionEntry(DIFFERENCE_IMAGE,new File(s));
            } catch (Exception e) { }
        }
View Full Code Here


        throws IOException {

        File imageFile =  makeRandomFileName(imageType);
        imageFile.deleteOnExit();

        PNGImageEncoder encoder
            = new PNGImageEncoder(new FileOutputStream(imageFile),
                                  PNGEncodeParam.getDefaultEncodeParam(img));
       
        encoder.encode(img);
       
        return imageFile;
       
    }
View Full Code Here

    /**
     * Saves an image in a given File
     */
    protected void saveImage(BufferedImage img, OutputStream os)
        throws IOException {
        PNGImageEncoder encoder = new PNGImageEncoder
            (os, PNGEncodeParam.getDefaultEncodeParam(img));
       
        encoder.encode(img);
    }
View Full Code Here

            imageFile = makeRandomFileName(imageType);
        }
       
        imageFile.deleteOnExit();

        PNGImageEncoder encoder = new PNGImageEncoder
            (new FileOutputStream(imageFile),
             PNGEncodeParam.getDefaultEncodeParam(img));
       
        encoder.encode(img);
       
        return imageFile;
    }
View Full Code Here

        // num Pixs in 1 Meter
        int numPix      = (int)((1000/PixSzMM)+0.5);
        params.setPhysicalDimension(numPix, numPix, 1); // 1 means 'pix/meter'

        try {
            PNGImageEncoder pngEncoder = new PNGImageEncoder(ostream, params);
            pngEncoder.encode(img);
            ostream.close();
        } catch (IOException ex) {
            throw new TranscoderException(ex);
        }
    }
View Full Code Here

   */
  public void savePNGWithBatik(String filename, BufferedImage image) {
    File outfile = new File(filename);
    OutputStream fos = createFile(outfile);
    PNGEncodeParam param = PNGEncodeParam.getDefaultEncodeParam(image);
    PNGImageEncoder encoder = new PNGImageEncoder(fos, param);
    try {
      encoder.encode(image);
    } catch (Exception e) {
      // do nothing
    } finally {
      try {
        fos.close();
View Full Code Here

     * @throws IOException in case of an I/O problem
     */
    public static void saveAsPNG(BufferedImage bitmap, File outputFile) throws IOException {
        OutputStream out = new FileOutputStream(outputFile);
        try {
            PNGImageEncoder encoder = new PNGImageEncoder(
                    out,
                    PNGEncodeParam.getDefaultEncodeParam(bitmap));
            encoder.encode(bitmap);
        } finally {
            IOUtils.closeQuietly(out);
        }
    }
View Full Code Here

                // num Pixs in 1 Meter
                int numPix = (int)((1000 / pixSzMM) + 0.5);
                renderParams.setPhysicalDimension(numPix, numPix, 1); // 1 means 'pix/meter'
               
                // Encode PNG image
                PNGImageEncoder encoder = new PNGImageEncoder(os, renderParams);
                encoder.encode(image);
            } finally {
                //Only close self-created OutputStreams
                if (os != firstOutputStream) {
                    IOUtils.closeQuietly(os);
                }
View Full Code Here

        log.debug("Encoding page" + (getCurrentPageNumber() + 1));
        renderParams = PNGEncodeParam.getDefaultEncodeParam(image);
        OutputStream os = getCurrentOutputStream(getCurrentPageNumber());
        if (os != null) {
            try {
                PNGImageEncoder encoder = new PNGImageEncoder(os, renderParams);
                encoder.encode(image);
            } finally {
                //Only close self-created OutputStreams
                if (os != firstOutputStream) {
                    IOUtils.closeQuietly(os);
                }
View Full Code Here

                p += adjust;
            }
        }

        try {
            PNGImageEncoder pngEncoder = new PNGImageEncoder(ostream, params);
            pngEncoder.encode(img);
            ostream.close();
        } catch (IOException ex) {
            throw new TranscoderException(ex);
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.batik.ext.awt.image.codec.PNGImageEncoder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.