Package com.sun.media.jai.codec

Examples of com.sun.media.jai.codec.ImageEncoder


    if (bi != null) {
      BufferedOutputStream bos = null;
      try {
        bos = new BufferedOutputStream(os);
        TIFFEncodeParam param = new TIFFEncodeParam();
        ImageEncoder enc = ImageCodec.createImageEncoder("TIFF", bos, param);
        enc.encode(bi);
      } catch (IOException e) {
        logger.error(e,e);
      } finally {
        if (bos != null) {
          try {
View Full Code Here


           String codecName,
           OutputStream output)
  throws IOException {

  try {
      ImageEncoder encoder = ImageCodec.
    createImageEncoder(codecName,
           output,
           null);
     
      encoder.encode(image);
  } catch (IOException e) {
      throw e;
  } finally {
      try {
    output.flush();
View Full Code Here

    public abstract ImageDecoder getDecoder(InputStream os);
   
    @Override
    public void encode(Object value, OutputStream outputStream) throws Exception {
        RenderedImage renderedImage = (RenderedImage) value;
        ImageEncoder encoder = getEncoder(outputStream);
        encoder.encode(renderedImage);
    }
View Full Code Here

            }
        }
        else { // PNG is the default
            PNGEncodeParam param = PNGEncodeParam.getDefaultEncodeParam( bi );

            ImageEncoder encoder = ImageCodec.createImageEncoder( "PNG", out, param ); //NON-NLS
            try {
                // Writes it to a file as a .png
                encoder.encode( bi );
            } catch (IOException e) {
                throw new IllegalStateException("IOException error.", e);
            } catch (NullPointerException npe) {
                throw new IllegalStateException("Could not encode buffered image because it was null.", npe);
            }
View Full Code Here

TOP

Related Classes of com.sun.media.jai.codec.ImageEncoder

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.