net.sourceforge.vietocr
Class ImageIOHelper

java.lang.Object
  extended by net.sourceforge.vietocr.ImageIOHelper

public class ImageIOHelper
extends java.lang.Object


Constructor Summary
ImageIOHelper()
           
 
Method Summary
static java.util.List<java.io.File> createTiffFiles(java.io.File imageFile, int index)
          Creates a list of TIFF image files from an image file.
static java.util.List<java.io.File> createTiffFiles(java.util.List<javax.imageio.IIOImage> imageList, int index)
          Creates a list of TIFF image files from a list of IIOImage objects.
static java.util.List<java.io.File> createTiffFiles(java.util.List<javax.imageio.IIOImage> imageList, int index, int dpiX, int dpiY)
           
static java.util.List<javax.imageio.IIOImage> getIIOImageList(java.io.File imageFile)
          Gets a list of IIOImage objects for an image file.
static java.nio.ByteBuffer getImageByteBuffer(javax.imageio.IIOImage image)
          Gets pixel data of an IIOImage object.
static void mergeTiff(java.io.File[] inputImages, java.io.File outputTiff)
          Merges multiple images into one TIFF image.
static java.util.Map<java.lang.String,java.lang.String> readImageData(javax.imageio.IIOImage oimage)
          Reads image meta data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImageIOHelper

public ImageIOHelper()
Method Detail

createTiffFiles

public static java.util.List<java.io.File> createTiffFiles(java.io.File imageFile,
                                                           int index)
                                                    throws java.io.IOException
Creates a list of TIFF image files from an image file. It basically converts images of other formats to TIFF format, or a multi-page TIFF image to multiple TIFF image files.

Parameters:
imageFile - input image file
index - an index of the page; -1 means all pages, as in a multi-page TIFF image
Returns:
a list of TIFF image files
Throws:
java.lang.Exception
java.io.IOException

createTiffFiles

public static java.util.List<java.io.File> createTiffFiles(java.util.List<javax.imageio.IIOImage> imageList,
                                                           int index)
                                                    throws java.io.IOException
Creates a list of TIFF image files from a list of IIOImage objects.

Parameters:
imageList - a list of IIOImage objects
index - an index of the page; -1 means all pages
Returns:
a list of TIFF image files
Throws:
java.lang.Exception
java.io.IOException

createTiffFiles

public static java.util.List<java.io.File> createTiffFiles(java.util.List<javax.imageio.IIOImage> imageList,
                                                           int index,
                                                           int dpiX,
                                                           int dpiY)
                                                    throws java.io.IOException
Throws:
java.io.IOException

getImageByteBuffer

public static java.nio.ByteBuffer getImageByteBuffer(javax.imageio.IIOImage image)
                                              throws java.io.IOException
Gets pixel data of an IIOImage object.

Parameters:
image - an IIOImage object
Returns:
a byte buffer of pixel data
Throws:
java.lang.Exception
java.io.IOException

getIIOImageList

public static java.util.List<javax.imageio.IIOImage> getIIOImageList(java.io.File imageFile)
                                                              throws java.io.IOException
Gets a list of IIOImage objects for an image file.

Parameters:
imageFile - input image file. It can be any of the supported formats, including TIFF, JPEG, GIF, PNG, BMP, JPEG, and PDF if GPL Ghostscript is installed
Returns:
a list of IIOImage objects
Throws:
java.lang.Exception
java.io.IOException

mergeTiff

public static void mergeTiff(java.io.File[] inputImages,
                             java.io.File outputTiff)
                      throws java.io.IOException
Merges multiple images into one TIFF image.

Parameters:
inputImages - an array of image files
outputTiff - the output TIFF file
Throws:
java.lang.Exception
java.io.IOException

readImageData

public static java.util.Map<java.lang.String,java.lang.String> readImageData(javax.imageio.IIOImage oimage)
Reads image meta data.

Parameters:
oimage -
Returns: