The im4java Library, Version 1.4.0

org.im4java.core
Class Info

java.lang.Object
  extended by org.im4java.core.Info

public class Info
extends java.lang.Object

This class implements an image-information object. The one-argument constructor expects a filename and parses the output of the "identify -verbose" command to create a hashtable of properties. This is the so called complete information. The two-argument constructor has a boolean flag as second argument. If you pass true, the Info-object only creates a set of so called basic information. This is more efficient since only a subset of the attributes of the image are requested and parsed.

Since the output of "identify -verbose" is meant as a human-readable interface and not for parsing, this class is inherently flawed. This implementation interprets every line with a colon as a key-value-pair. This is not necessarely correct, e.g. the comment-field could be multi-line with colons within the comment.

An alternative to the Info-class is to use the exiftool-command and the wrapper for it provided by im4java.

Since:
0.95
Version:
$Revision: 1.15 $
Author:
$Author: bablokb $

Constructor Summary
Info(java.lang.String pImage)
          This contstructor will automatically parse the full output of identify -verbose.
Info(java.lang.String pImage, boolean basic)
          This constructor creates an Info-object with basic or complete image-information (depending on the second argument).
Info(java.lang.String pImage, java.io.InputStream pInput)
          This contstructor will automatically parse the full output of identify -verbose.
Info(java.lang.String pImage, java.io.InputStream pInput, boolean basic)
          This constructor creates an Info-object with basic or complete image-information (depending on the third argument).
 
Method Summary
 java.lang.String getImageClass()
          Return the image class.
 java.lang.String getImageClass(int pSceneNr)
          Return the image class for the given scene.
 int getImageDepth()
          Return the image depth.
 int getImageDepth(int pSceneNr)
          Return the image depth.
 java.lang.String getImageFormat()
          Return the image format.
 java.lang.String getImageFormat(int pSceneNr)
          Return the image format for the given scene.
 java.lang.String getImageGeometry()
          Return the image geometry.
 java.lang.String getImageGeometry(int pSceneNr)
          Return the image geometry for the given scene.
 int getImageHeight()
          Return the image height.
 int getImageHeight(int pSceneNr)
          Return the image height for the given scene.
 int getImageWidth()
          Return the image width.
 int getImageWidth(int pSceneNr)
          Return the image width for the given scene.
 java.lang.String getPageGeometry()
          Return the page geometry.
 java.lang.String getPageGeometry(int pSceneNr)
          Return the page geometry for the given scene.
 int getPageHeight()
          Return the page height.
 int getPageHeight(int pSceneNr)
          Return the page height for the given scene.
 int getPageWidth()
          Return the page width.
 int getPageWidth(int pSceneNr)
          Return the page width for the given scene.
 java.lang.String getProperty(java.lang.String pPropertyName)
          Return the given property.
 java.lang.String getProperty(java.lang.String pPropertyName, int pSceneNr)
          Return the given property of the given scene.
 java.util.Enumeration<java.lang.String> getPropertyNames()
          Return an enumeration of all properties.
 int getSceneCount()
          Return the number of scenes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Info

public Info(java.lang.String pImage)
     throws InfoException
This contstructor will automatically parse the full output of identify -verbose.

Parameters:
pImage - Source image
Throws:
InfoException
Since:
0.95

Info

public Info(java.lang.String pImage,
            java.io.InputStream pInput)
     throws InfoException
This contstructor will automatically parse the full output of identify -verbose. This version of the constructor expects an InputStream as an additional parameter. The source image-name should be either "-" or "format:-".

Parameters:
pImage - Name of the source-image
pInput - Image provided as an InputStream
Throws:
InfoException
Since:
1.4.0

Info

public Info(java.lang.String pImage,
            boolean basic)
     throws InfoException
This constructor creates an Info-object with basic or complete image-information (depending on the second argument).

Parameters:
pImage - Source image
basic - Set to true for basic information, to false for complete info
Throws:
InfoException
Since:
1.2.0

Info

public Info(java.lang.String pImage,
            java.io.InputStream pInput,
            boolean basic)
     throws InfoException
This constructor creates an Info-object with basic or complete image-information (depending on the third argument). This version of the constructor expects an InputStream as an additional parameter. The source image-name should be either "-" or "format:-".

Parameters:
pImage - Source image
basic - Set to true for basic information, to false for complete info
pInput - Image provided as an InputStream
Throws:
InfoException
Since:
1.4.0
Method Detail

getImageFormat

public java.lang.String getImageFormat()
Return the image format.


getImageFormat

public java.lang.String getImageFormat(int pSceneNr)
Return the image format for the given scene.

Parameters:
pSceneNr - Scene-number (zero-based)
Since:
1.3.0

getImageWidth

public int getImageWidth()
                  throws InfoException
Return the image width.

Throws:
InfoException

getImageWidth

public int getImageWidth(int pSceneNr)
                  throws InfoException
Return the image width for the given scene.

Parameters:
pSceneNr - Scene-number (zero-based)
Throws:
InfoException
Since:
1.3.0

getImageHeight

public int getImageHeight()
                   throws InfoException
Return the image height.

Throws:
InfoException

getImageHeight

public int getImageHeight(int pSceneNr)
                   throws InfoException
Return the image height for the given scene.

Parameters:
pSceneNr - Scene-number (zero-based)
Throws:
InfoException
Since:
1.3.0

getImageGeometry

public java.lang.String getImageGeometry()
Return the image geometry.


getImageGeometry

public java.lang.String getImageGeometry(int pSceneNr)
Return the image geometry for the given scene.

Parameters:
pSceneNr - Scene-number (zero-based)
Since:
1.3.0

getImageDepth

public int getImageDepth()
                  throws InfoException
Return the image depth. Note that this method just returns an integer (e.g. 8 or 16), and not a string ("8-bit") like getProperty("Depth") does.

Throws:
InfoException
Since:
1.3.0

getImageDepth

public int getImageDepth(int pSceneNr)
                  throws InfoException
Return the image depth. Note that this method just returns an integer (e.g. 8 or 16), and not a string ("8-bit") like getProperty("Depth") does.

Parameters:
pSceneNr - Scene-number (zero-based)
Throws:
InfoException
Since:
1.3.0

getImageClass

public java.lang.String getImageClass()
Return the image class.


getImageClass

public java.lang.String getImageClass(int pSceneNr)
Return the image class for the given scene.

Parameters:
pSceneNr - Scene-number (zero-based)
Since:
1.3.0

getPageWidth

public int getPageWidth()
                 throws InfoException
Return the page width.

Throws:
InfoException
Since:
1.3.0

getPageWidth

public int getPageWidth(int pSceneNr)
                 throws InfoException
Return the page width for the given scene.

Parameters:
pSceneNr - Scene-number (zero-based)
Throws:
InfoException
Since:
1.3.0

getPageHeight

public int getPageHeight()
                  throws InfoException
Return the page height.

Throws:
InfoException
Since:
1.3.0

getPageHeight

public int getPageHeight(int pSceneNr)
                  throws InfoException
Return the page height for the given scene.

Parameters:
pSceneNr - Scene-number (zero-based)
Throws:
InfoException
Since:
1.3.0

getPageGeometry

public java.lang.String getPageGeometry()
Return the page geometry.

Since:
1.3.0

getPageGeometry

public java.lang.String getPageGeometry(int pSceneNr)
Return the page geometry for the given scene.

Parameters:
pSceneNr - Scene-number (zero-based)
Since:
1.3.0

getProperty

public java.lang.String getProperty(java.lang.String pPropertyName)
Return the given property.


getProperty

public java.lang.String getProperty(java.lang.String pPropertyName,
                                    int pSceneNr)
Return the given property of the given scene.

Parameters:
pPropertyName - Name of the property
pSceneNr - Scene-number (zero-based)
Since:
1.3.0

getSceneCount

public int getSceneCount()
Return the number of scenes.

Since:
1.3.0

getPropertyNames

public java.util.Enumeration<java.lang.String> getPropertyNames()
Return an enumeration of all properties.


The im4java Library, Version 1.4.0

Released under the LGPL, (c) Bernhard Bablok 2008-2010
Homepage: http://im4java.sourceforge.net/