List of usage examples for org.apache.commons.imaging.formats.tiff TiffImageParser getBufferedImage
@Override public BufferedImage getBufferedImage(final ByteSource byteSource, final Map<String, Object> params) throws ImageReadException, IOException
From source file:org.libimobiledevice.ios.driver.binding.services.ScreenshotService.java
private byte[] getPNGAsString() throws SDKException, ImageReadException, IOException { byte[] raw = takeScreenshotAsTiff(); TiffImageParser parser = new TiffImageParser(); BufferedImage image = parser.getBufferedImage(raw, new HashMap<String, Object>()); File f = new File("screen.png"); //System.out.println("loading :\t" + (System.currentTimeMillis() - start) + " ms"); ByteArrayOutputStream out = new ByteArrayOutputStream(); ImageIO.write(image, "png", out); out.flush();/*ww w . jav a2 s .c o m*/ return out.toByteArray(); }