public class ImageProcessor extends Object
| Constructor and Description |
|---|
ImageProcessor(File sourceFile,
File targetFile)
Creates a new
ImageProcessor |
ImageProcessor(File sourceFile,
File targetFile,
boolean checkMagicBytes)
Creates a new
ImageProcessor |
ImageProcessor(File imageMagickPath,
File sourceFile,
File targetFile)
Creates a new
ImageProcessor |
ImageProcessor(File imageMagickPath,
File sourceFile,
File targetFile,
boolean checkMagicBytes)
Creates a new
ImageProcessor |
| Modifier and Type | Method and Description |
|---|---|
ImageProcessor |
autoCrop(int positionWidth,
int positionHeight,
int sourceWidth,
int sourceHeight)
TODO doc
|
ImageProcessor |
autoCrop(int positionWidth,
int positionHeight,
int variantWidth,
int variantHeight,
int variantOffsetWidth,
int variantOffsetHeight)
TODO doc
|
ImageProcessor |
crop(int targetWidth,
int targetHeight,
int offsetWidth,
int offsetHeight)
Adds a crop-option to the
convert-command.
|
ImageProcessor |
fitToHeight(Integer maxHeight)
Fits the image to the given maximum height using
resize(int, int). |
ImageProcessor |
fitToWidth(Integer maxWidth)
Fits the image to the given maximum width using
resize(int, int). |
ImageProcessor |
fitToWidthAndHeight(int maxwidth,
int maxHeight)
Fits the image to the given maximum width and height using
resize(int, int). |
File |
getImage()
Executes the convert-command with all the previously applied options and returns the target-file this
ImageProcessor was created with. |
ImageMetaData |
getMetaData()
Retrieves the
ImageMetaData for the source-file. |
org.im4java.core.IMOperation |
getOp() |
static boolean |
isImageMagickPresent(File imageMagickPath)
Checks whether the ImageMagick convert-command is available.
|
ImageProcessor |
quality(double quality)
Adds a quality-option to the
convert-command.
|
ImageProcessor |
resize(int targetWidth,
int targetHeight)
Adds a resize-option to the
convert-command.
|
ImageProcessor |
resize(int targetWidth,
int targetHeight,
boolean scaleUp)
Adds a resize-option to the
convert-command.
|
ImageProcessor |
rotate(int degrees)
Adds a rotate-option to the
convert-command.
|
static void |
setGlobalSearchPath(File imageMagickPath)
Sets the global search path to the convert-command
|
ImageProcessor |
strip()
Adds a strip-option to the
convert-command.
|
public ImageProcessor(File imageMagickPath, File sourceFile, File targetFile)
ImageProcessorimageMagickPath - the path to the convert-command, if null the system path is being usedsourceFile - the source filetargetFile - the target filepublic ImageProcessor(File imageMagickPath, File sourceFile, File targetFile, boolean checkMagicBytes) throws IOException
ImageProcessorimageMagickPath - the path to the convert-command, if null the system path is being usedsourceFile - the source filetargetFile - the target filecheckMagicBytes - whether or not it should be checked that the source file's extension matches it's content type, using
magic byte detectionIOException - if checkMagicBytes is true and the source file's extension does not match it's
content type determined by magic byte detectionpublic ImageProcessor(File sourceFile, File targetFile)
ImageProcessorsourceFile - the source filetargetFile - the target filepublic ImageProcessor(File sourceFile, File targetFile, boolean checkMagicBytes) throws IOException
ImageProcessorsourceFile - the source filetargetFile - the target filecheckMagicBytes - whether or not it should be checked that the source file's extension matches it's content type, using
magic byte detectionIOException - if checkMagicBytes is true and the source file's extension does not match it's
content type determined by magic byte detectionpublic static boolean isImageMagickPresent(File imageMagickPath)
imageMagickPath - the path to the convert-command, if null the system path is being usedtrue if the convert-command is available, false otherwisesetGlobalSearchPath(File)public static void setGlobalSearchPath(File imageMagickPath)
imageMagickPath - the path to the convert-command, may not be nullpublic ImageMetaData getMetaData() throws IOException
ImageMetaData for the source-file.ImageMetaDataIOException - if the source-file could not be readpublic ImageProcessor rotate(int degrees)
degrees - the degreesImageProcessorpublic ImageProcessor resize(int targetWidth, int targetHeight, boolean scaleUp)
targetWidth - the target width, must be greater 0targetHeight - the target height, must be greater 0scaleUp - set to true if the image should be scaled up (in case its dimensions are smaller than the
desired ones).ImageProcessorresize(int, int)public ImageProcessor resize(int targetWidth, int targetHeight)
targetWidth - the target width, must be greater 0targetHeight - the target height, must be greater 0ImageProcessorpublic ImageProcessor quality(double quality)
quality - the qualityImageProcessorpublic ImageProcessor strip()
ImageProcessorpublic ImageProcessor autoCrop(int positionWidth, int positionHeight, int sourceWidth, int sourceHeight)
positionWidth - positionHeight - sourceWidth - sourceHeight - ImageProcessorpublic ImageProcessor autoCrop(int positionWidth, int positionHeight, int variantWidth, int variantHeight, int variantOffsetWidth, int variantOffsetHeight)
positionWidth - positionHeight - variantWidth - variantHeight - variantOffsetWidth - variantOffsetHeight - ImageProcessorpublic ImageProcessor crop(int targetWidth, int targetHeight, int offsetWidth, int offsetHeight)
targetWidth - the width of the cuttingtargetHeight - the height of the cuttingoffsetWidth - the width-offset to start cropping at.offsetHeight - the height-offset to start cropping at.ImageProcessorpublic File getImage() throws IOException
ImageProcessor was created with.ImageProcessor was created withIOException - if something goes wrong while executing the convert-commandpublic ImageProcessor fitToWidthAndHeight(int maxwidth, int maxHeight) throws IOException
resize(int, int). No upscaling is done here,
the aspect ratio is being kept.maxwidth - the maximum width of the imagemaxHeight - the maximum height of the imageImageProcessorIOException - if no ImageMetaData could be obtained from the source fileresize(int, int)public ImageProcessor fitToWidth(Integer maxWidth) throws IOException
resize(int, int). No upscaling is done here, the aspect
ratio is being kept.maxWidth - the maximum width of the imageImageProcessorIOException - if no ImageMetaData could be obtained from the source fileresize(int, int)public ImageProcessor fitToHeight(Integer maxHeight) throws IOException
resize(int, int). No upscaling is done here, the aspect
ratio is being kept.maxHeight - the maximum height of the imageImageProcessorIOException - if no ImageMetaData could be obtained from the source fileresize(int, int)public org.im4java.core.IMOperation getOp()
Copyright © 2011–2018 aiticon GmbH. All rights reserved.