org.onehippo.forge.gallerymagick.core.command.ScalrProcessorUtils
utility class
provides a pure Java based image identifying/resizing solution.
The following example simply uses ScalrProcessorUtils
to generate
a thumbnail image from the source image file with dimension, 120x120
.
File sourceFile = new File("hippo.jpg"); File targetFile = new File("hippo-thumbnail.jpg"); ScalrProcessorUtils.resizeImage(sourceFile, targetFile, ImageDimension.from("120x120"));
The following example simply uses GraphicsMagickCommandUtils
to generate
a thumbnail image from the source image file with dimension, 120x120
.
File sourceFile = new File("hippo.jpg"); File targetFile = new File("hippo-thumbnail.jpg"); GraphicsMagickCommandUtils.resizeImage(sourceFile, targetFile, ImageDimension.from("120x120"), "+profile", "*");
This example is equivalent to executing the following GraphicsMagick command:
$ gm convert hippo.jpg -resize 120x120 +profile "*" hippo-thumbnail.jpg
Please refer to the Convert
manual of GraphicsMagick utilities
for details.
Also, for more control, you may use GraphicsMagickCommand instead of this utility class. See a unit test, GraphicsMagickCommandTest for an example on how to use the command class directly.
The following example simply uses ImageMagickCommandUtils
to generate
a thumbnail image from the source image file with dimension, 120x120
.
File sourceFile = new File("hippo.jpg"); File targetFile = new File("hippo-thumbnail.jpg"); ImageMagickCommandUtils.resizeImage(sourceFile, targetFile, ImageDimension.from("120x120"), "+profile", "*");
This example is equivalent to executing the following ImageMagick command:
$ convert hippo.jpg -resize 120x120 +profile "*" hippo-thumbnail.jpg
Please refer to the ImageMagick: Command-line Processing for details.
Also, for more control, you may use ImageMagickCommand instead of this utility class. See a unit test, ImageMagickCommandTest for an example on how to use the command class directly.