JIGL
v1.6

jigl.image.io
Class ImageOutputStreamJAI

java.lang.Object
  |
  +--jigl.image.io.ImageOutputStreamJAI

public class ImageOutputStreamJAI
extends Object

ImageOutputStreamJAI writes images to file (formats supported - PGM,PPM,TIFF,JPEG,BMP,PNG) using Java Advanced Imaging API and com.sun.media.jai.codec package.


Field Summary
static int BMP
          Flag for one image file type
protected  BufferedOutputStream data
          Data to dump
static int GIF
          Flag for one image file type
(package private)  boolean isGray
           
static int JPEG
          Flag for one image file type
static int PGM
          Flag for one image file type
static int PNG
          Flag for one image file type
static int PPM
          Flag for one image file type
static int TIFF
          Flag for one image file type
protected  int X
          Height of the image
protected  int Y
          Width of the image
 
Constructor Summary
ImageOutputStreamJAI()
          Default ImageBufferedOutputStream, does nothing
ImageOutputStreamJAI(ImageOutputStreamJAI stream)
          Creates an ImageBufferedOutputStream from another ImageBufferedOutputStream
ImageOutputStreamJAI(String fn)
          Creates an ImageBufferedOutputStream from a file
 
Method Summary
 boolean open(String fn)
          Opens a file
 void writeBMP(Image im)
          This function writes out a jigl image in BMP format.
 void writeImage(Image image, int type, ImageEncodeParam param)
          This function writes out an image (formats supported - PGM,PPM,TIFF,JPEG,BMP,PNG).
 void writeJPEG(Image im)
          This function writes out a jigl image in JPEG format with .75 quality value
 void writeJPEG(Image im, float quality)
          This function writes out a jigl image in JPEG format.
 void writePGM(Image im)
          This function writes out a jigl image in PGM format as a binary raw file.
 void writePGM(Image im, boolean raw)
          This function writes out a jigl image in PGM format.
 void writePNG(Image im)
          This function writes out a jigl image in PNG format.
 void writePPM(Image im)
          This function writes out a jigl image in PPM format as a binary raw file.
 void writePPM(Image im, boolean raw)
          This function writes out a jigl image in PPM format.
 void writeTIFF(Image im)
          This function writes out a jigl image in TIFF format.
 int X()
          Returns the width
 int Y()
          Returns the height
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

data

protected BufferedOutputStream data
Data to dump


X

protected int X
Height of the image


Y

protected int Y
Width of the image


isGray

boolean isGray

PGM

public static final int PGM
Flag for one image file type

See Also:
Constant Field Values

PPM

public static final int PPM
Flag for one image file type

See Also:
Constant Field Values

TIFF

public static final int TIFF
Flag for one image file type

See Also:
Constant Field Values

JPEG

public static final int JPEG
Flag for one image file type

See Also:
Constant Field Values

BMP

public static final int BMP
Flag for one image file type

See Also:
Constant Field Values

GIF

public static final int GIF
Flag for one image file type

See Also:
Constant Field Values

PNG

public static final int PNG
Flag for one image file type

See Also:
Constant Field Values
Constructor Detail

ImageOutputStreamJAI

public ImageOutputStreamJAI()
Default ImageBufferedOutputStream, does nothing


ImageOutputStreamJAI

public ImageOutputStreamJAI(String fn)
                     throws IOException
Creates an ImageBufferedOutputStream from a file

Parameters:
fn - filename

ImageOutputStreamJAI

public ImageOutputStreamJAI(ImageOutputStreamJAI stream)
Creates an ImageBufferedOutputStream from another ImageBufferedOutputStream

Method Detail

X

public int X()
Returns the width


Y

public int Y()
Returns the height


open

public boolean open(String fn)
             throws IOException
Opens a file

IOException

writePGM

public void writePGM(Image im,
                     boolean raw)
              throws ImageNotSupportedException
This function writes out a jigl image in PGM format. Please note that even if the image is color, it will be converted to gray.

Parameters:
im - jigl image to be written out
raw - true = binary raw format, false = ASCII format; note that writing in ASCII format is slower than binary because of the way JAVA handles writing ASCII characters to a file
ImageNotSupportedException

writePGM

public void writePGM(Image im)
              throws ImageNotSupportedException
This function writes out a jigl image in PGM format as a binary raw file. Please note that even if the image is color, it will be converted to gray.

Parameters:
im - jigl image to be written out
ImageNotSupportedException

writePPM

public void writePPM(Image im,
                     boolean raw)
              throws ImageNotSupportedException
This function writes out a jigl image in PPM format.

Parameters:
im - jigl image to be written out
raw - true = binary raw format, false = ASCII format; note that writing in ASCII format is slower than binary because of the way JAVA handles writing ASCII characters to a file
ImageNotSupportedException

writePPM

public void writePPM(Image im)
              throws ImageNotSupportedException
This function writes out a jigl image in PPM format as a binary raw file. Please note that even if the image is color, it will be converted to gray.

Parameters:
im - jigl image to be written out
ImageNotSupportedException

writeTIFF

public void writeTIFF(Image im)
               throws ImageNotSupportedException
This function writes out a jigl image in TIFF format.

Parameters:
im - jigl image to be written out
ImageNotSupportedException

writeBMP

public void writeBMP(Image im)
              throws ImageNotSupportedException
This function writes out a jigl image in BMP format.

Parameters:
im - jigl image to be written out
ImageNotSupportedException

writeJPEG

public void writeJPEG(Image im,
                      float quality)
               throws ImageNotSupportedException
This function writes out a jigl image in JPEG format.

Parameters:
im - jigl image to be written out
quality - Some guidelines: 0.75 high quality 0.5 medium quality 0.25 low quality
ImageNotSupportedException

writeJPEG

public void writeJPEG(Image im)
               throws ImageNotSupportedException
This function writes out a jigl image in JPEG format with .75 quality value

Parameters:
im - jigl image to be written out
ImageNotSupportedException

writePNG

public void writePNG(Image im)
              throws ImageNotSupportedException
This function writes out a jigl image in PNG format.

Parameters:
im - jigl image to be written out
ImageNotSupportedException

writeImage

public void writeImage(Image image,
                       int type,
                       ImageEncodeParam param)
                throws ImageNotSupportedException
This function writes out an image (formats supported - PGM,PPM,TIFF,JPEG,BMP,PNG). Please note that GIF format is not currently supported. Also there is no explicit close operation in ImageOutputStreamJAI, the file is closed at the end of this function.

Parameters:
image - jigl image to be written out
type - either PGM,PPM,TIFF,JPEG,BMP,PNG
param - EncodeParam type, may be null
ImageNotSupportedException

JIGL
v1.6

Submit a bug or feature
Revised in May 2002 by Weiming Liu