Example usage for com.liferay.portal.kernel.image ImageToolUtil write

List of usage examples for com.liferay.portal.kernel.image ImageToolUtil write

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.image ImageToolUtil write.

Prototype

public static void write(RenderedImage renderedImage, String contentType, OutputStream os) throws IOException 

Source Link

Document

Encodes the image using the content or image type.

Usage

From source file:com.liferay.adaptive.media.image.internal.util.RenderedImageUtil.java

License:Open Source License

public static byte[] getRenderedImageContentStream(RenderedImage renderedImage, String mimeType)
        throws IOException {

    try (UnsyncByteArrayOutputStream baos = new UnsyncByteArrayOutputStream()) {

        ImageToolUtil.write(renderedImage, mimeType, baos);

        return baos.toByteArray();
    } catch (IOException ioe) {
        throw new AdaptiveMediaRuntimeException.IOException(ioe);
    }//from w ww  . jav  a2  s .com
}