[wp-trac] [WordPress Trac] #54116: Check ImageMagick version 6/7
WordPress Trac
noreply at wordpress.org
Mon Sep 13 08:52:33 UTC 2021
#54116: Check ImageMagick version 6/7
---------------------------+-----------------------------
Reporter: JavierCasares | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Site Health | Version:
Severity: normal | Keywords:
Focuses: performance |
---------------------------+-----------------------------
From #52654
**Context**
WordPress uses ImageMagick to create, edit, compose, or convert digital
images. It can read and write images in a variety of formats (over 200)
including PNG, JPEG, GIF, WebP, HEIC, SVG, PDF, DPX, EXR and TIFF.
ImageMagick can resize, flip, mirror, rotate, distort, shear and transform
images, adjust image colors, apply various special effects, or draw text,
lines, polygons, ellipses and Bézier curves.
**ImageMagick recommendation**
But, we recommend using ImageMagick, although the last WordPress versions
supports WebP and ImageMagick 6 does not support it.
Moreover, a lot of OS have the version 6 by default because version 7
needs to be compiled manually (at least, at this moment).
**Site Health**
Should the Site Heath check the version?
Yes. because for some functionalities, there are some things different.
**How we can check it?**
https://www.php.net/manual/en/imagick.getversion.php
The array returns something like:
{{{
Array
(
[versionNumber] => 1632
[versionString] => ImageMagick 6.6.0-4 2010-11-16 Q16
http://www.imagemagick.org
)
}}}
But, we should get the version with this example:
{{{#!php
<?php
$v = Imagick::getVersion();
preg_match('/ImageMagick ([0-9]+\.[0-9]+\.[0-9]+)/', $v['versionString'],
$v);
if(version_compare($v[1],'6.2.8')<=0){
print "Your ImageMagick Version {$v[1]} is '6.2.8' or older, please
upgrade!";
}
}}}
**Version 6 vs. version 7**
And, here is the comparison between version 6 and version 7:
https://www.imagemagick.org/script/porting.php
**Version 7 Change Summary**
Changes from ImageMagick version 6 to version 7 are summarized here:
High Dynamic Range Imaging
- ImageMagick version 7 enables HDRI by default. Expect more accurate
image processing results with higher memory requirements and possible
slower processing times. You can disable this feature for resource
constrained system such as a cell phone with a slight loss of accuracy for
certain algorithms (e.g. resizing).
Pixels
- Pixels are no longer addressed with PixelPacket structure members (e.g.
red, green, blue, opacity) but as an array of channels (e.g.
pixel[PixelRedChannel]).
- Use convenience macros to access pixel channels (e.g. GetPixelRed(),
SetPixelRed()).
- The black channel for the CMYK colorspace is no longer stored in the
index channel, previously accessed with GetAuthenticIndexQueue() and
GetCacheViewAuthenticIndexQueue(). Instead it is now a pixel channel and
accessed with the convenience pixel macros GetPixelBlack() and
SetPixelBlack().
- The index channel for colormapped images is no longer stored in the
index channel, previously accessed with GetAuthenticIndexQueue() and
GetCacheViewAuthenticIndexQueue(). Instead it is now a pixel channel and
accessed with the convenience pixel macros GetPixelIndex() and
SetPixelIndex().
- Use GetPixelChannels() to advance to the next set of pixel channels.
- Use the metacontent channel to associate metacontent with each pixel.
- All color packet structures, PixelPacket, LongPacket, and DoublePacket,
are consolidated to a single color structure, PixelInfo.
Alpha
- We support alpha rather than opacity (0 transparent; QuantumRange
opaque).
- Use GetPixelAlpha() or SetPixelAlpha() to get or set the alpha pixel
channel value.
Grayscale
- Grayscale images consume one pixel channel in ImageMagick version 7. To
process RGB, set the colorspace to RGB (e.g. -colorspace sRGB).
Masks
- ImageMagick version 6 only supports read mask in limited circumstances.
Version 7 supports both a read and write mask. The read mask is honored by
most image-processing algorithms.
MagickCore API
- Almost all image processing algorithms are now channel aware.
- MagickCore, version 7, adds an ExceptionInfo argument to those methods
that lacked it in version 6, e.g. NegateImage(image,MagickTrue,exception);
- All method channel analogs have been removed (e.g. BlurImageChannel()),
they are no longer necessary, use pixel traits instead.
- Public and private API calls are now declared with the GCC visibility
attribute. The MagickCore and MagickWand dynamic libraries now only export
public struct and function declarations.
- The InterpolatePixelMethod enum is now PixelInterpolateMethod.
- To account for variable pixel channels, images may now return a
different signature.
Deprecated Methods
- All ImageMagick version 6 MagickCore and MagickWand deprecated methods
are removed and no longer available in ImageMagick version 7.
- All MagickCore channel method analogs are removed (e.g.
NegateImageChannels()). For version 7, use pixel traits instead.
- The FilterImage() method has been removed. Use ConvolveImage() instead.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/54116>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list