Class GraphicsMagickCommandUtils
java.lang.Object
org.onehippo.forge.gallerymagick.core.command.GraphicsMagickCommandUtils
Utility to run Graphics Magick Commands.
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
identifyAllMetadata
(File sourceFile) Executeidentify -verbose
sub-command and return a string of all extracted metadata from the output.static ImageDimension
identifyDimension
(File sourceFile) Executeidentify
sub-command and return anImageDimension
instance from the output.static void
resizeImage
(File sourceFile, File targetFile, ImageDimension dimension) Resize the given imagesourceFile
with resizing it towidth
andheight
and store the resized image totargetFile
.static void
resizeImage
(File sourceFile, File targetFile, ImageDimension dimension, String... extraOptions) Resize the given imagesourceFile
with resizing it towidth
andheight
and store the resized image totargetFile
, with appendingextraOptions
in the command line if provided.
-
Method Details
-
identifyAllMetadata
public static String identifyAllMetadata(File sourceFile) throws MagickExecuteException, IOException Executeidentify -verbose
sub-command and return a string of all extracted metadata from the output.- Parameters:
sourceFile
- source image file- Returns:
- Execute
identify -verbose
sub-command and return a string of all extracted metadata from the output - Throws:
MagickExecuteException
- if execution exception occursIOException
- if IO exception occurs
-
identifyDimension
public static ImageDimension identifyDimension(File sourceFile) throws MagickExecuteException, IOException Executeidentify
sub-command and return anImageDimension
instance from the output.- Parameters:
sourceFile
- source image file- Returns:
- Execute
identify
sub-command and return anImageDimension
instance from the output - Throws:
MagickExecuteException
- if execution exception occursIOException
- if IO exception occurs
-
resizeImage
public static void resizeImage(File sourceFile, File targetFile, ImageDimension dimension) throws MagickExecuteException, IOException Resize the given imagesourceFile
with resizing it towidth
andheight
and store the resized image totargetFile
.- Parameters:
sourceFile
- source image filetargetFile
- target image filedimension
- image dimension- Throws:
MagickExecuteException
- if execution exception occursIOException
- if IO exception occurs
-
resizeImage
public static void resizeImage(File sourceFile, File targetFile, ImageDimension dimension, String... extraOptions) throws MagickExecuteException, IOException Resize the given imagesourceFile
with resizing it towidth
andheight
and store the resized image totargetFile
, with appendingextraOptions
in the command line if provided.- Parameters:
sourceFile
- source image filetargetFile
- target image filedimension
- image dimensionextraOptions
- extra command line options- Throws:
MagickExecuteException
- if execution exception occursIOException
- if IO exception occurs
-