org.mmbase.util.images
Class ImageMagickImageConverter
java.lang.Object
org.mmbase.util.images.AbstractImageConverter
org.mmbase.util.images.ImageMagickImageConverter
- All Implemented Interfaces:
- ImageConverter
public class ImageMagickImageConverter
- extends AbstractImageConverter
- implements ImageConverter
Converts images using ImageMagick.
- Version:
- $Id: ImageMagickImageConverter.java 44572 2011-01-06 08:56:39Z michiel $
- Author:
- Rico Jansen, Michiel Meeuwissen, Nico Klasens, Jaco de Groot
IM_VERSION_PATTERN
static final Pattern IM_VERSION_PATTERN
method
protected CommandExecutor.Method method
host
protected String host
port
protected int port
excludeFormats
protected Set<String> excludeFormats
validFormats
final Set<String> validFormats
ImageMagickImageConverter
public ImageMagickImageConverter()
init
public void init(Map<String,String> params)
- This function initializes this class
- Specified by:
init in interface ImageConverter- Overrides:
init in class AbstractImageConverter
- Parameters:
params - a Map of Strings containing information, this should contain the key's
ImageConvert.ConverterRoot and ImageConvert.ConverterCommand specifying the converter root, and it can also contain
ImageConvert.DefaultImageFormat which can also be 'asis'.- See Also:
ImageConverter.init(java.util.Map)
isMinimumVersion
public boolean isMinimumVersion(int major,
int minor,
int patch)
- Test whether the current version of ImageMagick is at least a certain version.
- Parameters:
major - minimum major version numberminor - minimum minor version number within the major versionpatch - minimum patch version number within the minor version
- Returns:
true if the version is equal to or later than major.minor.patch- Since:
- MMBase-1.9.2
convertImage
public long convertImage(InputStream input,
String sourceFormat,
OutputStream out,
List<String> commands)
throws IOException
- This functions converts an image by the given parameters
- Specified by:
convertImage in interface ImageConverter- Overrides:
convertImage in class AbstractImageConverter
- Parameters:
input - an array of byte which represents the original imagesourceFormat - original image formatcommands - a List of Strings containing commands which are operations on the image which will be returned.
ImageConvert.converterRoot and ImageConvert.converterCommand specifying the converter root....out - stream of bytes containing the new converted image.
- Returns:
- The number of bytes produces
- Throws:
IOException - When an error occurs when converting the image- See Also:
ImageConverter.convertImage(java.io.InputStream, java.lang.String, java.io.OutputStream, java.util.List)
isAnimated
protected boolean isAnimated(InputStream inp)
color
protected String color(String c)
- Translates MMBase color format (without #) to an convert color format (with or without);
- Parameters:
c - color to convert
- Returns:
- converted color
toString
public String toString()
- Overrides:
toString in class Object
main
public static void main(String[] args)
throws Exception
- Throws:
Exception
MMBase2 Resources 2.0-SNAPSHOT - 2013-03-30T06:37