org.apache.sanselan
Class Sanselan

java.lang.Object
  extended by org.apache.sanselan.Sanselan
All Implemented Interfaces:
SanselanConstants

public abstract class Sanselan
extends java.lang.Object
implements SanselanConstants

The primary interface to the sanselan library.

Almost all of the Sanselan library's core functionality can be accessed through it's methods.

All of Sanselan's methods are static.

See the source of the SampleUsage class and other classes in the org.apache.sanselan.sampleUsage package for examples.

See Also:
org.apache.sanselan.sampleUsage.SampleUsage

Field Summary
 
Fields inherited from interface org.apache.sanselan.SanselanConstants
BUFFERED_IMAGE_FACTORY, PARAM_KEY_COMPRESSION, PARAM_KEY_FILENAME, PARAM_KEY_FORMAT, PARAM_KEY_READ_THUMBNAILS, PARAM_KEY_STRICT, PARAM_KEY_VERBOSE, PARAM_KEY_XMP_XML
 
Constructor Summary
Sanselan()
           
 
Method Summary
static java.lang.String dumpImageFile(byte[] bytes)
          Returns a description of the image's structure.
static java.lang.String dumpImageFile(java.io.File file)
          Returns a description of the image file's structure.
static java.util.ArrayList getAllBufferedImages(byte[] bytes)
          Returns all images contained in an image.
static java.util.ArrayList getAllBufferedImages(java.io.File file)
          Returns all images contained in an image file.
static java.util.ArrayList getAllBufferedImages(java.io.InputStream is, java.lang.String filename)
          Returns all images contained in an image.
static java.awt.image.BufferedImage getBufferedImage(byte[] bytes)
          Reads the first image from an image file as a BufferedImage.
static java.awt.image.BufferedImage getBufferedImage(byte[] bytes, java.util.Map params)
          Reads the first image from an image file as a BufferedImage.
static java.awt.image.BufferedImage getBufferedImage(java.io.File file)
          Reads the first image from an image file as a BufferedImage.
static java.awt.image.BufferedImage getBufferedImage(java.io.File file, java.util.Map params)
          Reads the first image from an image file as a BufferedImage.
static java.awt.image.BufferedImage getBufferedImage(java.io.InputStream is)
          Reads the first image from an InputStream as a BufferedImage.
static java.awt.image.BufferedImage getBufferedImage(java.io.InputStream is, java.util.Map params)
          Reads the first image from an InputStream as a BufferedImage.
static FormatCompliance getFormatCompliance(byte[] bytes)
           
static FormatCompliance getFormatCompliance(java.io.File file)
           
static java.awt.color.ICC_Profile getICCProfile(byte[] bytes)
          Extracts an ICC Profile (if present) from JPEG, PNG, PSD (Photoshop) and TIFF images.
static java.awt.color.ICC_Profile getICCProfile(byte[] bytes, java.util.Map params)
          Extracts an ICC Profile (if present) from JPEG, PNG, PSD (Photoshop) and TIFF images.
protected static java.awt.color.ICC_Profile getICCProfile(ByteSource byteSource, java.util.Map params)
           
static java.awt.color.ICC_Profile getICCProfile(java.io.File file)
          Extracts an ICC Profile (if present) from JPEG, PNG, PSD (Photoshop) and TIFF images.
static java.awt.color.ICC_Profile getICCProfile(java.io.File file, java.util.Map params)
          Extracts an ICC Profile (if present) from JPEG, PNG, PSD (Photoshop) and TIFF images.
static java.awt.color.ICC_Profile getICCProfile(java.io.InputStream is, java.lang.String filename)
          Extracts an ICC Profile (if present) from JPEG, PNG, PSD (Photoshop) and TIFF images.
static java.awt.color.ICC_Profile getICCProfile(java.io.InputStream is, java.lang.String filename, java.util.Map params)
          Extracts an ICC Profile (if present) from JPEG, PNG, PSD (Photoshop) and TIFF images.
static byte[] getICCProfileBytes(byte[] bytes)
          Extracts the raw bytes of an ICC Profile (if present) from JPEG, PNG, PSD (Photoshop) and TIFF images.
static byte[] getICCProfileBytes(byte[] bytes, java.util.Map params)
          Extracts the raw bytes of an ICC Profile (if present) from JPEG, PNG, PSD (Photoshop) and TIFF images.
static byte[] getICCProfileBytes(java.io.File file)
          Extracts the raw bytes of an ICC Profile (if present) from JPEG, PNG, PSD (Photoshop) and TIFF images.
static byte[] getICCProfileBytes(java.io.File file, java.util.Map params)
          Extracts the raw bytes of an ICC Profile (if present) from JPEG, PNG, PSD (Photoshop) and TIFF images.
static ImageInfo getImageInfo(byte[] bytes)
          Parses the "image info" of an image.
static ImageInfo getImageInfo(byte[] bytes, java.util.Map params)
          Parses the "image info" of an image.
static ImageInfo getImageInfo(java.io.File file)
          Parses the "image info" of an image file.
static ImageInfo getImageInfo(java.io.File file, java.util.Map params)
          Parses the "image info" of an image file.
static ImageInfo getImageInfo(java.io.InputStream is, java.lang.String filename)
          Parses the "image info" of an image.
static ImageInfo getImageInfo(java.io.InputStream is, java.lang.String filename, java.util.Map params)
          Parses the "image info" of an image.
static ImageInfo getImageInfo(java.lang.String filename, byte[] bytes)
          Parses the "image info" of an image.
static ImageInfo getImageInfo(java.lang.String filename, byte[] bytes, java.util.Map params)
          Parses the "image info" of an image.
static java.awt.Dimension getImageSize(byte[] bytes)
          Determines the width and height of an image.
static java.awt.Dimension getImageSize(byte[] bytes, java.util.Map params)
          Determines the width and height of an image.
static java.awt.Dimension getImageSize(ByteSource byteSource, java.util.Map params)
           
static java.awt.Dimension getImageSize(java.io.File file)
          Determines the width and height of an image file.
static java.awt.Dimension getImageSize(java.io.File file, java.util.Map params)
          Determines the width and height of an image file.
static java.awt.Dimension getImageSize(java.io.InputStream is, java.lang.String filename)
          Determines the width and height of an image.
static java.awt.Dimension getImageSize(java.io.InputStream is, java.lang.String filename, java.util.Map params)
          Determines the width and height of an image.
static IImageMetadata getMetadata(byte[] bytes)
          Parses the metadata of an image.
static IImageMetadata getMetadata(byte[] bytes, java.util.Map params)
          Parses the metadata of an image.
static IImageMetadata getMetadata(java.io.File file)
          Parses the metadata of an image file.
static IImageMetadata getMetadata(java.io.File file, java.util.Map params)
          Parses the metadata of an image file.
static IImageMetadata getMetadata(java.io.InputStream is, java.lang.String filename)
          Parses the metadata of an image file.
static IImageMetadata getMetadata(java.io.InputStream is, java.lang.String filename, java.util.Map params)
          Parses the metadata of an image file.
static java.lang.String getXmpXml(byte[] bytes)
          Determines the width and height of an image.
static java.lang.String getXmpXml(byte[] bytes, java.util.Map params)
          Determines the width and height of an image.
static java.lang.String getXmpXml(ByteSource byteSource, java.util.Map params)
          Extracts embedded XML metadata as XML string.
static java.lang.String getXmpXml(java.io.File file)
          Extracts embedded XML metadata as XML string.
static java.lang.String getXmpXml(java.io.File file, java.util.Map params)
          Extracts embedded XML metadata as XML string.
static java.lang.String getXmpXml(java.io.InputStream is, java.lang.String filename)
          Determines the width and height of an image.
static java.lang.String getXmpXml(java.io.InputStream is, java.lang.String filename, java.util.Map params)
          Determines the width and height of an image.
static ImageFormat guessFormat(byte[] bytes)
          Tries to guess what the image type (if any) of data based on the file's "magic numbers," the first bytes of the data.
static ImageFormat guessFormat(ByteSource byteSource)
           
static ImageFormat guessFormat(java.io.File file)
          Tries to guess what the image type (if any) of a file based on the file's "magic numbers," the first bytes of the file.
static boolean hasImageFileExtension(java.io.File file)
          Tries to guess whether a file contains an image based on its file extension.
static boolean hasImageFileExtension(java.lang.String filename)
          Tries to guess whether a filename represents an image based on its file extension.
static void writeImage(java.awt.image.BufferedImage src, java.io.File file, ImageFormat format, java.util.Map params)
          Writes a BufferedImage to a file.
static void writeImage(java.awt.image.BufferedImage src, java.io.OutputStream os, ImageFormat format, java.util.Map params)
          Writes a BufferedImage to an OutputStream.
static byte[] writeImageToBytes(java.awt.image.BufferedImage src, ImageFormat format, java.util.Map params)
          Writes a BufferedImage to a byte array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Sanselan

public Sanselan()
Method Detail

hasImageFileExtension

public static boolean hasImageFileExtension(java.io.File file)
Tries to guess whether a file contains an image based on its file extension.

Returns true if the file has a file extension associated with a file format, such as .jpg or .gif.

Parameters:
file - File which may contain an image.
Returns:
true if the file has an image format file extension.

hasImageFileExtension

public static boolean hasImageFileExtension(java.lang.String filename)
Tries to guess whether a filename represents an image based on its file extension.

Returns true if the filename has a file extension associated with a file format, such as .jpg or .gif.

Parameters:
filename - String representing name of file which may contain an image.
Returns:
true if the filename has an image format file extension.

guessFormat

public static ImageFormat guessFormat(byte[] bytes)
                               throws ImageReadException,
                                      java.io.IOException
Tries to guess what the image type (if any) of data based on the file's "magic numbers," the first bytes of the data.

Parameters:
bytes - Byte array containing an image file.
Returns:
An ImageFormat, such as ImageFormat.IMAGE_FORMAT_JPEG. Returns ImageFormat.IMAGE_FORMAT_UNKNOWN if the image type cannot be guessed.
Throws:
ImageReadException
java.io.IOException

guessFormat

public static ImageFormat guessFormat(java.io.File file)
                               throws ImageReadException,
                                      java.io.IOException
Tries to guess what the image type (if any) of a file based on the file's "magic numbers," the first bytes of the file.

Parameters:
file - File containing image data.
Returns:
An ImageFormat, such as ImageFormat.IMAGE_FORMAT_JPEG. Returns ImageFormat.IMAGE_FORMAT_UNKNOWN if the image type cannot be guessed.
Throws:
ImageReadException
java.io.IOException

guessFormat

public static ImageFormat guessFormat(ByteSource byteSource)
                               throws ImageReadException,
                                      java.io.IOException
Throws:
ImageReadException
java.io.IOException

getICCProfile

public static java.awt.color.ICC_Profile getICCProfile(byte[] bytes)
                                                throws ImageReadException,
                                                       java.io.IOException
Extracts an ICC Profile (if present) from JPEG, PNG, PSD (Photoshop) and TIFF images.

Parameters:
bytes - Byte array containing an image file.
Returns:
An instance of ICC_Profile or null if the image contains no ICC profile..
Throws:
ImageReadException
java.io.IOException

getICCProfile

public static java.awt.color.ICC_Profile getICCProfile(byte[] bytes,
                                                       java.util.Map params)
                                                throws ImageReadException,
                                                       java.io.IOException
Extracts an ICC Profile (if present) from JPEG, PNG, PSD (Photoshop) and TIFF images.

Parameters:
bytes - Byte array containing an image file.
params - Map of optional parameters, defined in SanselanConstants.
Returns:
An instance of ICC_Profile or null if the image contains no ICC profile..
Throws:
ImageReadException
java.io.IOException

getICCProfile

public static java.awt.color.ICC_Profile getICCProfile(java.io.InputStream is,
                                                       java.lang.String filename)
                                                throws ImageReadException,
                                                       java.io.IOException
Extracts an ICC Profile (if present) from JPEG, PNG, PSD (Photoshop) and TIFF images.

Parameters:
is - InputStream from which to read image data.
filename - Filename associated with image data (optional).
Returns:
An instance of ICC_Profile or null if the image contains no ICC profile..
Throws:
ImageReadException
java.io.IOException

getICCProfile

public static java.awt.color.ICC_Profile getICCProfile(java.io.InputStream is,
                                                       java.lang.String filename,
                                                       java.util.Map params)
                                                throws ImageReadException,
                                                       java.io.IOException
Extracts an ICC Profile (if present) from JPEG, PNG, PSD (Photoshop) and TIFF images.

Parameters:
is - InputStream from which to read image data.
filename - Filename associated with image data (optional).
params - Map of optional parameters, defined in SanselanConstants.
Returns:
An instance of ICC_Profile or null if the image contains no ICC profile..
Throws:
ImageReadException
java.io.IOException

getICCProfile

public static java.awt.color.ICC_Profile getICCProfile(java.io.File file)
                                                throws ImageReadException,
                                                       java.io.IOException
Extracts an ICC Profile (if present) from JPEG, PNG, PSD (Photoshop) and TIFF images.

Parameters:
file - File containing image data.
Returns:
An instance of ICC_Profile or null if the image contains no ICC profile..
Throws:
ImageReadException
java.io.IOException

getICCProfile

public static java.awt.color.ICC_Profile getICCProfile(java.io.File file,
                                                       java.util.Map params)
                                                throws ImageReadException,
                                                       java.io.IOException
Extracts an ICC Profile (if present) from JPEG, PNG, PSD (Photoshop) and TIFF images.

Parameters:
file - File containing image data.
params - Map of optional parameters, defined in SanselanConstants.
Returns:
An instance of ICC_Profile or null if the image contains no ICC profile..
Throws:
ImageReadException
java.io.IOException

getICCProfile

protected static java.awt.color.ICC_Profile getICCProfile(ByteSource byteSource,
                                                          java.util.Map params)
                                                   throws ImageReadException,
                                                          java.io.IOException
Throws:
ImageReadException
java.io.IOException

getICCProfileBytes

public static byte[] getICCProfileBytes(byte[] bytes)
                                 throws ImageReadException,
                                        java.io.IOException
Extracts the raw bytes of an ICC Profile (if present) from JPEG, PNG, PSD (Photoshop) and TIFF images.

To parse the result use IccProfileParser or ICC_Profile.getInstance(bytes).

Parameters:
bytes - Byte array containing an image file.
Returns:
A byte array.
Throws:
ImageReadException
java.io.IOException
See Also:
IccProfileParser, ICC_Profile

getICCProfileBytes

public static byte[] getICCProfileBytes(byte[] bytes,
                                        java.util.Map params)
                                 throws ImageReadException,
                                        java.io.IOException
Extracts the raw bytes of an ICC Profile (if present) from JPEG, PNG, PSD (Photoshop) and TIFF images.

To parse the result use IccProfileParser or ICC_Profile.getInstance(bytes).

Parameters:
bytes - Byte array containing an image file.
params - Map of optional parameters, defined in SanselanConstants.
Returns:
A byte array.
Throws:
ImageReadException
java.io.IOException
See Also:
IccProfileParser, ICC_Profile

getICCProfileBytes

public static byte[] getICCProfileBytes(java.io.File file)
                                 throws ImageReadException,
                                        java.io.IOException
Extracts the raw bytes of an ICC Profile (if present) from JPEG, PNG, PSD (Photoshop) and TIFF images.

To parse the result use IccProfileParser or ICC_Profile.getInstance(bytes).

Parameters:
file - File containing image data.
Returns:
A byte array.
Throws:
ImageReadException
java.io.IOException
See Also:
IccProfileParser, ICC_Profile

getICCProfileBytes

public static byte[] getICCProfileBytes(java.io.File file,
                                        java.util.Map params)
                                 throws ImageReadException,
                                        java.io.IOException
Extracts the raw bytes of an ICC Profile (if present) from JPEG, PNG, PSD (Photoshop) and TIFF images.

To parse the result use IccProfileParser or ICC_Profile.getInstance(bytes).

Parameters:
file - File containing image data.
params - Map of optional parameters, defined in SanselanConstants.
Returns:
A byte array.
Throws:
ImageReadException
java.io.IOException
See Also:
IccProfileParser, ICC_Profile

getImageInfo

public static ImageInfo getImageInfo(java.lang.String filename,
                                     byte[] bytes,
                                     java.util.Map params)
                              throws ImageReadException,
                                     java.io.IOException
Parses the "image info" of an image.

"Image info" is a summary of basic information about the image such as: width, height, file format, bit depth, color type, etc.

Not to be confused with "image metadata."

Parameters:
filename - String.
bytes - Byte array containing an image file.
params - Map of optional parameters, defined in SanselanConstants.
Returns:
An instance of ImageInfo.
Throws:
ImageReadException
java.io.IOException
See Also:
ImageInfo

getImageInfo

public static ImageInfo getImageInfo(java.lang.String filename,
                                     byte[] bytes)
                              throws ImageReadException,
                                     java.io.IOException
Parses the "image info" of an image.

"Image info" is a summary of basic information about the image such as: width, height, file format, bit depth, color type, etc.

Not to be confused with "image metadata."

Parameters:
filename - String.
bytes - Byte array containing an image file.
Returns:
An instance of ImageInfo.
Throws:
ImageReadException
java.io.IOException
See Also:
ImageInfo

getImageInfo

public static ImageInfo getImageInfo(java.io.InputStream is,
                                     java.lang.String filename)
                              throws ImageReadException,
                                     java.io.IOException
Parses the "image info" of an image.

"Image info" is a summary of basic information about the image such as: width, height, file format, bit depth, color type, etc.

Not to be confused with "image metadata."

Parameters:
is - InputStream from which to read image data.
filename - Filename associated with image data (optional).
Returns:
An instance of ImageInfo.
Throws:
ImageReadException
java.io.IOException
See Also:
ImageInfo

getImageInfo

public static ImageInfo getImageInfo(java.io.InputStream is,
                                     java.lang.String filename,
                                     java.util.Map params)
                              throws ImageReadException,
                                     java.io.IOException
Parses the "image info" of an image.

"Image info" is a summary of basic information about the image such as: width, height, file format, bit depth, color type, etc.

Not to be confused with "image metadata."

Parameters:
is - InputStream from which to read image data.
filename - Filename associated with image data (optional).
params - Map of optional parameters, defined in SanselanConstants.
Returns:
An instance of ImageInfo.
Throws:
ImageReadException
java.io.IOException
See Also:
ImageInfo

getImageInfo

public static ImageInfo getImageInfo(byte[] bytes)
                              throws ImageReadException,
                                     java.io.IOException
Parses the "image info" of an image.

"Image info" is a summary of basic information about the image such as: width, height, file format, bit depth, color type, etc.

Not to be confused with "image metadata."

Parameters:
bytes - Byte array containing an image file.
Returns:
An instance of ImageInfo.
Throws:
ImageReadException
java.io.IOException
See Also:
ImageInfo

getImageInfo

public static ImageInfo getImageInfo(byte[] bytes,
                                     java.util.Map params)
                              throws ImageReadException,
                                     java.io.IOException
Parses the "image info" of an image.

"Image info" is a summary of basic information about the image such as: width, height, file format, bit depth, color type, etc.

Not to be confused with "image metadata."

Parameters:
bytes - Byte array containing an image file.
params - Map of optional parameters, defined in SanselanConstants.
Returns:
An instance of ImageInfo.
Throws:
ImageReadException
java.io.IOException
See Also:
ImageInfo

getImageInfo

public static ImageInfo getImageInfo(java.io.File file,
                                     java.util.Map params)
                              throws ImageReadException,
                                     java.io.IOException
Parses the "image info" of an image file.

"Image info" is a summary of basic information about the image such as: width, height, file format, bit depth, color type, etc.

Not to be confused with "image metadata."

Parameters:
file - File containing image data.
params - Map of optional parameters, defined in SanselanConstants.
Returns:
An instance of ImageInfo.
Throws:
ImageReadException
java.io.IOException
See Also:
ImageInfo

getImageInfo

public static ImageInfo getImageInfo(java.io.File file)
                              throws ImageReadException,
                                     java.io.IOException
Parses the "image info" of an image file.

"Image info" is a summary of basic information about the image such as: width, height, file format, bit depth, color type, etc.

Not to be confused with "image metadata."

Parameters:
file - File containing image data.
Returns:
An instance of ImageInfo.
Throws:
ImageReadException
java.io.IOException
See Also:
ImageInfo

getImageSize

public static java.awt.Dimension getImageSize(java.io.InputStream is,
                                              java.lang.String filename)
                                       throws ImageReadException,
                                              java.io.IOException
Determines the width and height of an image.

Parameters:
is - InputStream from which to read image data.
filename - Filename associated with image data (optional).
Returns:
The width and height of the image.
Throws:
ImageReadException
java.io.IOException

getImageSize

public static java.awt.Dimension getImageSize(java.io.InputStream is,
                                              java.lang.String filename,
                                              java.util.Map params)
                                       throws ImageReadException,
                                              java.io.IOException
Determines the width and height of an image.

Parameters:
is - InputStream from which to read image data.
filename - Filename associated with image data (optional).
params - Map of optional parameters, defined in SanselanConstants.
Returns:
The width and height of the image.
Throws:
ImageReadException
java.io.IOException

getImageSize

public static java.awt.Dimension getImageSize(byte[] bytes)
                                       throws ImageReadException,
                                              java.io.IOException
Determines the width and height of an image.

Parameters:
bytes - Byte array containing an image file.
Returns:
The width and height of the image.
Throws:
ImageReadException
java.io.IOException

getImageSize

public static java.awt.Dimension getImageSize(byte[] bytes,
                                              java.util.Map params)
                                       throws ImageReadException,
                                              java.io.IOException
Determines the width and height of an image.

Parameters:
bytes - Byte array containing an image file.
params - Map of optional parameters, defined in SanselanConstants.
Returns:
The width and height of the image.
Throws:
ImageReadException
java.io.IOException

getImageSize

public static java.awt.Dimension getImageSize(java.io.File file)
                                       throws ImageReadException,
                                              java.io.IOException
Determines the width and height of an image file.

Parameters:
file - File containing image data.
Returns:
The width and height of the image.
Throws:
ImageReadException
java.io.IOException

getImageSize

public static java.awt.Dimension getImageSize(java.io.File file,
                                              java.util.Map params)
                                       throws ImageReadException,
                                              java.io.IOException
Determines the width and height of an image file.

Parameters:
file - File containing image data.
params - Map of optional parameters, defined in SanselanConstants.
Returns:
The width and height of the image.
Throws:
ImageReadException
java.io.IOException

getImageSize

public static java.awt.Dimension getImageSize(ByteSource byteSource,
                                              java.util.Map params)
                                       throws ImageReadException,
                                              java.io.IOException
Throws:
ImageReadException
java.io.IOException

getXmpXml

public static java.lang.String getXmpXml(java.io.InputStream is,
                                         java.lang.String filename)
                                  throws ImageReadException,
                                         java.io.IOException
Determines the width and height of an image.

Parameters:
is - InputStream from which to read image data.
filename - Filename associated with image data (optional).
Returns:
Xmp Xml as String, if present. Otherwise, returns null..
Throws:
ImageReadException
java.io.IOException

getXmpXml

public static java.lang.String getXmpXml(java.io.InputStream is,
                                         java.lang.String filename,
                                         java.util.Map params)
                                  throws ImageReadException,
                                         java.io.IOException
Determines the width and height of an image.

Parameters:
is - InputStream from which to read image data.
filename - Filename associated with image data (optional).
params - Map of optional parameters, defined in SanselanConstants.
Returns:
Xmp Xml as String, if present. Otherwise, returns null..
Throws:
ImageReadException
java.io.IOException

getXmpXml

public static java.lang.String getXmpXml(byte[] bytes)
                                  throws ImageReadException,
                                         java.io.IOException
Determines the width and height of an image.

Parameters:
bytes - Byte array containing an image file.
Returns:
Xmp Xml as String, if present. Otherwise, returns null..
Throws:
ImageReadException
java.io.IOException

getXmpXml

public static java.lang.String getXmpXml(byte[] bytes,
                                         java.util.Map params)
                                  throws ImageReadException,
                                         java.io.IOException
Determines the width and height of an image.

Parameters:
bytes - Byte array containing an image file.
params - Map of optional parameters, defined in SanselanConstants.
Returns:
Xmp Xml as String, if present. Otherwise, returns null..
Throws:
ImageReadException
java.io.IOException

getXmpXml

public static java.lang.String getXmpXml(java.io.File file)
                                  throws ImageReadException,
                                         java.io.IOException
Extracts embedded XML metadata as XML string.

Parameters:
file - File containing image data.
Returns:
Xmp Xml as String, if present. Otherwise, returns null..
Throws:
ImageReadException
java.io.IOException

getXmpXml

public static java.lang.String getXmpXml(java.io.File file,
                                         java.util.Map params)
                                  throws ImageReadException,
                                         java.io.IOException
Extracts embedded XML metadata as XML string.

Parameters:
file - File containing image data.
params - Map of optional parameters, defined in SanselanConstants.
Returns:
Xmp Xml as String, if present. Otherwise, returns null..
Throws:
ImageReadException
java.io.IOException

getXmpXml

public static java.lang.String getXmpXml(ByteSource byteSource,
                                         java.util.Map params)
                                  throws ImageReadException,
                                         java.io.IOException
Extracts embedded XML metadata as XML string.

Parameters:
file - File containing image data.
params - Map of optional parameters, defined in SanselanConstants.
Returns:
Xmp Xml as String, if present. Otherwise, returns null..
Throws:
ImageReadException
java.io.IOException

getMetadata

public static IImageMetadata getMetadata(byte[] bytes)
                                  throws ImageReadException,
                                         java.io.IOException
Parses the metadata of an image. This metadata depends on the format of the image.

JPEG/JFIF files may contain EXIF and/or IPTC metadata. PNG files may contain comments. TIFF files may contain metadata.

The instance of IImageMetadata returned by getMetadata() should be upcast (depending on image format).

Not to be confused with "image info."

Parameters:
bytes - Byte array containing an image file.
Returns:
An instance of IImageMetadata.
Throws:
ImageReadException
java.io.IOException
See Also:
IImageMetadata

getMetadata

public static IImageMetadata getMetadata(byte[] bytes,
                                         java.util.Map params)
                                  throws ImageReadException,
                                         java.io.IOException
Parses the metadata of an image. This metadata depends on the format of the image.

JPEG/JFIF files may contain EXIF and/or IPTC metadata. PNG files may contain comments. TIFF files may contain metadata.

The instance of IImageMetadata returned by getMetadata() should be upcast (depending on image format).

Not to be confused with "image info."

Parameters:
bytes - Byte array containing an image file.
params - Map of optional parameters, defined in SanselanConstants.
Returns:
An instance of IImageMetadata.
Throws:
ImageReadException
java.io.IOException
See Also:
IImageMetadata

getMetadata

public static IImageMetadata getMetadata(java.io.InputStream is,
                                         java.lang.String filename)
                                  throws ImageReadException,
                                         java.io.IOException
Parses the metadata of an image file. This metadata depends on the format of the image.

JPEG/JFIF files may contain EXIF and/or IPTC metadata. PNG files may contain comments. TIFF files may contain metadata.

The instance of IImageMetadata returned by getMetadata() should be upcast (depending on image format).

Not to be confused with "image info."

Parameters:
is - InputStream from which to read image data.
filename - Filename associated with image data (optional).
Returns:
An instance of IImageMetadata.
Throws:
ImageReadException
java.io.IOException
See Also:
IImageMetadata

getMetadata

public static IImageMetadata getMetadata(java.io.InputStream is,
                                         java.lang.String filename,
                                         java.util.Map params)
                                  throws ImageReadException,
                                         java.io.IOException
Parses the metadata of an image file. This metadata depends on the format of the image.

JPEG/JFIF files may contain EXIF and/or IPTC metadata. PNG files may contain comments. TIFF files may contain metadata.

The instance of IImageMetadata returned by getMetadata() should be upcast (depending on image format).

Not to be confused with "image info."

Parameters:
is - InputStream from which to read image data.
filename - Filename associated with image data (optional).
params - Map of optional parameters, defined in SanselanConstants.
Returns:
An instance of IImageMetadata.
Throws:
ImageReadException
java.io.IOException
See Also:
IImageMetadata

getMetadata

public static IImageMetadata getMetadata(java.io.File file)
                                  throws ImageReadException,
                                         java.io.IOException
Parses the metadata of an image file. This metadata depends on the format of the image.

JPEG/JFIF files may contain EXIF and/or IPTC metadata. PNG files may contain comments. TIFF files may contain metadata.

The instance of IImageMetadata returned by getMetadata() should be upcast (depending on image format).

Not to be confused with "image info."

Parameters:
file - File containing image data.
Returns:
An instance of IImageMetadata.
Throws:
ImageReadException
java.io.IOException
See Also:
IImageMetadata

getMetadata

public static IImageMetadata getMetadata(java.io.File file,
                                         java.util.Map params)
                                  throws ImageReadException,
                                         java.io.IOException
Parses the metadata of an image file. This metadata depends on the format of the image.

JPEG/JFIF files may contain EXIF and/or IPTC metadata. PNG files may contain comments. TIFF files may contain metadata.

The instance of IImageMetadata returned by getMetadata() should be upcast (depending on image format).

Not to be confused with "image info."

Parameters:
file - File containing image data.
params - Map of optional parameters, defined in SanselanConstants.
Returns:
An instance of IImageMetadata.
Throws:
ImageReadException
java.io.IOException
See Also:
IImageMetadata

dumpImageFile

public static java.lang.String dumpImageFile(byte[] bytes)
                                      throws ImageReadException,
                                             java.io.IOException
Returns a description of the image's structure.

Useful for exploring format-specific details of image files.

Parameters:
bytes - Byte array containing an image file.
Returns:
A description of the image file's structure.
Throws:
ImageReadException
java.io.IOException

dumpImageFile

public static java.lang.String dumpImageFile(java.io.File file)
                                      throws ImageReadException,
                                             java.io.IOException
Returns a description of the image file's structure.

Useful for exploring format-specific details of image files.

Parameters:
file - File containing image data.
Returns:
A description of the image file's structure.
Throws:
ImageReadException
java.io.IOException

getFormatCompliance

public static FormatCompliance getFormatCompliance(byte[] bytes)
                                            throws ImageReadException,
                                                   java.io.IOException
Throws:
ImageReadException
java.io.IOException

getFormatCompliance

public static FormatCompliance getFormatCompliance(java.io.File file)
                                            throws ImageReadException,
                                                   java.io.IOException
Throws:
ImageReadException
java.io.IOException

getAllBufferedImages

public static java.util.ArrayList getAllBufferedImages(java.io.InputStream is,
                                                       java.lang.String filename)
                                                throws ImageReadException,
                                                       java.io.IOException
Returns all images contained in an image.

Useful for image formats such as GIF and ICO in which a single file may contain multiple images.

Parameters:
is - InputStream from which to read image data.
filename - Filename associated with image data (optional).
Returns:
A vector of BufferedImages.
Throws:
ImageReadException
java.io.IOException

getAllBufferedImages

public static java.util.ArrayList getAllBufferedImages(byte[] bytes)
                                                throws ImageReadException,
                                                       java.io.IOException
Returns all images contained in an image.

Useful for image formats such as GIF and ICO in which a single file may contain multiple images.

Parameters:
bytes - Byte array containing an image file.
Returns:
A vector of BufferedImages.
Throws:
ImageReadException
java.io.IOException

getAllBufferedImages

public static java.util.ArrayList getAllBufferedImages(java.io.File file)
                                                throws ImageReadException,
                                                       java.io.IOException
Returns all images contained in an image file.

Useful for image formats such as GIF and ICO in which a single file may contain multiple images.

Parameters:
file - File containing image data.
Returns:
A vector of BufferedImages.
Throws:
ImageReadException
java.io.IOException

getBufferedImage

public static java.awt.image.BufferedImage getBufferedImage(java.io.InputStream is)
                                                     throws ImageReadException,
                                                            java.io.IOException
Reads the first image from an InputStream as a BufferedImage.

(TODO: elaborate here.)

Sanselan can only read image info, metadata and ICC profiles from all image formats. However, note that the library cannot currently read or write JPEG image data. PSD (Photoshop) files can only be partially read and cannot be written. All other formats (PNG, GIF, TIFF, BMP, etc.) are fully supported.

Parameters:
is - InputStream to read image data from.
Returns:
A BufferedImage.
Throws:
ImageReadException
java.io.IOException
See Also:
SanselanConstants

getBufferedImage

public static java.awt.image.BufferedImage getBufferedImage(java.io.InputStream is,
                                                            java.util.Map params)
                                                     throws ImageReadException,
                                                            java.io.IOException
Reads the first image from an InputStream as a BufferedImage.

(TODO: elaborate here.)

Sanselan can only read image info, metadata and ICC profiles from all image formats. However, note that the library cannot currently read or write JPEG image data. PSD (Photoshop) files can only be partially read and cannot be written. All other formats (PNG, GIF, TIFF, BMP, etc.) are fully supported.

Parameters:
is - InputStream to read image data from.
params - Map of optional parameters, defined in SanselanConstants.
Returns:
A BufferedImage.
Throws:
ImageReadException
java.io.IOException
See Also:
SanselanConstants

getBufferedImage

public static java.awt.image.BufferedImage getBufferedImage(byte[] bytes)
                                                     throws ImageReadException,
                                                            java.io.IOException
Reads the first image from an image file as a BufferedImage.

(TODO: elaborate here.)

Sanselan can only read image info, metadata and ICC profiles from all image formats. However, note that the library cannot currently read or write JPEG image data. PSD (Photoshop) files can only be partially read and cannot be written. All other formats (PNG, GIF, TIFF, BMP, etc.) are fully supported.

Parameters:
bytes - Byte array containing an image file.
Returns:
A BufferedImage.
Throws:
ImageReadException
java.io.IOException
See Also:
SanselanConstants

getBufferedImage

public static java.awt.image.BufferedImage getBufferedImage(byte[] bytes,
                                                            java.util.Map params)
                                                     throws ImageReadException,
                                                            java.io.IOException
Reads the first image from an image file as a BufferedImage.

(TODO: elaborate here.)

Sanselan can only read image info, metadata and ICC profiles from all image formats. However, note that the library cannot currently read or write JPEG image data. PSD (Photoshop) files can only be partially read and cannot be written. All other formats (PNG, GIF, TIFF, BMP, etc.) are fully supported.

Parameters:
bytes - Byte array containing an image file.
params - Map of optional parameters, defined in SanselanConstants.
Returns:
A BufferedImage.
Throws:
ImageReadException
java.io.IOException
See Also:
SanselanConstants

getBufferedImage

public static java.awt.image.BufferedImage getBufferedImage(java.io.File file)
                                                     throws ImageReadException,
                                                            java.io.IOException
Reads the first image from an image file as a BufferedImage.

(TODO: elaborate here.)

Sanselan can only read image info, metadata and ICC profiles from all image formats. However, note that the library cannot currently read or write JPEG image data. PSD (Photoshop) files can only be partially read and cannot be written. All other formats (PNG, GIF, TIFF, BMP, etc.) are fully supported.

Parameters:
file - File containing image data.
Returns:
A BufferedImage.
Throws:
ImageReadException
java.io.IOException
See Also:
SanselanConstants

getBufferedImage

public static java.awt.image.BufferedImage getBufferedImage(java.io.File file,
                                                            java.util.Map params)
                                                     throws ImageReadException,
                                                            java.io.IOException
Reads the first image from an image file as a BufferedImage.

(TODO: elaborate here.)

Sanselan can only read image info, metadata and ICC profiles from all image formats. However, note that the library cannot currently read or write JPEG image data. PSD (Photoshop) files can only be partially read and cannot be written. All other formats (PNG, GIF, TIFF, BMP, etc.) are fully supported.

Parameters:
file - File containing image data.
params - Map of optional parameters, defined in SanselanConstants.
Returns:
A BufferedImage.
Throws:
ImageReadException
java.io.IOException
See Also:
SanselanConstants

writeImage

public static void writeImage(java.awt.image.BufferedImage src,
                              java.io.File file,
                              ImageFormat format,
                              java.util.Map params)
                       throws ImageWriteException,
                              java.io.IOException
Writes a BufferedImage to a file.

(TODO: elaborate here.)

Sanselan can only read image info, metadata and ICC profiles from all image formats. However, note that the library cannot currently read or write JPEG image data. PSD (Photoshop) files can only be partially read and cannot be written. All other formats (PNG, GIF, TIFF, BMP, etc.) are fully supported.

Parameters:
src - The BufferedImage to be written.
file - File to write to.
format - The ImageFormat to use.
params - Map of optional parameters, defined in SanselanConstants.
Throws:
ImageWriteException
java.io.IOException
See Also:
SanselanConstants

writeImageToBytes

public static byte[] writeImageToBytes(java.awt.image.BufferedImage src,
                                       ImageFormat format,
                                       java.util.Map params)
                                throws ImageWriteException,
                                       java.io.IOException
Writes a BufferedImage to a byte array.

(TODO: elaborate here.)

Sanselan can only read image info, metadata and ICC profiles from all image formats. However, note that the library cannot currently read or write JPEG image data. PSD (Photoshop) files can only be partially read and cannot be written. All other formats (PNG, GIF, TIFF, BMP, etc.) are fully supported.

Parameters:
src - The BufferedImage to be written.
format - The ImageFormat to use.
params - Map of optional parameters, defined in SanselanConstants.
Returns:
A byte array containing the image file.
Throws:
ImageWriteException
java.io.IOException
See Also:
SanselanConstants

writeImage

public static void writeImage(java.awt.image.BufferedImage src,
                              java.io.OutputStream os,
                              ImageFormat format,
                              java.util.Map params)
                       throws ImageWriteException,
                              java.io.IOException
Writes a BufferedImage to an OutputStream.

(TODO: elaborate here.)

Sanselan can only read image info, metadata and ICC profiles from all image formats. However, note that the library cannot currently read or write JPEG image data. PSD (Photoshop) files can only be partially read and cannot be written. All other formats (PNG, GIF, TIFF, BMP, etc.) are fully supported.

Parameters:
src - The BufferedImage to be written.
os - The OutputStream to write to.
format - The ImageFormat to use.
params - Map of optional parameters, defined in SanselanConstants.
Throws:
ImageWriteException
java.io.IOException
See Also:
SanselanConstants


Copyright © 2007-2009. All Rights Reserved.