Dekoh platform API

dekoh.portal.fwk.image
Class ImageUtils

java.lang.Object
  extended by dekoh.portal.fwk.image.ImageUtils

public class ImageUtils
extends Object

Since:
Sep 18, 2006

Field Summary
static int IMAGE_JPEG
           
static int IMAGE_PNG
           
 
Constructor Summary
ImageUtils()
           
 
Method Summary
static int getImageType(BufferedImage image)
           
static boolean hasAlpha(Image image)
          Determines if the image has transparent pixels.
static BufferedImage makeThumb(BufferedImage image, int x, int y, int width, int height, int size, int shape)
          Create fancy thumb nail of the given image in any given shape in any given dimension.
static AbstractImageResizer.ImageWithReader resizeAndGiveBufferedImage(File imageFile, File destFile, ImageSize resizeTo)
           
static BufferedImage resizeAndSaveImage(AbstractImageResizer.ImageWithReader bufferedImage, File destFile, ImageSize resizeTo)
           
static void resizeAndSaveImage(File imageFile, File destFile, boolean isThumbNail)
           
static void resizeAndSaveImage(File imageFile, File destFile, ImageSize resizeTo)
          creates thumbnails and 640x480 images and saves in respective folders.
static void resizeAndSaveImage(File imageFile, File destFile, ImageSize resizeTo, EXIFOrientation photoOrientation)
          creates thumbnails and 640x480 images and saves in respective folders.
static BufferedImage resizeImage(File imgName, int type, int maxWidth, int maxHeight)
          Resizes an image
static BufferedImage resizeImage(Image image, int type, int maxWidth, int maxHeight)
          Resizes an image.
static boolean saveImage(BufferedImage image, File toFileName, int type)
          Saves an image to the disk.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

IMAGE_JPEG

public static final int IMAGE_JPEG
See Also:
Constant Field Values

IMAGE_PNG

public static final int IMAGE_PNG
See Also:
Constant Field Values
Constructor Detail

ImageUtils

public ImageUtils()
Method Detail

resizeAndSaveImage

public static void resizeAndSaveImage(File imageFile,
                                      File destFile,
                                      boolean isThumbNail)
                               throws IOException
Throws:
IOException

resizeAndSaveImage

public static void resizeAndSaveImage(File imageFile,
                                      File destFile,
                                      ImageSize resizeTo)
                               throws IOException
creates thumbnails and 640x480 images and saves in respective folders.

Parameters:
imageFile - File
destFile - String
resizeTo - imageSize
Throws:
IOException - throws when could not save the resized image

resizeAndGiveBufferedImage

public static AbstractImageResizer.ImageWithReader resizeAndGiveBufferedImage(File imageFile,
                                                                              File destFile,
                                                                              ImageSize resizeTo)
                                                                       throws IOException
Throws:
IOException

resizeAndSaveImage

public static BufferedImage resizeAndSaveImage(AbstractImageResizer.ImageWithReader bufferedImage,
                                               File destFile,
                                               ImageSize resizeTo)
                                        throws IOException
Throws:
IOException

resizeAndSaveImage

public static void resizeAndSaveImage(File imageFile,
                                      File destFile,
                                      ImageSize resizeTo,
                                      EXIFOrientation photoOrientation)
                               throws IOException
creates thumbnails and 640x480 images and saves in respective folders.

Parameters:
imageFile - File
destFile - String
resizeTo - imageSize
photoOrientation - Photo exifer orientation
Throws:
IOException - throws when could not save the resized image

resizeImage

public static BufferedImage resizeImage(File imgName,
                                        int type,
                                        int maxWidth,
                                        int maxHeight)
                                 throws IOException
Resizes an image

Parameters:
imgName - The image name to resize. Must be the complete path to the file
maxWidth - The image's max width
maxHeight - The image's max height
Returns:
A resized BufferedImage
Throws:
IOException - If the file is not found

resizeImage

public static BufferedImage resizeImage(Image image,
                                        int type,
                                        int maxWidth,
                                        int maxHeight)
Resizes an image.

Parameters:
image - The image to resize
maxWidth - The image's max width
maxHeight - The image's max height
Returns:
A resized BufferedImage

saveImage

public static boolean saveImage(BufferedImage image,
                                File toFileName,
                                int type)
                         throws IOException
Saves an image to the disk.

Parameters:
image - The image to save
toFileName - The filename to use
type - The image type. Use ImageUtils.IMAGE_JPEG to save as JPEG images, or ImageUtils.IMAGE_PNG to save as PNG.
Returns:
true always
Throws:
IOException - if saving resized image fails.

makeThumb

public static BufferedImage makeThumb(BufferedImage image,
                                      int x,
                                      int y,
                                      int width,
                                      int height,
                                      int size,
                                      int shape)
Create fancy thumb nail of the given image in any given shape in any given dimension.

Returns:
created thumbnail

hasAlpha

public static boolean hasAlpha(Image image)
Determines if the image has transparent pixels.

Parameters:
image - The image to check for transparent pixel.s
Returns:
true of false, according to the result

getImageType

public static int getImageType(BufferedImage image)

Dekoh platform API

© 2009 Pramati Technologies - Dekoh - Portal for Developers