Vous consultez actuellement l'aide de la version:
- 6.5
- 6.4
- 6.3
- 6.2
- Anciennes versions
ImageMagick is a software plugin to create, edit, compose, or convert bitmap images. It can read and write images in a variety of formats (over 200) including PNG, JPEG, JPEG-2000, GIF, TIFF, DPX, EXR, WebP, Postscript, PDF, and SVG. Use ImageMagick to resize, flip, mirror, rotate, distort, shear and transform images, adjust image colors, apply various special effects, or draw text, lines, polygons, ellipses and curves.
You can use ImageMagick features from the Adobe Experience Manager (AEM) command-line based media handler to process images.
Multiple versions of ImageMagic binaries are available for various operating systems. Depending upon on your, download the appropriate version of the installation files and install them on your local system.
-
Download the appropriate ImageMagick installation files for your operating system.
The following example shows you how to set up the command line process step so that every time an asset with the mime-type gif or tiff is added to /content/dam on the AEM server, a flipped image of the original is created together with three additional thumbnails (140x100, 48x48 and 10x250).
-
To see if the tool is installed properly, run the following command convert -h on the command line.
It displays a help screen with all the possible options of the convert tool.
Remarque :
In some versions of Windows (for example Windows SE), the convert command may fail to run because it conflicts with the native convert utility that is part of Windows installation. In this case, mention the complete path for the ImageMagick utility used to convert image files to thumbnails. For example, "C:\Program Files\ImageMagick-6.8.9-Q16\convert.exe" -define jpeg:size=319x319 ${filename} -thumbnail 319x319 cq5dam.thumbnail.319.319.png.
This section describes how to set the Process Arguments of the CommandLineProcess.
The values of the Process Arguments must be separated by a comma and must not start with a whitespace.
Argument-Format | Description |
mime:<mime-type> | Optional argument. The process is applied if the asset has the same mime-type as the one of the argument. Several mime-types can be defined. |
tn:<width>:<heigth> | Optional argument. The process creates a thumbnail with the dimensions defined in the argument. Several thumbnails can be defined. |
cmd: <command> |
Defines the command that will be executed. The syntax depends on the command line tool. Only one command can be defined. The following variables can be used to create the command: ${filename}: name of the input file, e.g. original.jpg |
For example, if ImageMagick is installed on the disk hosting the AEM server and if you create a process step using CommandLineProcess as Implementation and the following values as Process Arguments:
mime:image/gif,mime:image/tiff,tn:140:100,tn:48:48,tn:10:250,cmd:convert ${directory}/${filename} -flip ${directory}/${basename}.flipped.jpg
then, when the workflow runs, the step only applies to assets that have image/gif or mime:image/tiff as mime-types, it creates a flipped image of the original, converts it into .jpg and creates three thumbnails that have the dimensions: 140x100, 48x48 and 10x250.
Use the following Process Arguments to create the three standard thumbnails using ImageMagick:
mime:image/tiff,mime:image/png,mime:image/bmp,mime:image/gif,mime:image/jpeg,cmd:convert ${filename} -define jpeg:size=319x319 -thumbnail "319x319>" -background transparent -gravity center -extent 319x319 -write png:cq5dam.thumbnail.319.319.png -thumbnail "140x100>" -background transparent -gravity center -extent 140x100 -write cq5dam.thumbnail.140.100.png -thumbnail "48x48>" -background transparent -gravity center -extent 48x48 cq5dam.thumbnail.48.48.png
Use the following Process Arguments to create the web-enabled rendition using ImageMagick:
mime:image/tiff,mime:image/png,mime:image/bmp,mime:image/gif,mime:image/jpeg,cmd:convert ${filename} -define jpeg:size=1280x1280 -thumbnail "1280x1280>" cq5dam.web.1280.1280.jpeg
Remarque :
The CommandLineProcess step only applies to Assets (nodes of type dam:Asset) or descendants of an Asset.
There are multiple vulnerabilities associated with using ImageMagick to process images. For example, processing user submitted images involves the risk of remote code execution (RCE).
In addition, a number of image processing plugins depend on the ImageMagick library, including, but not limited to, PHP’s imagick, Ruby’s rmagick and paperclip, and nodejs’s imagemagick.
If you use ImageMagick or an affected library, Adobe recommend that you mitigate the known vulnerabilities by doing at least one of the following (but preferably both):
-
Verify that all image files begin with the expected "magic bytes" corresponding to the image file types you support before sending them to ImageMagick for processing.