Liferay 6.1.2-ce-ga3

com.liferay.portal.kernel.image
Interface ImageTool


public interface ImageTool


Field Summary
static String TYPE_BMP
           
static String TYPE_GIF
           
static String TYPE_JPEG
           
static String TYPE_NOT_AVAILABLE
           
static String TYPE_PNG
           
static String TYPE_TIFF
           
 
Method Summary
 BufferedImage convertImageType(BufferedImage sourceImage, int type)
           
 void encodeGIF(RenderedImage renderedImage, OutputStream os)
           
 void encodeWBMP(RenderedImage renderedImage, OutputStream os)
           
 BufferedImage getBufferedImage(RenderedImage renderedImage)
           
 byte[] getBytes(RenderedImage renderedImage, String contentType)
           
 ImageBag read(byte[] bytes)
           
 ImageBag read(File file)
           
 RenderedImage scale(RenderedImage renderedImage, int width)
          Scales the image based on the given width with the height calculated to preserve aspect ratio.
 RenderedImage scale(RenderedImage renderedImage, int maxHeight, int maxWidth)
          Scales the image based on the maximum height and width given while preserving the aspect ratio.
 void write(RenderedImage renderedImage, String contentType, OutputStream os)
           
 

Field Detail

TYPE_BMP

static final String TYPE_BMP
See Also:
Constant Field Values

TYPE_GIF

static final String TYPE_GIF
See Also:
Constant Field Values

TYPE_JPEG

static final String TYPE_JPEG
See Also:
Constant Field Values

TYPE_NOT_AVAILABLE

static final String TYPE_NOT_AVAILABLE
See Also:
Constant Field Values

TYPE_PNG

static final String TYPE_PNG
See Also:
Constant Field Values

TYPE_TIFF

static final String TYPE_TIFF
See Also:
Constant Field Values
Method Detail

convertImageType

BufferedImage convertImageType(BufferedImage sourceImage,
                               int type)

encodeGIF

void encodeGIF(RenderedImage renderedImage,
               OutputStream os)
               throws IOException
Throws:
IOException

encodeWBMP

void encodeWBMP(RenderedImage renderedImage,
                OutputStream os)
                throws InterruptedException,
                       IOException
Throws:
InterruptedException
IOException

getBufferedImage

BufferedImage getBufferedImage(RenderedImage renderedImage)

getBytes

byte[] getBytes(RenderedImage renderedImage,
                String contentType)
                throws IOException
Throws:
IOException

read

ImageBag read(byte[] bytes)
              throws IOException
Throws:
IOException

read

ImageBag read(File file)
              throws IOException
Throws:
IOException

scale

RenderedImage scale(RenderedImage renderedImage,
                    int width)
Scales the image based on the given width with the height calculated to preserve aspect ratio.

Parameters:
renderedImage - image to scale
width - used as new width and to calculate for new height
Returns:
scaled image

scale

RenderedImage scale(RenderedImage renderedImage,
                    int maxHeight,
                    int maxWidth)
Scales the image based on the maximum height and width given while preserving the aspect ratio. If the image is already larger in both dimensions, the image will not be scaled.

Parameters:
renderedImage - image to scale
maxHeight - maximum height allowed for image
maxWidth - maximum width allowed for image
Returns:
scaled image

write

void write(RenderedImage renderedImage,
           String contentType,
           OutputStream os)
           throws IOException
Throws:
IOException

Liferay 6.1.2-ce-ga3