com.flexive.shared.media.impl
Class FxMediaImageMagickEngine

java.lang.Object
  extended by com.flexive.shared.media.impl.FxMediaImageMagickEngine

public class FxMediaImageMagickEngine
extends java.lang.Object

ImageMagick media engine

Version:
$Rev: 655 $
Author:
Markus Plesser (markus.plesser@flexive.com), UCS - unique computing solutions gmbh (http://www.ucs.at)

Field Summary
static java.lang.String CONVERT_BINARY
           
static java.lang.String IDENTIFY_BINARY
           
static boolean IM_AVAILABLE
           
static boolean IM_IDENTIFY_POSSIBLE
           
static int IM_MAJOR
           
static int IM_MINOR
           
static int IM_SUB
           
static java.lang.String IM_VERSION
           
(package private) static java.util.regex.Pattern pColormap
           
(package private) static java.util.regex.Pattern pNumeric
           
 
Constructor Summary
FxMediaImageMagickEngine()
           
 
Method Summary
static int[] getPingDimensions(java.lang.String extension, java.lang.String line)
          Parse a ping response from ImageMagick for image dimensions
static java.lang.String parse(java.io.InputStream in)
          Parse an identify stdOut result (from in) and convert it to an XML content
static int[] scale(java.io.File original, java.io.File scaled, java.lang.String extension, int width, int height)
          Scale an image and return the dimensions (width and height) as int array
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

IM_AVAILABLE

public static final boolean IM_AVAILABLE

IM_IDENTIFY_POSSIBLE

public static final boolean IM_IDENTIFY_POSSIBLE

IM_VERSION

public static final java.lang.String IM_VERSION

IM_MAJOR

public static final int IM_MAJOR

IM_MINOR

public static final int IM_MINOR

IM_SUB

public static final int IM_SUB

IDENTIFY_BINARY

public static final java.lang.String IDENTIFY_BINARY
See Also:
Constant Field Values

CONVERT_BINARY

public static final java.lang.String CONVERT_BINARY
See Also:
Constant Field Values

pNumeric

static java.util.regex.Pattern pNumeric

pColormap

static java.util.regex.Pattern pColormap
Constructor Detail

FxMediaImageMagickEngine

public FxMediaImageMagickEngine()
Method Detail

scale

public static int[] scale(java.io.File original,
                          java.io.File scaled,
                          java.lang.String extension,
                          int width,
                          int height)
                   throws FxApplicationException
Scale an image and return the dimensions (width and height) as int array

Parameters:
original - original file
scaled - scaled file
extension - extension
width - desired width
height - desired height
Returns:
actual width ([0]) and height ([1]) of scaled image
Throws:
FxApplicationException - on errors

getPingDimensions

public static int[] getPingDimensions(java.lang.String extension,
                                      java.lang.String line)
Parse a ping response from ImageMagick for image dimensions

Parameters:
extension - extension of the file
line - the response from ImageMagick's ping command
Returns:
array containing dimensions or {0,0} if an error occured

parse

public static java.lang.String parse(java.io.InputStream in)
                              throws javax.xml.stream.XMLStreamException,
                                     java.io.IOException
Parse an identify stdOut result (from in) and convert it to an XML content

Parameters:
in - identify response
Returns:
XML content
Throws:
javax.xml.stream.XMLStreamException - on errors
java.io.IOException - on errors