Example usage for org.apache.commons.imaging.formats.tiff TiffImageParser getBufferedImage

List of usage examples for org.apache.commons.imaging.formats.tiff TiffImageParser getBufferedImage

Introduction

In this page you can find the example usage for org.apache.commons.imaging.formats.tiff TiffImageParser getBufferedImage.

Prototype

@Override
public BufferedImage getBufferedImage(final ByteSource byteSource, final Map<String, Object> params)
        throws ImageReadException, IOException 

Source Link

Document

Gets a buffered image specified by the byte source.

Usage

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();
}