utils
Class ImageTransform

java.lang.Object
  extended by utils.ImageTransform

public class ImageTransform
extends java.lang.Object

utils for transformation image


Constructor Summary
ImageTransform()
           
 
Method Summary
static java.lang.String cacheKey(java.lang.Long id, int width, int height)
          create key for cache
static byte[] cropImage(byte[] image, java.lang.Integer width, java.lang.Integer height, java.lang.Boolean stretch, java.lang.String format)
          crop image
static byte[] getImage(byte[] image, java.lang.Integer width, java.lang.Integer height, java.lang.String format, java.lang.Boolean stretch, java.lang.Boolean crop)
          transform image
static byte[] joinImages(java.util.List<java.awt.Image> imageList, java.lang.Integer width, java.lang.Integer height, java.lang.String format)
          join images
static byte[] thumb(java.lang.String url, int width, int height)
          create transformation image
static byte[] thumb(java.lang.String url, int width, int height, java.lang.String format)
          create transformation image
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImageTransform

public ImageTransform()
Method Detail

cacheKey

public static java.lang.String cacheKey(java.lang.Long id,
                                        int width,
                                        int height)
create key for cache

Parameters:
id - id of image
width - width of caching image
height - height of caching image
Returns:
key for cache

thumb

public static byte[] thumb(java.lang.String url,
                           int width,
                           int height)
create transformation image

Parameters:
url - image url
width - output width
height - output height
Returns:
transformation image in byte array

thumb

public static byte[] thumb(java.lang.String url,
                           int width,
                           int height,
                           java.lang.String format)
create transformation image

Parameters:
url - image url
width - output width
height - output height
format - image format, for example png
Returns:
transformation image in byte array

cropImage

public static byte[] cropImage(byte[] image,
                               java.lang.Integer width,
                               java.lang.Integer height,
                               java.lang.Boolean stretch,
                               java.lang.String format)
crop image

Parameters:
image - input image in byte array
width - output width
height - output height
stretch - true if image must be stretched
format - image format
Returns:
crop image in byte array

getImage

public static byte[] getImage(byte[] image,
                              java.lang.Integer width,
                              java.lang.Integer height,
                              java.lang.String format,
                              java.lang.Boolean stretch,
                              java.lang.Boolean crop)
transform image

Parameters:
image - input image in byte array
width - output width
height - output height
format - image format
stretch - true if image must be stretched
crop - true if image must be crop
Returns:
transformation image

joinImages

public static byte[] joinImages(java.util.List<java.awt.Image> imageList,
                                java.lang.Integer width,
                                java.lang.Integer height,
                                java.lang.String format)
                         throws java.io.IOException
join images

Parameters:
imageList - list of Image object
width - output width
height - output height
format - image format
Returns:
byte array of join and transform image
Throws:
java.io.IOException - write to output stream is not correct