jwo.landserf.process.io
Class ImageIO

java.lang.Object
  extended byjwo.landserf.process.io.FileIO
      extended byjwo.landserf.process.io.ImageIO

public class ImageIO
extends FileIO

Contains a collection of static methods for reading and writing image files.

Version:
2.1, 23rd February, 2004.
Author:
Jo Wood

Field Summary
 
Fields inherited from class jwo.landserf.process.io.FileIO
BIG_ENDIAN, bitsPerValue, byteOrder, errorMessage, filePointer, GATHER_INFO, lineNumber, LITTLE_ENDIAN, LOAD_ALL, LOAD_SELECTED, nullCode, substituteNull, useMultiplier, zMultiplier
 
Constructor Summary
ImageIO()
          There should be no need to call the constructor explicitly since all methods are static.
 
Method Summary
static RasterMap readRaster(String fileName, int width, int height)
          Reads a gif, png or jpeg image and creates a raster from it.
static RasterMap readTIFF(String fileName, GISFrame gisFrame)
          Reads a TIFF format image file and creates a raster map from it.
static boolean writeImage(String fileName, GISFrame gisFrame)
          Writes out the current graphics area as an image file.
 
Methods inherited from class jwo.landserf.process.io.FileIO
getErrorMessage, readByte, readByte, readCharacters, readDouble, readDouble, readDoubleBigEndian, readDoubleBigEndian, readDoubleLittleEndian, readDoubleLittleEndian, readFloat, readFloat, readFloatBigEndian, readFloatBigEndian, readFloatLittleEndian, readFloatLittleEndian, readInt, readInt, readIntBigEndian, readIntBigEndian, readIntLittleEndian, readIntLittleEndian, readNextWord, readShort, readShort, readShortBigEndian, readShortBigEndian, readShortLittleEndian, readShortLittleEndian, reset, seek, skip, skip, writeByte, writeCharacters, writeDouble, writeDoubleBigEndian, writeDoubleLittleEndian, writeFloat, writeFloatBigEndian, writeFloatLittleEndian, writeInt, writeIntBigEndian, writeIntLittleEndian, writeLine, writeShort, writeShortBigEndian, writeShortLittleEndian
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImageIO

public ImageIO()
There should be no need to call the constructor explicitly since all methods are static.

Method Detail

readRaster

public static RasterMap readRaster(String fileName,
                                   int width,
                                   int height)
Reads a gif, png or jpeg image and creates a raster from it. To read TIFF images, use readTIFF() instead. If a .gfw (GIF), .pgw (PNG) or .jpw (JPEG) file exists with the same file name, the image will be georeferenced using the transformation data contained within it.

Parameters:
fileName - Name of file to read.
width - Width of raster to create or 0 if image width to be used.
height - Height of raster to create or 0 if image height to be used.
Returns:
Raster map repsenting image, or null if problems reading.

readTIFF

public static RasterMap readTIFF(String fileName,
                                 GISFrame gisFrame)
Reads a TIFF format image file and creates a raster map from it.

Parameters:
fileName - Name of file to read.
gisFrame - GUI in which to report progress.
Returns:
Raster map representing contents of TIFF file.

writeImage

public static boolean writeImage(String fileName,
                                 GISFrame gisFrame)
Writes out the current graphics area as an image file. Will also write out a 'world' file (same name but with extension made up of first and last letters of the original extension plus a 'w') containing georeferencing information.

Parameters:
fileName - Name of the image file to create. File format will be based on file name extension (png, gif or jpg/jpeg). Default is png.
gisFrame - GUI holding the graphics area to write as an image.
Returns:
True if image written successfully.


Copyright Jo Wood, 1996-2004, last modified, 3rd September, 2004