|
Liferay 6.2-ce-ga5 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.liferay.portal.kernel.image.ImageToolUtil
public class ImageToolUtil
The Image utility class.
Constructor Summary | |
---|---|
ImageToolUtil()
|
Method Summary | |
---|---|
static Future<RenderedImage> |
convertCMYKtoRGB(byte[] bytes,
String type)
Returns the CMYK image converted to RGB using ImageMagick. |
static BufferedImage |
convertImageType(BufferedImage sourceImage,
int type)
Returns the image converted to the type. |
static void |
encodeGIF(RenderedImage renderedImage,
OutputStream os)
Encodes the image using the GIF format. |
static void |
encodeWBMP(RenderedImage renderedImage,
OutputStream os)
Encodes the image using the WBMP format. |
static BufferedImage |
getBufferedImage(RenderedImage renderedImage)
Returns the rendered image as a BufferedImage . |
static byte[] |
getBytes(RenderedImage renderedImage,
String contentType)
Returns the image as a byte[] . |
static Image |
getDefaultCompanyLogo()
|
static Image |
getDefaultOrganizationLogo()
|
static Image |
getDefaultSpacer()
|
static Image |
getDefaultUserFemalePortrait()
|
static Image |
getDefaultUserMalePortrait()
|
static Image |
getImage(byte[] bytes)
|
static Image |
getImage(File file)
|
static Image |
getImage(InputStream is)
|
static Image |
getImage(InputStream is,
boolean cleanUpStream)
|
static ImageTool |
getImageTool()
|
static boolean |
isNullOrDefaultSpacer(byte[] bytes)
|
static ImageBag |
read(byte[] bytes)
Detects the image format and creates an ImageBag containing the RenderedImage and image type. |
static ImageBag |
read(File file)
Detects the image format and creates an ImageBag containing the RenderedImage and image type. |
static ImageBag |
read(InputStream inputStream)
|
static RenderedImage |
scale(RenderedImage renderedImage,
int width)
Returns the scaled image based on the given width with the height calculated to preserve aspect ratio. |
static RenderedImage |
scale(RenderedImage renderedImage,
int maxHeight,
int maxWidth)
Returns the scaled image based on the maximum height and width given while preserving the aspect ratio. |
void |
setImageTool(ImageTool imageTool)
|
static void |
write(RenderedImage renderedImage,
String contentType,
OutputStream os)
Encodes the image using the content or image type. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ImageToolUtil()
Method Detail |
---|
public static Future<RenderedImage> convertCMYKtoRGB(byte[] bytes, String type)
byte[]
and not one extracted from a
RenderedImage
. The latter may potentially have
been already been read incorrectly.
bytes
- the image to converttype
- the image type (e.g., "gif", "jpg", etc.)
null
if ImageMagick was disabled or if the conversion could
not be completed. The conversion may not complete if (1) the
image was not in the CMYK colorspace to begin with or (2) there
was an error in the conversion process.public static BufferedImage convertImageType(BufferedImage sourceImage, int type)
sourceImage
- the image to converttype
- the image type to convert to (e.g., "gif", "jpg", etc.)
public static void encodeGIF(RenderedImage renderedImage, OutputStream os) throws IOException
renderedImage
- the image to encodeos
- the stream to write to
IOException
- if an IO exception occurredpublic static void encodeWBMP(RenderedImage renderedImage, OutputStream os) throws IOException
renderedImage
- the image to encodeos
- the stream to write to
IOException
- if an IO exception occurredpublic static BufferedImage getBufferedImage(RenderedImage renderedImage)
BufferedImage
.
renderedImage
- the original image
public static byte[] getBytes(RenderedImage renderedImage, String contentType) throws IOException
byte[]
.
renderedImage
- the image to readcontentType
- the content type (e.g., "image/jpeg") or image type
(e.g., "jpg") to use during encoding
IOException
- if an IO exception occurredpublic static Image getDefaultCompanyLogo()
public static Image getDefaultOrganizationLogo()
public static Image getDefaultSpacer()
public static Image getDefaultUserFemalePortrait()
public static Image getDefaultUserMalePortrait()
public static Image getImage(byte[] bytes) throws IOException
IOException
public static Image getImage(File file) throws IOException
IOException
public static Image getImage(InputStream is) throws IOException
IOException
public static Image getImage(InputStream is, boolean cleanUpStream) throws IOException
IOException
public static ImageTool getImageTool()
public static boolean isNullOrDefaultSpacer(byte[] bytes)
public static ImageBag read(byte[] bytes) throws IOException
ImageBag
containing the RenderedImage
and image type.
bytes
- the bytes to read
ImageBag
IOException
- if an IO exception occurredpublic static ImageBag read(File file) throws IOException
ImageBag
containing the RenderedImage
and image type.
file
- the file to read
ImageBag
IOException
- if an IO exception occurredpublic static ImageBag read(InputStream inputStream) throws IOException
IOException
public static RenderedImage scale(RenderedImage renderedImage, int width)
renderedImage
- the image to scalewidth
- the new width; also used to calculate the new height
public static RenderedImage scale(RenderedImage renderedImage, int maxHeight, int maxWidth)
renderedImage
- the image to scalemaxHeight
- the maximum height allowed for imagemaxWidth
- the maximum width allowed for image
public static void write(RenderedImage renderedImage, String contentType, OutputStream os) throws IOException
renderedImage
- the image to encodecontentType
- the content type (e.g., "image/jpeg") or image type
(e.g., "jpg") to use during encodingos
- the stream to write to
IOException
- if an IO exception occurredpublic void setImageTool(ImageTool imageTool)
|
Liferay 6.2-ce-ga5 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |