com.liferay.portal.image
Class ImageToolImpl
java.lang.Object
com.liferay.portal.image.ImageToolImpl
- All Implemented Interfaces:
- ImageTool
public class ImageToolImpl
- extends Object
- implements ImageTool
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ImageToolImpl
public ImageToolImpl()
getInstance
public static ImageTool getInstance()
convertImageType
public BufferedImage convertImageType(BufferedImage sourceImage,
int type)
- Specified by:
convertImageType
in interface ImageTool
encodeGIF
public void encodeGIF(RenderedImage renderedImage,
OutputStream os)
throws IOException
- Specified by:
encodeGIF
in interface ImageTool
- Throws:
IOException
encodeWBMP
public void encodeWBMP(RenderedImage renderedImage,
OutputStream os)
throws IOException
- Specified by:
encodeWBMP
in interface ImageTool
- Throws:
IOException
getBufferedImage
public BufferedImage getBufferedImage(RenderedImage renderedImage)
- Specified by:
getBufferedImage
in interface ImageTool
getBytes
public byte[] getBytes(RenderedImage renderedImage,
String contentType)
throws IOException
- Specified by:
getBytes
in interface ImageTool
- Throws:
IOException
read
public ImageBag read(byte[] bytes)
- Specified by:
read
in interface ImageTool
read
public ImageBag read(File file)
throws IOException
- Specified by:
read
in interface ImageTool
- Throws:
IOException
scale
public RenderedImage scale(RenderedImage renderedImage,
int width)
- Description copied from interface:
ImageTool
- Scales the image based on the given width with the height calculated to
preserve aspect ratio.
- Specified by:
scale
in interface ImageTool
- Parameters:
renderedImage
- image to scalewidth
- used as new width and to calculate for new height
- Returns:
- scaled image
scale
public RenderedImage scale(RenderedImage renderedImage,
int maxHeight,
int maxWidth)
- Description copied from interface:
ImageTool
- 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.
- Specified by:
scale
in interface ImageTool
- Parameters:
renderedImage
- image to scalemaxHeight
- maximum height allowed for imagemaxWidth
- maximum width allowed for image
- Returns:
- scaled image
write
public void write(RenderedImage renderedImage,
String contentType,
OutputStream os)
throws IOException
- Specified by:
write
in interface ImageTool
- Throws:
IOException