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.2, 6th December, 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 void main(String[] args)
           
static RasterMap readRaster(String fileName, int width, int height, LSThread lsThread)
          Reads a gif, png or jpeg image and creates a raster from it.
static RasterMap readTIFF(String fileName, GISFrame gisFrame, LSThread lsThread)
          Reads a TIFF format image file and creates a raster map from it.
static boolean writeImage(String fileName, GISFrame gisFrame, LSThread lsThread)
          Writes out the current graphics area as an image file.
 
Methods inherited from class jwo.landserf.process.io.FileIO
getErrorMessage, readByte, readByte, readCharacters, 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

main

public static void main(String[] args)

readRaster

public static RasterMap readRaster(String fileName,
                                   int width,
                                   int height,
                                   LSThread lsThread)
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.
lsThread - Thread that called this method (allows this to be interrupted). If null, process cannot be interrupted.
Returns:
Raster map repsenting image, or null if problems reading.

readTIFF

public static RasterMap readTIFF(String fileName,
                                 GISFrame gisFrame,
                                 LSThread lsThread)
Reads a TIFF format image file and creates a raster map from it. Currently this method does not support compressed (LZW) TIFFs. If there was a problem reading the file (null returned), use the static method getErrorMessage() to identify the problem.

Parameters:
fileName - Name of file to read.
gisFrame - GUI in which to report progress.
lsThread - Thread that called this method (allows this to be interrupted).
Returns:
Raster map representing contents of TIFF file or null if problem reading.

writeImage

public static boolean writeImage(String fileName,
                                 GISFrame gisFrame,
                                 LSThread lsThread)
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.
lsThread - Thread that called this method (allowing it to be interrupted). Can be null, in which case the method cannot be interrupted.
Returns:
True if image written successfully.


Copyright Jo Wood, 1996-2005, last modified, 11th March, 2005