JIGL
v1.6

jigl.image.utils
Class ImageOps

java.lang.Object
  |
  +--jigl.image.utils.ImageOps

public class ImageOps
extends Object

ImageOps is a class that allows basic opearations on images from the Command Line. Below is a table of the currently supported operations and their syntax
 
 
Supported Operations
Operation
Syntax
Comments
Add  two images  -add <image1> <image2> <output file>  * Note: Some image types are incompatible for these operations (in any order).  
  • GrayImage&ColorImage (or RealColorImage)
  • ComplexImage&ColorImage (or RealColorImage)
  • RealGrayImage&ColorImage (or RealColorImage)
Subtract two images  -subtract <image1> <image2> <output file>
Multiply two images  -multiply <image1> <image2> <output file>
Divide two images  -divide <image1> <image2> <output file>
Add a constant to all the pixels in an image  -addconst <image1> <const>+ <output file> * Note: It is not possible to use these operations using float or double values on eithier a GrayImage  or a ColorImage.  

* Note: ColorImages and RealColorImages require 3 constants, one for each plane.  Complex Images require two, one for the real plane and one for the imaginary plane. 

Subtract a constant from all the pixels in an image  -subtractconst <image1> <const>+ <output file>
Multiply a constant by all the pixels in an image  -multiplyconst <image1> <const>+ <output file>
Divide all the pixels in an image by a constant  -divideconst <image1> <const>+ <output file>
Clip an arbitary region of an image  -clip <image1> <const1> <const2> <output file>  const1 is the low value  
 const2 is the high value
Clear an image to a value  -clear <image1> <const> <output file>  the constant is the value to set it to
ByteSize operation  -bytesize <image1> <output file>
Diff operation  -diff <image1> <image2> <output file>
* ImageOps also support a "-debug" option.  This will display some helpful imformation in debugging problems you might encounter.

Examples of a Command-lines:

   java ImageOpps -add C:\pictures\test1.ppm C:\pictures\test2.ppm C:\Output\out_test.ppm

   java ImageOpps -mulitiplyconst C:\pictures\test1.ppm 5 C:\Output\out_test.ppm -debug

   java ImageOpps -clip C:\pictures\test1.ppm 40 150 C:\Output\out_test.ppm


Field Summary
private static boolean debug
          Debug flag.
private static String[] param
          Command line parameters
 
Constructor Summary
ImageOps()
           
 
Method Summary
private static Image basic(int which)
          Utility method: handling the addition, subtraction, multiplicationa and division of two images.
private static Image basicConst(int which)
          Utility method; handling the addition of a contant to an image.
private static Image byteSize()
          Scale the range to [0..255]
private static Image clear()
          Clear an image with a constant.
private static Image clip()
          Clip an image.
private static Image imageOpen(int file)
          Utility method: open an image file.
static void main(String[] argv)
          For command line operations.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

debug

private static boolean debug
Debug flag.


param

private static String[] param
Command line parameters

Constructor Detail

ImageOps

public ImageOps()
Method Detail

main

public static void main(String[] argv)
For command line operations.


imageOpen

private static Image imageOpen(int file)
                        throws InterruptedException,
                               IOException,
                               IllegalPBMFormatException,
                               ImageNotSupportedException
Utility method: open an image file.

InterruptedException
IOException
IllegalPBMFormatException
ImageNotSupportedException

basic

private static Image basic(int which)
                    throws IncompatibleImagesException,
                           ImageNotSupportedException,
                           ColorModelNotSupportedException,
                           InterruptedException,
                           ColorModelUnknownException,
                           IllegalPBMFormatException,
                           IOException
Utility method: handling the addition, subtraction, multiplicationa and division of two images.

IncompatibleImagesException
ImageNotSupportedException
ColorModelNotSupportedException
InterruptedException
ColorModelUnknownException
IllegalPBMFormatException
IOException

basicConst

private static Image basicConst(int which)
                         throws IncompatibleImagesException,
                                ColorModelNotSupportedException,
                                ColorModelUnknownException,
                                InterruptedException,
                                IllegalPBMFormatException,
                                IOException,
                                ImageNotSupportedException
Utility method; handling the addition of a contant to an image.

IncompatibleImagesException
ColorModelNotSupportedException
ColorModelUnknownException
InterruptedException
IllegalPBMFormatException
IOException
ImageNotSupportedException

byteSize

private static Image byteSize()
                       throws ImageNotSupportedException,
                              ColorModelNotSupportedException,
                              ColorModelUnknownException,
                              InterruptedException,
                              IllegalPBMFormatException,
                              IOException
Scale the range to [0..255]

ImageNotSupportedException
ColorModelNotSupportedException
ColorModelUnknownException
InterruptedException
IllegalPBMFormatException
IOException

clip

private static Image clip()
                   throws ImageNotSupportedException,
                          ColorModelNotSupportedException,
                          ColorModelUnknownException,
                          InterruptedException,
                          IllegalPBMFormatException,
                          IOException
Clip an image.

ImageNotSupportedException
ColorModelNotSupportedException
ColorModelUnknownException
InterruptedException
IllegalPBMFormatException
IOException

clear

private static Image clear()
                    throws ImageNotSupportedException,
                           ColorModelNotSupportedException,
                           ColorModelUnknownException,
                           InterruptedException,
                           IllegalPBMFormatException,
                           IOException
Clear an image with a constant.

ImageNotSupportedException
ColorModelNotSupportedException
ColorModelUnknownException
InterruptedException
IllegalPBMFormatException
IOException

JIGL
v1.6

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