org.davesag.generica.util
Class ImageUtils

java.lang.Object
  extended byorg.davesag.generica.util.ImageUtils

public class ImageUtils
extends Object

A collection of static utility methods for getting, saving and loading images.

Since:
Generica 1.0
Version:
CVS Revision $Id: ImageUtils.java,v 1.6 2004/03/30 13:00:43 davesag Exp $
Author:
Dave Sag http://www.davesag.com

Constructor Summary
ImageUtils()
           
 
Method Summary
static Image getImage(String url)
          gets the Image from the URL provided.
static boolean hasAlpha(Image image)
          does the image have an alpha channel?
static BufferedImage toBufferedImage(Image image)
          Utility method to convert an Image to a Buffered Image.
static void writeAsJPEG(Image image, String filepath)
          Write the Image to the filepath as a JPEG of a specific quality.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImageUtils

public ImageUtils()
Method Detail

getImage

public static Image getImage(String url)
                      throws MalformedURLException
gets the Image from the URL provided.

Parameters:
url - the url of the image
Returns:
an image
Throws:
MalformedURLException - if the url was malformed

writeAsJPEG

public static void writeAsJPEG(Image image,
                               String filepath)
Write the Image to the filepath as a JPEG of a specific quality.

Parameters:
image - The Image to write as a JPEG.
filepath - The path of the file to write.

toBufferedImage

public static BufferedImage toBufferedImage(Image image)
Utility method to convert an Image to a Buffered Image.

Parameters:
image - The Image.
Returns:
a BufferedImage made from the Image supplied.

hasAlpha

public static boolean hasAlpha(Image image)
does the image have an alpha channel?

Parameters:
image - the image to test
Returns:
true if the image has an alpha channel.


Dave Sag Generica API version 0.5.9 - (prerelease) Copyright 2003 - 2004 Dave Sag.