ImageMagick
ImageMagick is a collection of tools and libraries for many image formats (over 200). Supported formats include PNG, JPEG, GIF, WebP, HEIC, SVG, PDF, DPX, EXR and TIFF.[1]
Installation
USE flags
USE flags for media-gfx/imagemagick A collection of tools and libraries for many image formats
+cxx
|
Build support for C++ (bindings, extra libraries, code generation, ...) |
+png
|
Add support for libpng (PNG images) |
X
|
Add support for X11 |
bzip2
|
Enable bzip2 compression support |
corefonts
|
Use media-fonts/corefonts which is required by some commands |
djvu
|
Support DjVu, a PDF-like document format esp. suited for scanned documents |
fftw
|
Use FFTW library for computing Fourier transforms |
fontconfig
|
Support for configuring and customizing font access via media-libs/fontconfig |
fpx
|
Enable media-libs/libfpx support |
graphviz
|
Add support for the Graphviz library |
hardened
|
Activate default security enhancements for toolchain (gcc, glibc, binutils) |
hdri
|
Enable High Dynamic Range Images formats |
heif
|
Enable support for ISO/IEC 23008-12:2017 HEIF/HEIC image format |
jbig
|
Enable jbig-kit support for tiff, Hylafax, ImageMagick, etc |
jpeg
|
Add JPEG image support |
jpeg2k
|
Support for JPEG 2000, a wavelet-based image compression format |
jpegxl
|
Add JPEG XL image support |
lcms
|
Add lcms support (color management engine) |
lqr
|
Enable experimental liquid rescale support using media-libs/liblqr |
lzma
|
Support for LZMA compression algorithm |
opencl
|
Enable OpenCL support (computation on GPU) |
openexr
|
Support for the OpenEXR graphics file format |
openmp
|
Build support for the OpenMP (support parallel computing), requires >=sys-devel/gcc-4.2 built with USE="openmp" |
pango
|
Enable Pango support using x11-libs/pango |
perl
|
Add optional support/bindings for the Perl language |
postscript
|
Enable support for the PostScript language (often with ghostscript-gpl or libspectre) |
q32
|
Set quantum depth value to 32 |
q8
|
Set quantum depth value to 8 |
raw
|
Add support for raw image formats |
static-libs
|
Build static versions of dynamic libraries as well |
svg
|
Add support for SVG (Scalable Vector Graphics) |
test
|
Enable dependencies and/or preparations necessary to run tests (usually controlled by FEATURES=test but can be toggled independently) |
tiff
|
Add support for the TIFF image format |
truetype
|
Add support for FreeType and/or FreeType2 fonts |
webp
|
Add support for the WebP image format |
wmf
|
Add support for the Windows Metafile vector image format |
xml
|
Add support for XML files |
zip
|
Enable support for ZIP archives |
zlib
|
Add support for zlib compression |
Emerge
root #
emerge --ask media-gfx/imagemagick
Configuration
Files
- /etc/ImageMagick-7 - Global (system wide) configuration files for Imagemagick are found in this directory.
Troubleshooting
convert will not run due to security policy
The convert command does not run in the out-of-the-box configuration on certain file formats including PS, PS2, PS3, EPS, PDF, and XPS files. This is by design due to a security vulnerabilities in Ghostscript[2][3], which is a library utilized by ImageMagick to manipulate (merge, modify, etc.) PDF files. Gentoo's Security project team has maintained restrictions to ImageMagick's security policy to mitigate ongoing exploit risks in associated libraries.[4]
The solution is to comment out the lines affecting security policy for the file format(s) in question. This action is performed in the following file by using HTML/XML style comments (<!--
and -->
), or simply by removing the offending line(s) altogether from the policy.xml configuration file altogether.
<policymap>
<policy domain="coder" rights="none" pattern="PS" />
<policy domain="coder" rights="none" pattern="PS2" />
<policy domain="coder" rights="none" pattern="PS3" />
<policy domain="coder" rights="none" pattern="EPS" />
<policy domain="coder" rights="none" pattern="PDF" />
<policy domain="coder" rights="none" pattern="XPS" />
</policymap>
After commenting out or removing the relevant lines above, running the convert command will work as expected:
user $
convert input_file_1.pdf input_file_2.pdf output_file.pdf
The example above demos PDF files. Be sure to comment out lines for other types of files if not working exclusively with PDFs.
Removal
Unmerge
root #
emerge --ask --depclean --verbose media-gfx/imagemagick