List of usage examples for org.apache.commons.imaging ImageWriteException printStackTrace
public void printStackTrace()
From source file:org.apache.harmony.x.imageio.plugins.jpeg.JPEGImageWriter.java
@Override public void write(IIOMetadata iioMetadata, IIOImage iioImage, ImageWriteParam param) throws IOException { if (ios == null) { throw new IllegalArgumentException(Messages.getString("imageio.7F")); }//from ww w .ja v a 2 s . c o m RenderedImage img = null; if (!iioImage.hasRaster()) { img = iioImage.getRenderedImage(); if (img instanceof BufferedImage) { sourceRaster = ((BufferedImage) img).getRaster(); } else { sourceRaster = img.getData(); } } else { sourceRaster = iioImage.getRaster(); } Map params = new HashMap(); try { Imaging.writeImage((BufferedImage) img, wrapOutput(ios), //(OutputStream)ios, ImageFormats.JPEG, params); } catch (ImageWriteException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
From source file:org.apache.harmony.x.imageio.plugins.png.PNGImageWriter.java
@Override public void write(IIOMetadata streamMetadata, IIOImage iioimage, ImageWriteParam param) throws IOException { if (output == null) { throw new IllegalStateException(Messages.getString("imageio.81")); }/* w ww. jav a 2 s .com*/ if (iioimage == null) { throw new IllegalArgumentException(Messages.getString("imageio.82")); } if (iioimage.hasRaster() && !canWriteRasters()) { throw new UnsupportedOperationException(Messages.getString("imageio.83")); } // ImageOutputStreamImpl RenderedImage image = iioimage.getRenderedImage(); try { Map params = new HashMap(); Imaging.writeImage((BufferedImage) image, wrapOutput(getOutput()), ImageFormats.PNG, params); } catch (ImageWriteException e) { e.printStackTrace(); } }