Class GraphicsMagickCommandUtils

java.lang.Object
org.onehippo.forge.gallerymagick.core.command.GraphicsMagickCommandUtils

public class GraphicsMagickCommandUtils extends Object
Utility to run Graphics Magick Commands.
  • Method Details

    • identifyAllMetadata

      public static String identifyAllMetadata(File sourceFile) throws MagickExecuteException, IOException
      Execute identify -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 occurs
      IOException - if IO exception occurs
    • identifyDimension

      public static ImageDimension identifyDimension(File sourceFile) throws MagickExecuteException, IOException
      Execute identify sub-command and return an ImageDimension instance from the output.
      Parameters:
      sourceFile - source image file
      Returns:
      Execute identify sub-command and return an ImageDimension instance from the output
      Throws:
      MagickExecuteException - if execution exception occurs
      IOException - if IO exception occurs
    • resizeImage

      public static void resizeImage(File sourceFile, File targetFile, ImageDimension dimension) throws MagickExecuteException, IOException
      Resize the given image sourceFile with resizing it to width and height and store the resized image to targetFile.
      Parameters:
      sourceFile - source image file
      targetFile - target image file
      dimension - image dimension
      Throws:
      MagickExecuteException - if execution exception occurs
      IOException - if IO exception occurs
    • resizeImage

      public static void resizeImage(File sourceFile, File targetFile, ImageDimension dimension, String... extraOptions) throws MagickExecuteException, IOException
      Resize the given image sourceFile with resizing it to width and height and store the resized image to targetFile, with appending extraOptions in the command line if provided.
      Parameters:
      sourceFile - source image file
      targetFile - target image file
      dimension - image dimension
      extraOptions - extra command line options
      Throws:
      MagickExecuteException - if execution exception occurs
      IOException - if IO exception occurs