com.mindprod.common11
Class ImageInfo

java.lang.Object
  extended by com.mindprod.common11.ImageInfo

public final class ImageInfo
extends java.lang.Object

Rapidly determine the gif or jpg or png image width and height without loading the image.

Since:
2003-05-15
Version:
1.1 2006-03-04
Author:
Roedy Green, Canadian Mind Products

Constructor Summary
ImageInfo()
           
 
Method Summary
static int[] getImageDimensions(java.lang.String imageFilename)
          Summary: Rapidly calculate image size without loading the image.
static void main(java.lang.String[] args)
          Test driver to find size of an image mentioned on the command line.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImageInfo

public ImageInfo()
Method Detail

getImageDimensions

public static int[] getImageDimensions(java.lang.String imageFilename)
Summary: Rapidly calculate image size without loading the image.

get the height and width of a gif or jpg image without having to read the entire Image into RAM. This works only with local images, not ones out on the web accessible by URL. Works with fully qualified name, not necessarily anything to do with the htmlmacros package.

Parameters:
imageFilename - filename. Must end in .jpg or .gif
Returns:
length-2 array of two numbers, width and height of the image, or 0,0 if it could not be found. We don't return a Dimension object because it provides doubles, not ints.
See Also:
"com.mindprod.ledatastream.LEDataStream"

main

public static void main(java.lang.String[] args)
Test driver to find size of an image mentioned on the command line.

Parameters:
args - name of a *.gif or *.jpg or *.png image file to test. Should print out its width and height.