ImageUtils Class Reference

List of all members.

Static Public Member Functions

static BufferedImage createWritableBuffer (int width, int height)
static long getTimeFromString (String timestampString)
 Parses strings like 2005:03:30 19:20:23 and returns a java.sql.Timestamp object.
static boolean isJPEGFile (File imageFile)
static String readCaptureDateFromEXIF (File photoFile)
 Gets the EXIF timestamp from a photo.
static BufferedImage readImage (File source)
static Dimension readSize (File imageFile)
 This works for both JPEG and non JPEG images/photos.
static Dimension readSizeByLoading (File imageFile)
 Load in the image file just to read the photo size.
static long readTimeFrom (File photo)
 If the EXIF field does not exist, it will return a time representing the file last modified date/time.
static BufferedImage scaleImage (BufferedImage src, float sX, float sY)
 Scaled a buffered image by the two scale parameters.
static BufferedImage scaleImageToFit (BufferedImage src, int width, int height)
static BufferedImage scaleImageToSize (BufferedImage src, int targetWidth, int targetHeight, boolean maintainAspectRatio)
static void writeImageToJPEG (BufferedImage bufferedImage, File file)
static void writeImageToJPEG (BufferedImage buffImage, int quality, File outputFile)
 This method is generally BETTER than ImageIO.write(.
static void writeImageToPNG (RenderedImage rImage, File outputFile)

Detailed Description

This software is distributed under the BSD License.

Author:
Ron B Yeh (ronyeh(AT)cs.stanford.edu)

Definition at line 37 of file ImageUtils.java.


Member Function Documentation

static BufferedImage createWritableBuffer ( int  width,
int  height 
) [static]

Parameters:
width 
height 
Returns:

Definition at line 44 of file ImageUtils.java.

static long getTimeFromString ( String  timestampString  )  [static]

Parses strings like 2005:03:30 19:20:23 and returns a java.sql.Timestamp object.

Parameters:
timestampString 
Returns:

Definition at line 54 of file ImageUtils.java.

Referenced by ImageUtils.readTimeFrom().

static boolean isJPEGFile ( File  imageFile  )  [static]

Returns:
whether or not a file is a JPEG (just based on file extensions of .jpeg or .jpg) =]

Definition at line 81 of file ImageUtils.java.

Referenced by ImageUtils.readSize().

static String readCaptureDateFromEXIF ( File  photoFile  )  [static]

Gets the EXIF timestamp from a photo.

Parameters:
photoFile 
Returns:

Definition at line 96 of file ImageUtils.java.

Referenced by ImageUtils.readTimeFrom().

static BufferedImage readImage ( File  source  )  [static]

Parameters:
source 
Returns:

Definition at line 126 of file ImageUtils.java.

static Dimension readSize ( File  imageFile  )  [static]

This works for both JPEG and non JPEG images/photos.

It defaults to a generic method if it cannot find the jpeg EXIF.

Parameters:
imageFile 
Returns:

Definition at line 137 of file ImageUtils.java.

References ImageUtils.isJPEGFile(), and ImageUtils.readSizeByLoading().

static Dimension readSizeByLoading ( File  imageFile  )  [static]

Load in the image file just to read the photo size.

.. This should be slower than readSize(...) if most of your images are JPEG files with EXIF headers... Use it if you are loading non-JPEGS or if your JPEGs do not have EXIFs.

Parameters:
imageFile 
Returns:

Definition at line 161 of file ImageUtils.java.

Referenced by ImageUtils.readSize().

static long readTimeFrom ( File  photo  )  [static]

If the EXIF field does not exist, it will return a time representing the file last modified date/time.

TODO Would users rather pick the latest valid time read from the file system (based on an alphabetical sort by name), in the same directory? Maybe it should be a configurable option in whatever software uses this method?

Parameters:
photo 
Returns:

Definition at line 177 of file ImageUtils.java.

References ImageUtils.getTimeFromString(), and ImageUtils.readCaptureDateFromEXIF().

static BufferedImage scaleImage ( BufferedImage  src,
float  sX,
float  sY 
) [static]

Scaled a buffered image by the two scale parameters.

The scale operation is anti-aliased.

Parameters:
src 
sX 
sY 
Returns:
A scaled BufferedImage
Author:
Ron Yeh

Definition at line 196 of file ImageUtils.java.

Referenced by ImageUtils.scaleImageToSize().

static void writeImageToJPEG ( BufferedImage  buffImage,
int  quality,
File  outputFile 
) [static]

This method is generally BETTER than ImageIO.write(.

..) as that produces low quality output. This method will not work for a 4-banded image. The colors will look incorrect. Use the PNG version instead.

Parameters:
buffImage 
quality goes from 0 to 100
outputFile Jun 21, 2006
Author:
Ron Yeh

Definition at line 267 of file ImageUtils.java.

static void writeImageToJPEG ( BufferedImage  bufferedImage,
File  file 
) [static]

Parameters:
bufferedImage 
file 

Definition at line 251 of file ImageUtils.java.

static void writeImageToPNG ( RenderedImage  rImage,
File  outputFile 
) [static]

Parameters:
rImage 
outputFile 

Definition at line 300 of file ImageUtils.java.


The documentation for this class was generated from the following file:
Generated on Sat Apr 14 18:21:46 2007 for R3 Paper Toolkit by  doxygen 1.4.7