adams.core
Class ImageMagickHelper

java.lang.Object
  extended by adams.core.ImageMagickHelper

public class ImageMagickHelper
extends Object

Helper class for ImageMagick (http://www.imagemagick.org/).

Version:
$Revision: 5258 $
Author:
fracpete (fracpete at waikato dot ac dot nz)

Field Summary
static String ENV_PATH
          the environment variable to check.
protected static Boolean m_ConvertPresent
          whether "convert" is present.
 
Constructor Summary
ImageMagickHelper()
           
 
Method Summary
protected static String getMissingCommandErrorMessage(String cmd)
          Returns a standard error message if specifiec command is not available.
static String getMissingConvertErrorMessage()
          Returns a standard error message if "convert" is not available.
static boolean isConvertAvailable()
          Checks whether the "convert" utility is available.
static BufferedImage read(File file)
          Reads a BufferedImage from the file.
static BufferedImage read(InputStream stream)
          Reads a BufferedImage from the stream.
static BufferedImage read(URL url)
          Reads a BufferedImage from a URL.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ENV_PATH

public static final String ENV_PATH
the environment variable to check.

See Also:
Constant Field Values

m_ConvertPresent

protected static Boolean m_ConvertPresent
whether "convert" is present.

Constructor Detail

ImageMagickHelper

public ImageMagickHelper()
Method Detail

isConvertAvailable

public static boolean isConvertAvailable()
Checks whether the "convert" utility is available.

Returns:
true if "convert" is available (on PATH)

getMissingCommandErrorMessage

protected static String getMissingCommandErrorMessage(String cmd)
Returns a standard error message if specifiec command is not available.

Parameters:
cmd - the command to use in error message, e.g., "convert"
Returns:
the error message

getMissingConvertErrorMessage

public static String getMissingConvertErrorMessage()
Returns a standard error message if "convert" is not available.

Returns:
the error message

read

public static BufferedImage read(File file)
Reads a BufferedImage from the file.

Parameters:
file - the file to read the image from
Returns:
the image, null in case of an error

read

public static BufferedImage read(URL url)
Reads a BufferedImage from a URL.

Parameters:
url - the URL to read the image from
Returns:
the image, null in case of an error

read

public static BufferedImage read(InputStream stream)
Reads a BufferedImage from the stream. Caller must close stream explicitly.

Parameters:
stream - the stream to read the image from
Returns:
the image, null in case of an error


Copyright © 2012 University of Waikato, Hamilton, NZ. All Rights Reserved.