JIGL
v1.6

jigl.image.io
Class ImageOutputStream

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

public class ImageOutputStream
extends Object

ImageOutputStream writes images to file. Images are saved in the following formats. BinayImage is not supported but can be treated as GrayImage.

         GrayImage -> PGM file
         RealGrayImage -> PRGM file
         ColorImage -> PPM file
         RealColorImage -> PRCM file
         ComplexImage -> PPM file
 


Field Summary
protected  BufferedOutputStream data
          Data to dump
protected  int ndims
          Number of dimensions
protected  int X
          Height of the image
protected  int Y
          Width of the image
 
Constructor Summary
ImageOutputStream()
          Default ImageOutputStream, does nothing
ImageOutputStream(ImageOutputStream stream)
          Creates an ImageOutputStream from another ImageOutputStream
ImageOutputStream(String fn)
          Creates an ImageOutputStream from a filename
 
Method Summary
 void close()
          Closes the file
 int ndims()
          Returns the number of dimensions
 boolean open(String fn)
          Opens a file
 void write(ColorImage im)
          Writes a ColorImage to a file
 void write(ComplexImage im)
          Writes a ComplexImage to a file
 void write(GrayImage im)
          Writes a GrayImage to a file
 void write(Image im)
          Writes a JIGL image to a file
 void write(RealColorImage im)
          Writes a RealColorImage to a file
 void write(RealGrayImage im)
          Writes a RealGrayImage to a file
(package private)  void writeAsciiPGMHeader(int width, int height, int maxval)
          Utility routine to write PGM_ASCII file header.
(package private)  void writeAsciiPPMHeader(int width, int height, int maxval)
          Utility routine to write PPM_ASCII file header.
 void writeByteSized(ColorImage im)
          Writes a ColorImage to a file byteSizing first
 void writeByteSized(GrayImage im)
          Writes a GrayImage to a file, byteSizing it first
 void writeByteSized(RealColorImage im)
          Writes a RealColorImage to a file, byteSizing first
 void writeByteSized(RealGrayImage im)
          Writes a RealGrayImage to a file, byteSizing first
(package private)  void writeRawPGMHeader(int width, int height)
          Utility routine to write PGM_RAW file header.
(package private)  void writeRawPPMHeader(int width, int height)
          Utility routine to write PPM_RAW file header.
(package private)  void writeRawPRCMHeader(int width, int height)
          Utility routine to write PRCM_RAW file header.
(package private)  void writeRawPRGMHeader(int width, int height)
          Utility routine to write PRGM_RAW file header.
(package private) static void writeString(OutputStream out, String str)
          Utility routine to write a String object to a OutputStream object.
 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


ndims

protected int ndims
Number of dimensions


X

protected int X
Height of the image


Y

protected int Y
Width of the image

Constructor Detail

ImageOutputStream

public ImageOutputStream()
Default ImageOutputStream, does nothing


ImageOutputStream

public ImageOutputStream(String fn)
                  throws IOException
Creates an ImageOutputStream from a filename

Parameters:
fn - filename

ImageOutputStream

public ImageOutputStream(ImageOutputStream stream)
Creates an ImageOutputStream from another ImageOutputStream

Method Detail

ndims

public int ndims()
Returns the number of dimensions


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

Parameters:
fn - filename
IOException

close

public void close()
           throws IOException
Closes the file

IOException

write

public void write(Image im)
           throws UnknownImageTypeException,
                  ColorModelNotSupportedException,
                  ColorModelUnknownException,
                  IOException
Writes a JIGL image to a file

Parameters:
im - JIGL image
UnknownImageTypeException
ColorModelNotSupportedException
ColorModelUnknownException
IOException

write

public void write(GrayImage im)
           throws IOException
Writes a GrayImage to a file

Parameters:
im - the GrayImage
IOException

writeByteSized

public void writeByteSized(GrayImage im)
                    throws IOException
Writes a GrayImage to a file, byteSizing it first

Parameters:
im - the GrayImage
IOException

write

public void write(RealGrayImage im)
           throws IOException
Writes a RealGrayImage to a file

IOException

write

public void write(ColorImage im)
           throws IOException
Writes a ColorImage to a file

Parameters:
im - the ColorImage
IOException

write

public void write(RealColorImage im)
           throws IOException
Writes a RealColorImage to a file

Parameters:
im - the RealColorImage
IOException

write

public void write(ComplexImage im)
           throws IOException
Writes a ComplexImage to a file

Parameters:
im - the ComplexImage
IOException

writeRawPGMHeader

void writeRawPGMHeader(int width,
                       int height)
                 throws IOException
Utility routine to write PGM_RAW file header.

IOException

writeRawPRGMHeader

void writeRawPRGMHeader(int width,
                        int height)
                  throws IOException
Utility routine to write PRGM_RAW file header.

IOException

writeAsciiPGMHeader

void writeAsciiPGMHeader(int width,
                         int height,
                         int maxval)
                   throws IOException
Utility routine to write PGM_ASCII file header.

IOException

writeRawPPMHeader

void writeRawPPMHeader(int width,
                       int height)
                 throws IOException
Utility routine to write PPM_RAW file header.

IOException

writeRawPRCMHeader

void writeRawPRCMHeader(int width,
                        int height)
                  throws IOException
Utility routine to write PRCM_RAW file header.

IOException

writeAsciiPPMHeader

void writeAsciiPPMHeader(int width,
                         int height,
                         int maxval)
                   throws IOException
Utility routine to write PPM_ASCII file header.

IOException

writeString

static void writeString(OutputStream out,
                        String str)
                 throws IOException
Utility routine to write a String object to a OutputStream object.

IOException

writeByteSized

public void writeByteSized(RealGrayImage im)
                    throws IOException
Writes a RealGrayImage to a file, byteSizing first

IOException

writeByteSized

public void writeByteSized(ColorImage im)
                    throws IOException
Writes a ColorImage to a file byteSizing first

Parameters:
im - the ColorImage
IOException

writeByteSized

public void writeByteSized(RealColorImage im)
                    throws IOException
Writes a RealColorImage to a file, byteSizing first

Parameters:
im - the RealColorImage
IOException

JIGL
v1.6

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