Home | History | Annotate | Download | only in www
      1 
      2 
      3 
      4 
      5 <!DOCTYPE html>
      6 <html lang="en">
      7 <head>
      8     <title>ImageMagick: Porting to ImageMagick Version 7</title>
      9   <meta charset="utf-8" />
     10   <meta http-equiv="X-UA-Compatible" content="IE=edge" />
     11   <meta name="viewport" content="width=device-width, initial-scale=1" />
     12   <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
     13   <meta name="application-name" content="ImageMagick"/>
     14   <meta name="description" content="ImageMagick is a software suite 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, 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 Bzier curves."/>
     15   <meta name="application-url" content="http://www.imagemagick.org"/>
     16   <meta name="generator" content="PHP"/>
     17   <meta name="keywords" content="porting, to, imagemagick, version, 7, ImageMagick, PerlMagick, image processing, image, photo, software, Magick++, OpenMP, convert"/>
     18   <meta name="rating" content="GENERAL"/>
     19   <meta name="robots" content="INDEX, FOLLOW"/>
     20   <meta name="generator" content="ImageMagick Studio LLC"/>
     21   <meta name="author" content="ImageMagick Studio LLC"/>
     22   <meta name="revisit-after" content="2 DAYS"/>
     23   <meta name="resource-type" content="document"/>
     24   <meta name="copyright" content="Copyright (c) 1999-2016 ImageMagick Studio LLC"/>
     25   <meta name="distribution" content="Global"/>
     26   <meta name="magick-serial" content="P131-S030410-R485315270133-P82224-A6668-G1245-1"/>
     27   <meta name="google-site-verification" content="_bMOCDpkx9ZAzBwb2kF3PRHbfUUdFj2uO8Jd1AXArz4" />
     28   <link rel="icon" href="../images/wand.png"/>
     29   <link rel="shortcut icon" href="../images/wand.ico"/>
     30   <link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Roboto:900,400,400italic,700,700italic,300,300italic|Open+Sans:300italic,400italic,700italic,300,400,600,700">
     31   <link rel="stylesheet" href="css/magick.css"/>
     32 </head>
     33 <body>
     34 <div class="main">
     35 <div class="magick-masthead">
     36   <div class="container">
     37     <script async="async" src="http://localhost/pagead/js/adsbygoogle.js"></script>    <ins class="adsbygoogle"
     38          style="display:block"
     39          data-ad-client="ca-pub-3129977114552745"
     40          data-ad-slot="6345125851"
     41          data-ad-format="auto"></ins>
     42     <script>
     43       (adsbygoogle = window.adsbygoogle || []).push({});
     44     </script>
     45     <nav class="magick-nav">
     46       <a class="magick-nav-item " href="../index.html">Home</a>
     47       <a class="magick-nav-item " href="binary-releases.html">Download</a>
     48       <a class="magick-nav-item " href="command-line-tools.html">Tools</a>
     49       <a class="magick-nav-item " href="command-line-processing.html">Command-line</a>
     50       <a class="magick-nav-item " href="resources.html">Resources</a>
     51       <a class="magick-nav-item " href="api.html">Develop</a>
     52       <a class="magick-nav-item " href="http://www.imagemagick.org/script/search.php">Search</a>
     53       <a class="magick-nav-item pull-right" href="https://www.imagemagick.org/discourse-server/">Community</a>
     54     </nav>
     55   </div>
     56 </div>
     57 <div class="container">
     58 <div class="magick-header">
     59 
     60 <p class="text-center"><a href="porting.html#imv7">ImageMagick Version 7</a>  <a href="porting.html#hdri">High Dynamic Range Imaging</a>  <a href="porting.html#channels">Pixel Channels</a>  <a href="porting.html#alpha">Alpha</a>  <a href="porting.html#grayscale">Grayscale</a>  <a href="porting.html#mask">Masks</a>  <a href="porting.html#core">MagickCore API</a>  <a href="porting.html#headers">Header Files</a>   <a href="porting.html#deprecate">Deprecated Features Removed</a>  <a href="porting.html#cli">Command-line Interface</a>  <a href="porting.html#summary">Version 7 Change Summary</a> </p>
     61 
     62 <p class="lead magick-description">The design of ImageMagick is an evolutionary process, with the design and implementation efforts serving to influence and guide further progress in the other.  With ImageMagick version 7 we aim to improve the design based on lessons learned from the version 6 implementation.  ImageMagick was originally designed to display RGB images to an X Windows server.  Over time we extended support to RGBA images and then to the CMYK and CMYKA image format.  With ImageMagick version 7, we extend support to arbitrary colorspaces with an arbitrary number of pixel channels.  Other design changes are in the works and we will document them here so be sure to revisit periodically.</p>
     63 
     64 <p>To support variable pixel channels in the MagickCore API, pixel handling has changed when getting or setting the pixel channels.  You can access channels as an array, <var>pixel[i]</var>, or use an accessor method such as GetPixelRed() or SetPixelRed().  There are some modest changes to the MagickCore and MagickWand API's.   The Magick++ and PerlMagick API's have not changed and matches that of the ImageMagick version 6.</p>
     65 
     66 <p>The shell API (command line) of ImageMagick version 7 is also undergoing
     67 a major overhaul, with specific emphasis on the ability to read 'options' not
     68 only from the command line, but also from scripts, and file streams. This
     69 allows for the use of 'co-processing' programming techniques or performing
     70 image handling using 'deamon/server backends', and even multi-machine
     71 distributed processing.</p>
     72 
     73 <p>With shell API overhaul other improvements are being made, including:
     74 better reporting of which option failed, the consolidation and deprecation of
     75 options, and more global use of 'image properties' (more commonly known as
     76 'percent escapes' in option arguments. </p>
     77 
     78 <p>ImageMagick version 7 is available now as an <a href="http://www.imagemagick.org/download/beta/">Beta</a> release.  Look for an official release around 1st Q 2016.  An official ImageMagick version 7 release depends on how smoothly the Beta cycle progresses.  During the Beta cycle, version 6 developers can attempt to port their software to version 7.</p>
     79 
     80 <p>Once ImageMagick version 7 is released, we will continue to support and enhance version 6 for a minimum of 10 years.</p>
     81 
     82 <h2 class="magick-header"><a id="hdri"></a>High Dynamic Range Imaging</h2>
     83 <p>ImageMagick version 7 enables <a href="high-dynamic-range.html">high dynamic range imaging</a> (HDRI) by default.  HDRI accurately represents the wide range of intensity levels found in real scenes ranging from the brightest direct sunlight to the deepest darkest shadows.  In addition, image processing results are more accurate.  The disadvantage is it requires more memory and may result in slower processing times.  If you see differences in the results of your version 6 command-line with version 7, it is likely due to HDRI.  You may need to add <code>-clamp</code> to your command-line to constrain pixels to the 0 .. QuantumRange range, or disable HDRI when you build ImageMagick version 7.  To disable HDRI (recommended for smart phone builds such as iOS or production sites where performance is a premium), simply add <code>--disable-hdri</code> to the configure script command line when building ImageMagick.</p>
     84 
     85 <h2 class="magick-header"><a id="channels"></a>Pixel Channels</h2>
     86 <p>A pixel is comprised of one or more color values, or <var>channels</var> (e.g. red pixel channel).</p>
     87 <p>Prior versions of ImageMagick (4-6), support 4 to 5 pixel channels (RGBA or CMYKA).  The first 4 channels are accessed with the PixelPacket data structure.   The structure includes 4 members of type Quantum (typically 16-bits) of red, green, blue, and opacity.  The black channel or colormap indexes are supported by a separate method and structure, IndexPacket.  As an example, here is a code snippet from ImageMagick version 6 that negates the color components (but not the alpha component) of the image pixels:</p>
     88 
     89 <code>
     90 <textarea class="form-control" rows="15">for (y=0; y &lt; (ssize_t) image->rows; y++)
     91 {
     92   register IndexPacket
     93     *indexes;
     94 
     95   register PixelPacket
     96     *q;
     97 
     98   q=GetCacheViewAuthenticPixels(image_view,0,y,image->columns,1,exception);
     99   if (q == (PixelPacket *) NULL)
    100     {
    101       status=MagickFalse;
    102       continue;
    103     }
    104   indexes=GetCacheViewAuthenticIndexQueue(image_view);
    105   for (x=0; x &lt; (ssize_t) image->columns; x++)
    106   {
    107     if ((channel &amp; RedChannel) != 0)
    108       q->red=(Quantum) QuantumRange-q->red;
    109     if ((channel &amp; GreenChannel) != 0)
    110       q->green=(Quantum) QuantumRange-q->green;
    111     if ((channel &amp; BlueChannel) != 0)
    112       q->blue=(Quantum) QuantumRange-q->blue;
    113     if (((channel &amp; IndexChannel) != 0) &amp;&amp;
    114         (image->colorspace == CMYKColorspace))
    115       indexes[x]=(IndexPacket) QuantumRange-indexes[x];
    116     q++;
    117   }
    118   if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)
    119     status=MagickFalse;
    120 }</textarea>
    121 </code>
    122 
    123 <p>ImageMagick version 7 supports any number of channels from 1 to 32 (and beyond) and simplifies access with a single method that returns an array of pixel channels of type Quantum.   Source code that compiles against prior versions of ImageMagick requires refactoring to work with ImageMagick version 7.  We illustrate with an example.  Let's naively refactor the version 6 code snippet from above so it works with the ImageMagick version 7 API:</p>
    124 
    125 <code>
    126 <textarea class="form-control" rows="15">for (y=0; y &lt; (ssize_t) image->rows; y++)
    127 {
    128   register Quantum
    129     *q;
    130 
    131   q=GetCacheViewAuthenticPixels(image_view,0,y,image->columns,1,exception);
    132   if (q == (Quantum *) NULL)
    133     {
    134       status=MagickFalse;
    135       continue;
    136     }
    137   for (x=0; x &lt; (ssize_t) image->columns; x++)
    138   {
    139     if ((GetPixelRedTraits(image) &amp; UpdatePixelTrait) != 0)
    140       SetPixelRed(image,QuantumRange-GetPixelRed(image,q),q);
    141     if ((GetPixelGreenTraits(image) &amp; UpdatePixelTrait) != 0)
    142       SetPixelGreen(image,QuantumRange-GetPixelGreen(image,q),q);
    143     if ((GetPixelBlueTraits(image) &amp; UpdatePixelTrait) != 0)
    144       SetPixelBlue(image,QuantumRange-GetPixelBlue(image,q),q);
    145     if ((GetPixelBlackTraits(image) &amp; UpdatePixelTrait) != 0)
    146       SetPixelBlack(image,QuantumRange-GetPixelBlack(image,q),q);
    147     if ((GetPixelAlphaTraits(image) &amp; UpdatePixelTrait) != 0)
    148       SetPixelAlpha(image,QuantumRange-GetPixelAlpha(image,q),q);
    149     q+=GetPixelChannels(image);
    150   }
    151   if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)
    152     status=MagickFalse;
    153 }
    154 </textarea>
    155 </code>
    156 
    157 <p>Let's do that again but take full advantage of the new variable pixel channel support:</p>
    158 
    159 <code>
    160 <textarea class="form-control" rows="15">for (y=0; y &lt; (ssize_t) image->rows; y++)
    161 {
    162   register Quantum
    163     *q;
    164 
    165   q=GetCacheViewAuthenticPixels(image_view,0,y,image->columns,1,exception);
    166   if (q == (Quantum *) NULL)
    167     {
    168       status=MagickFalse;
    169       continue;
    170     }
    171   for (x = 0; x &lt; (ssize_t) image->columns; x++)
    172   {
    173     register ssize_t
    174       i;
    175 
    176     if (GetPixelReadMask(image,q) == 0)
    177       {
    178         q+=GetPixelChannels(image);
    179         continue;
    180       }
    181     for (i=0; i &lt; (ssize_t) GetPixelChannels(image); i++)
    182     {
    183       PixelChannel channel=GetPixelChannelChannel(image,i);
    184       PixelTrait traits=GetPixelChannelTraits(image,channel);
    185       if ((traits &amp; UpdatePixelTrait) == 0)
    186         continue;
    187       q[i]=QuantumRange-q[i];
    188     }
    189     q+=GetPixelChannels(image);
    190   }
    191   if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)
    192     status=MagickFalse;
    193 }
    194 </textarea>
    195 </code>
    196 
    197 <p>Note, how we use GetPixelChannels() to advance to the next set of pixel channels.</p>
    198 
    199 <p>The colormap indexes and black pixel channel (for the CMYK colorspace) are no longer stored in the index channel, previously accessed with GetAuthenticIndexQueue() and GetCacheViewAuthenticIndexQueue().  Instead they are now a first class pixel channel and accessed as a member of the pixel array (e.g. <code>pixel[4]</code>) or with the convenience pixel accessor methods GetPixelIndex(), SetPixelIndex(), GetPixelBlack(), and SetPixelBlack().</p>
    200 
    201 <p>As a consequence of using an array structure for variable pixel channels, auto-vectorization compilers have additional opportunities to speed up pixel loops.</p>
    202 
    203 <h4>Pixel Accessors</h4>
    204 <p>You can access pixel channel as array elements (e.g. <code>pixel[1]</code>) or use convenience accessors to get or set pixel channels:</p>
    205 
    206 <pre>
    207 GetPixela()                  SetPixela()
    208 GetPixelAlpha()              SetPixelAlpha()
    209 GetPixelb()                  SetPixelb()
    210 GetPixelBlack()              SetPixelBlack()
    211 GetPixelBlue()               SetPixelBlue()
    212 GetPixelCb()                 SetPixelCb()
    213 GetPixelCr()                 SetPixelCr()
    214 GetPixelCyan()               SetPixelCyan()
    215 GetPixelGray()               SetPixelGray()
    216 GetPixelGreen()              SetPixelGreen()
    217 GetPixelIndex()              SetPixelIndex()
    218 GetPixelL()                  SetPixelL()
    219 GetPixelMagenta()            SetPixelMagenta()
    220 GetPixelReadMask()           SetPixelReadMask()
    221 GetPixelWriteMask()          SetPixelWriteMask()
    222 GetPixelMetacontentExtent()  SetPixelMetacontentExtent()
    223 GetPixelOpacity()            SetPixelOpacity()
    224 GetPixelRed()                SetPixelRed()
    225 GetPixelYellow()             SetPixelYellow()
    226 GetPixelY()                  SetPixelY()
    227 </pre>
    228 
    229 <p>You can find these accessors defined in the header file, <code>MagickCore/pixel-accessor.h</code></p>
    230 
    231 <h4>Pixel Traits</h4>
    232 <p>Each pixel channel includes one or more of these traits:</p>
    233 <dl class="dl-horizontal">
    234 <dt>Undefined</dt>
    235 <dd>no traits associated with this pixel channel</dd>
    236 <dt>Copy</dt>
    237 <dd>do not update this pixel channel, just copy it</dd>
    238 <dt>Update</dt>
    239 <dd>update this pixel channel</dd>
    240 <dt>Blend</dt>
    241 <dd>blend this pixel channel with the alpha mask if it's enabled</dd>
    242 </dl>
    243 <p>We provide these methods to set and get pixel traits:</p>
    244 <pre>
    245 GetPixelAlphaTraits()    SetPixelAlphaTraits()
    246 GetPixelBlackTraits()    SetPixelBlackTraits()
    247 GetPixelBlueTraits()     SetPixelBlueTraits()
    248 GetPixelCbTraits()       SetPixelCbTraits()
    249 GetPixelChannelTraits()  SetPixelChannelTraits()
    250 GetPixelCrTraits()       SetPixelCrTraits()
    251 GetPixelGrayTraits()     SetPixelGrayTraits()
    252 GetPixelGreenTraits()    SetPixelGreenTraits()
    253 GetPixelIndexTraits()    SetPixelIndexTraits()
    254 GetPixelMagentaTraits()  SetPixelMagentaTraits()
    255 GetPixelRedTraits()      SetPixelRedTraits()
    256 GetPixelYellowTraits()   SetPixelYellowTraits()
    257 GetPixelYTraits()        SetPixelYTraits()
    258 </pre>
    259 <p>For convenience you can set the active trait for a set of pixel channels with a channel mask and this method:</p>
    260 <pre>
    261 SetImageChannelMask()
    262 </pre>
    263 
    264 <p>Previously MagickCore methods had channel analogs, for example, NegateImage() and NegateImageChannels().  The channel analog methods are no longer necessary because the pixel channel traits specify whether to act on a particular pixel channel or whether to blend with the alpha mask.  For example, instead of</p>
    265 <pre>
    266 NegateImageChannel(image,channel);
    267 </pre>
    268 <p>we use:</p>
    269 <pre>
    270 channel_mask=SetImageChannelMask(image,channel);
    271 NegateImage(image,exception);
    272 (void) SetImageChannelMask(image,channel_mask);
    273 </pre>
    274 
    275 <h4>Pixel User Channels</h4>
    276 <p>In version 7, we introduce pixel user channels.  Traditionally we utilize 4 channels, red, green, blue, and alpha.   For CMYK we also have a black channel.  User channels are designed to contain whatever additional channel information that makes sense for your application.  Some examples include extra channels in TIFF or PSD images or perhaps you require a channel with infrared information for the pixel.  You can associate traits with the user channels so that they when they are acted upon by an image processing algorithm (e.g. blur) the pixels are copied, acted upon by the algorithm, or even blended with the alpha channel if that makes sense.</p>
    277 <h4>Pixel Metacontent</h4>
    278 <p>In version 7, we introduce pixel metacontent.  Metacontent is content about content. So rather than being the content itself, it's something that describes or is associated with the content.  Here the content is a pixel.  The pixel metacontent is for your exclusive use (internally the data is just copied, it is not modified) and is accessed with these MagickCore API methods:</p>
    279 <pre>
    280 SetImageMetacontentExtent()
    281 GetImageMetacontentExtent()
    282 GetVirtualMetacontent()
    283 GetAuthenticMetacontent()
    284 GetCacheViewAuthenticMetacontent()
    285 GetCacheViewVirtualMetacontent()
    286 </pre>
    287 
    288 <h2 class="magick-header"><a id="alpha"></a>Alpha</h2>
    289 <p>We support alpha now, previously opacity.  With alpha, a value of <kbd>0</kbd> means that the pixel does not have any coverage information and is transparent; i.e. there was no color contribution from any geometry because the geometry did not overlap this pixel. A value of <code>QuantumRange</code> means that the pixel is opaque because the geometry completely overlapped the pixel. As a consequence, in version 7, the PixelInfo structure member alpha has replaced the previous opacity member.  Another consequence is the alpha part of a sRGB value in hexadecimal notation is now reversed (e.g. #0000 is fully transparent).</p>
    290 <h2 class="magick-header"><a id="colorspace"></a>Colorspace</h2>
    291 <p>The <code>Rec601Luma</code> and <code>Rec709Luma</code> colorspaces are no longer supported.  Instead, specify the <code>gray</code> colorspace and choose from these intensity options:</p>
    292 <pre>
    293 Rec601Luma
    294 Rec601Luminance
    295 Rec709Luma
    296 Rec709Luminance
    297 </pre>
    298 <p>For example,</p>
    299 <pre>
    300 convert myImage.png -intensity Rec709Luminance -colorspace gray myImage.jpg
    301 </pre>
    302 
    303 <h2 class="magick-header"><a id="grayscale"></a>Grayscale</h2>
    304 <p>Previously, grayscale images were Rec601Luminance and consumed 4 channels: red, green, blue, and alpha.  With version 7, grayscale consumes only 1 channel requiring far less resources as a result.</p>
    305 
    306 <h2 class="magick-header"><a id="mask"></a>Masks</h2>
    307 <p>Version 7 supports masks for most image operators.  As an example, here are two methods to compute the statistics of any pixel selected by the image mask:</p>
    308 <pre>
    309 identify -verbose -clip statue.tif
    310 identify -verbose -read-mask mask.png statue.tif
    311 </pre>
    312 
    313 <h2 class="magick-header"><a id="core"></a>MagickCore API</h2>
    314 <p>Here are a list of changes to the MagickCore API:</p>
    315 <ul>
    316 <li>Almost all image processing algorithms are now channel aware.</li>
    317 <li>The MagickCore API adds an <code>ExceptionInfo</code> argument to those methods that lacked it in version 6, e.g. <code>NegateImage(image,MagickTrue,exception</code>);</li>
    318 <li>All method channel analogs have been removed (e.g. BlurImageChannel()), they are no longer necessary, use pixel traits instead.</li>
    319 <li>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.</li>
    320 <li>The InterpolatePixelMethod enum is now PixelInterpolateMethod.</li>
    321 <li>The IntegerPixel storage type is removed (use LongPixel instead) and LongLongPixel is added</li>
    322 <li>Image signatures have changed to account for variable pixel channels.</li>
    323 <li>All color packet structures, PixelPacket, LongPacket, and DoublePacket, are consolidated to a single color structure, PixelInfo.</li>
    324 <li>The ChannelMoments structure member <code>I</code> is now <code>invariant</code>.  <code>I</code> conflicts with the <code>complex.h</code> header.</li>
    325 <li>We added a length parameter to FormatMagickSize() to permit variable length buffers.</li>
    326 </ul>
    327 <h2 class="magick-header"><a id="core"></a>MagickWand API</h2>
    328 <p>Here are a list of changes to the MagickWand API:</p>
    329 <ul>
    330 <li>The DrawMatte() method is now called DrawAlpha().</li>
    331 <li>The MagickSetImageBias() and MagickSetImageClipMask() methods are no longer supported.</li>
    332 </ul>
    333 <h2 class="magick-header"><a id="headers"></a>Header Files</h2>
    334 <p>Prior versions of ImageMagick (4-6) reference the ImageMagick header files as <code>magick/</code> and <code>wand/</code>.  ImageMagick 7 instead uses <code>MagickCore/</code> and <code>MagickWand/</code> respectively.  For example,</p>
    335 <pre><code>#include &lt;MagickCore/MagickCore.h>
    336 #include &lt;MagickWand/MagickWand.h></code></pre>
    337 
    338 <h2 class="magick-header"><a id="deprecate"></a>Deprecated Features Removed</h2>
    339 <p>All deprecated features from ImageMagick version 6 are removed in version 7.  These include the <code>Magick-config</code> and <code>Wand-config</code> configuration utilities.  Instead use:</p>
    340 
    341 <pre>MagickCore-config
    342 MagickWand-config
    343 </pre>
    344 <p>The FilterImage() method has been removed.  Use ConvolveImage() instead.</p>
    345 
    346 <p>In addition, all deprecated <a href="http://magick.imagemagick.org/api/deprecate.html">MagickCore</a> and <a href="http://magick.imagemagick.org/api/magick-deprecate.html">MagickWand</a> methods are no longer available in version 7.</p>
    347 
    348 
    349 <h2 class="magick-header"><a id="cli"></a>Shell API or Command-line Interface</h2>
    350 
    351 <p>As mentioned the primary focus of the changes to the Shell API or Command
    352 Line Interface is the abstraction so that not only can <var>options</var> be
    353 read from command line arguments, but also from a file (script) or from a file
    354 stream (interactive commands, or co-processing). </p>
    355 
    356 <p>To do this the CLI parser needed to be re-written, so as to always perform
    357 all options, in a strict, do-it-as-you-see it order. Previously in IMv6
    358 options were performed in groups (known as 'FireOptions), this awkwardness is
    359 now gone.  However the strict order means that you can no longer give operations
    360 before providing an image for the operations to work on.  To do so will now
    361 produce an error. </p>
    362 
    363 <p>Error reporting is now reporting exactly which option (by argument count on
    364 command line, or line,column in scripts) caused the 'exception'.  This is not
    365 complete as yet but getting better. Also not complete is 'regard-warnings'
    366 handling or its replacement, which will allow you to ignore reported errors
    367 and continue processing (as appropriate due to error) in co-processes or
    368 interactive usage. </p>
    369 
    370 <p>The parenthesis options used to 'push' the current image list, and image
    371 settings (EG: '<code>(</code>' and '<code>)</code>' ) on to a stack now has
    372 a completely separate image settings stack. That is parenthesis 'push/pull'
    373 image lists, and curly braces (EG: '<code>{</code>' and '<code>}</code>' ) will
    374 'push/pull' image settings. </p>
    375 
    376 <p>Of course due to the previously reported changes to the underlying channel
    377 handling will result be many side effects to almost all options. Here are some
    378 specific </p>
    379 
    380 <p>Most algorithms update the red, green, blue, black (for CMYK), and alpha
    381 channels.  Most operators will blend alpha the other color channels, but other
    382 operators (and situations) may require this blending to be disabled, and is
    383 currently done by removing alpha from teh active channels via
    384 <code>-channel</code> option.  (e.g. <code>convert castle.gif -channel RGB
    385 -negate castle.png</code>). </p>
    386 
    387 <p>Reading gray-scale images generate an image with only one channel. If
    388 that image is to then accept color the <code>-colorspace</code> setting needs to
    389 be applied to expand the one channel into separate RGB (or other) channels.
    390 </p>
    391 <p>Previously, command-line arguments were limited to 4096 characters, with ImageMagick version 7 the limit has increased to 131072 characters.</p>
    392 
    393 <h3>Command Changes</h3>
    394 <p>Here are a list of changes to the ImageMagick commands:</p>
    395 <dl class="dl-horizontal">
    396 <dt>magick</dt>
    397 <dd>The "<code>magick</code>" command is the new primary command of the Shell
    398     API, replacing the old "<code>convert</code>" command. This allows you to
    399     create a 'magick script' of the form  "<code>#!/path/to/command/magick
    400     -script</code>", or pipe options into a command "<code>magick -script
    401     -</code>, as abackground process. </dd>
    402 
    403 <dt>magick-script</dt>
    404 <dd>This the same as "<code>magick</code>", (only command name is different)
    405     but which has an implicit "<code>-script</code>" option.  This allows you to
    406     use it in an "<code>env</code>" style script form.  That is a magick script
    407     starts with the 'she-bang' line of "<code>#!/usr/bin/env
    408     magick-script</code>" allowing the script interpreter to be found anywhere
    409     on the users command "<code>PATH</code>".  This is required to get around
    410     a "one argument she-bang bug" that is common on most UNIX systems
    411     (including Linux, but not MacOSX).</dd>
    412 <dt>animate, compare, composite, conjure, convert, display, identify, import, mogrify, montage, stream</dt>
    413 <dd>To reduce the footprint of the command-line utilities, these utilities are symbolic links to the <code>magick</code> utility.  You can also invoke them from the <code>magick</code> utility, for example, use <code>magick convert logo: logo.png</code> to invoke the <code>convert</code> utility.</p>
    414 </dl>
    415 
    416 <h3>Behavioral Changes</h3>
    417 <p>Image settings are applied to each image on the command line.  To associate a setting with a particular image, use parenthesis to remove ambiguity.  In this example we assign a unique page offset to each image:</p>
    418 <pre>
    419 convert \( -page +10+20 first.png \) \( -page +100+200 second.png \) ...
    420 </pre>
    421 
    422 <p>By default, image operations such as convolution blends alpha with each channel.  To convolve each channel independently, deactivate the alpha channel as follows:</p>
    423 <pre>
    424 convert ... -alpha discrete -blur 0x1 ...
    425 </pre>
    426 <p>To remove the alpha values from your image, use <code>-alpha off</code>.</p>
    427 <p>Some options have changed in ImageMagick version 7.  These include:</p>
    428 <dl>
    429 <dt>+combine</dt>
    430 <dd>This option now requires an argument, the image colorspace (e.g. +combine sRGB).</dd>
    431 </dl>
    432 
    433 <h3>New Options</h3>
    434 <p>ImageMagick version 7 supports these new options, though most are limited
    435 to the "<code>magick</code>" command, or to use in "<code>magick</code>"
    436 scripts.</p>
    437 
    438 <dl class="dl-horizontal">
    439 <dt>{ ... }</dt>
    440 <dd>Save (and restore) the current image settings (internally known as the
    441     "image_info" structure).  This is automatically done with parenthesis (EG:
    442     '<code>(</code>' and '<code>)</code>') is "<code>-regard-parenthesis</code>" has
    443     been set, just as in IMv6.  Caution is advised to prevent un-balanced
    444     braces errors.</dd>
    445 
    446 <dt>--</dt>
    447 <dd>End of options, to be used in IMv7 "<code>mogrify</code>" command to
    448     explicitly separate the operations to be applied and the images that
    449     are to be processed 'in-place'.  (not yet implemented).  However if
    450     not provided, "<code>-read</code>" can still be used to differentiate
    451     secondary image reads (for use in things like alpha composition) from
    452     the 'in-place' image being processed. </dd>
    453 
    454 <dd>In other commands (such as "magick") it is equivalent to a explicit
    455     "<code>-read</code>" (see below) of the next option as a image (as it was in
    456     IMv6).  </dd>
    457 
    458 <dt>-alpha discrete</dt>
    459 <dd>treat the alpha channel independently (do not blend).</dd>
    460 
    461 <dt>-channel-fx <var>expression</var> </dt>
    462 <dd>
    463 <p>exchange, extract, or copy one or more image channels.</p>
    464 
    465 <p>The expression consists of one or more channels, either mnemonic or numeric (e.g. red or 0, green or 1, etc.), separated by certain operation symbols as follows:</p>
    466 
    467 <pre>
    468 &lt;=&gt;  exchange two channels (e.g. red&lt;=&gt;blue)
    469 =&gt;   copy one channel to another channel (e.g. red=&gt;green)
    470 =    assign a constant value to a channel (e.g. red=50%)
    471 ,    write new image with channels in the specified order (e.g. red, green)
    472 ;    add a new output image for the next set of channel operations (e.g. red; green; blue)
    473 |    move to the next input image for the source of channel data (e.g. | gray=>alpha)
    474 </pre>
    475 
    476 <p>For example, to create 3 grayscale images from the red, green, and blue channels of an image, use:</p>
    477 
    478 <pre>
    479 -channel-fx "red; green; blue"
    480 </pre>
    481 
    482 <p>A channel without an operation symbol implies separate (i.e, semicolon).</p>
    483 
    484 <p>Here we take an sRGB image and a grayscale image and inject the grayscale image into the alpha channel:</p>
    485 <pre>
    486 convert wizard.png mask.pgm -channel-fx '| gray=>alpha' wizard-alpha.png 
    487 </pre>
    488 <p>Use a similar command to define a read mask:</p>
    489 <pre>
    490 convert wizard.png mask.pgm -channel-fx '| gray=>read-mask' wizard-mask.png 
    491 </pre>
    492 
    493 <p>Add <code>-debug pixel</code> prior to the <code>-channel-fx</code> option to track the channel morphology.</p>
    494 
    495 </dd>
    496 
    497 <dt>-exit</dt>
    498 <dd>Stop processing at this point. No further options will be processed after
    499     this option. Can be used in a script to force the "<code>magick</code>"
    500     command to exit, without actually closing the pipeline that it is
    501     processing options from. </dd>
    502 
    503 <dd>May also be used as a 'final' option on the "<code>magick</code>" command
    504     line, instead of a implicit output image, to completely prevent any image
    505     write. ASIDE: even the "<code>NULL:</code>" coder requires at least one
    506     image, for it to 'not write'! This option does not require any images at
    507     all. </dd>
    508 
    509 <dt>-read {image}</dt>
    510 <dd>Explicit read of an image, rather than an implicit read.  This allows you
    511     to read from filenames that start with an 'option' character, and which
    512     otherwise could be mistaken as an option (unknown or otherwise). This will
    513     eventually be used in "<code>mogrify</code>" to allow the reading of
    514     secondary images, and allow the use of image list operations within that
    515     command. </dd>
    516 
    517 <dt>-read-mask</dt>
    518 <dd>prevent updates to image pixels specified by the mask</dd>
    519 
    520 <dt>-region</dt>
    521 <dd>not yet implemented in "<code>magick</code>". (very soon)</dd>
    522 
    523 <dt>-script {file}</dt>
    524 <dd>In "<code>magick</code>", stop the processing of command line arguments as
    525     image operations, and read all further options from the given file or
    526     pipeline.</dd>
    527 <dt>-write-mask</dt>
    528 <dd>prevent pixels from being written.</dd>
    529 
    530 </dl>
    531 
    532 <h3>Changed Options</h3>
    533 <p>These options are known to have changed, in some way.</p>
    534 <dl class="dl-horizontal">
    535 <dt>-bias</dt>
    536 <dd>The option is no longer recognized.  Use <code>-define convolve:bias=<var>value</var></code> instead.</dd>
    537 <dt>-draw</dt>
    538 <dd>The <code>matte</code> primitive is now <code>alpha</code> (e.g. <code>-draw 'alpha 0,0 floodfill'</code>).</dd>
    539 <dt>-negate</dt>
    540 <dd>currently negates all channels, including alpha if present.  As such you
    541     may need to use the -channel option to prevent alpha negation.  </dd>
    542 </dl>
    543 
    544 <h3>Deprecated warning given, but will work (for now)</h3>
    545 <dl class="dl-horizontal">
    546 <dt>-affine</dt>
    547 <dd>Replaced by <code>-draw "affine ..."</code>. (see transform)</dd>
    548 <dt>-average</dt>
    549 <dd>Replaced by <code>-evaluate-sequence Mean</code>.</dd>
    550 <dt>-box</dt>
    551 <dd>Replaced by <code>-undercolor</code>.</dd>
    552 <dt>-deconstruct</dt>
    553 <dd>Replaced by <code>-layers CompareAny</code>.</dd>
    554 <dt>-gaussian</dt>
    555 <dd>Replaced by <code>-gaussian-blur</code>.</dd>
    556 <dt>-/+map</dt>
    557 <dd>Replaced by <code>-/+remap</code>.</dd>
    558 <dt>-/+mask</dt>
    559 <dd>Replaced by <code>-/+read-mask</code>, <code>-/+write-mask</code>.</dd>
    560 <dt>-/+matte</dt>
    561 <dd>Replaced by <code>-alpha Set/Off</code>.</dd>
    562 <dt>-transform</dt>
    563 <dd>Replaced by <code>-distort Affine "..."</code>.</dd>
    564 </dl>
    565 
    566 <h3>Deprecated warning given, and ignored (for now)</h3>
    567 <p>Almost 'plus' (+) option that did not do anything has been marked as
    568 deprecated, and does nothing. It does not even have associated code.  For
    569 example "+annotate", "+resize", "+clut", and "+draw" .</p>
    570 
    571 <dl class="dl-horizontal">
    572 <dt>-affinity</dt>
    573 <dd>Replaced by <code>-remap</code>.</dd>
    574 <dt>-maximum</dt>
    575 <dd>Replaced by <code>-evaluate-sequence Max</code>.</dd>
    576 <dt>-median</dt>
    577 <dd>Replaced by <code>-evaluate-sequence Median</code>.</dd>
    578 <dt>-minimum</dt>
    579 <dd>Replaced by <code>-evaluate-sequence Min</code>.</dd>
    580 <dt>-recolor</dt>
    581 <dd>Replaced by <code>-color-matrix</code>.</dd>
    582 </dl>
    583 
    584 <h3>Removed / Replaced Options ("no such option" error and abort)</h3>
    585 
    586 <dl class="dl-horizontal">
    587 <dt>-interpolate filter</dt>
    588 <dd>remove slow and useless interpolation method</dd>
    589 <dt>-origin</dt>
    590 <dd>old option, unknown meaning.</dd>
    591 <dt>-pen</dt>
    592 <dd>Replaced by <code>-fill</code>.</dd>
    593 <dt>-passphrase</dt>
    594 <dd>old option, unknown meaning</dd>
    595 </dl>
    596 <h2 class="magick-header"><a id="summary"></a>Version 7 Change Summary</h2>
    597 <p>Changes from ImageMagick version 6 to version 7 are summarized here:</p>
    598 <h4>High Dynamic Range Imaging</h4>
    599 <ul>
    600 <li>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).</li>
    601 </ul>
    602 <h4>Pixels</h4>
    603 <ul>
    604 <li>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]).</li>
    605 <li>Use convenience macros to access pixel channels (e.g. GetPixelRed(), SetPixelRed()).</li>
    606 <li>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().</li>
    607 <li>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().</li>
    608 <li>Use GetPixelChannels() to advance to the next set of pixel channels.</li>
    609 <li>Use the <var>metacontent</var> channel  to associate metacontent with each pixel.</li>
    610 <li>All color packet structures, PixelPacket, LongPacket, and DoublePacket, are consolidated to a single color structure, PixelInfo.</li>
    611 </ul>
    612 <h4>Alpha</h4>
    613 <ul>
    614 <li>We support alpha rather than opacity (0 transparent; QuantumRange opaque).</li>
    615 <li>Use GetPixelAlpha() or SetPixelAlpha() to get or set the alpha pixel channel value.</li>
    616 </ul>
    617 <h4>Grayscale</h4>
    618 <ul>
    619 <li>Grayscale images consume one pixel channel in ImageMagick version 7.  To process RGB, set the colorspace to RGB (e.g. -colorspace sRGB).</li>
    620 </ul>
    621 <h4>Masks</h4>
    622 <ul>
    623 <li>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.</li>
    624 </ul>
    625 <h4>MagickCore API</h4>
    626 <ul>
    627 <li>Almost all image processing algorithms are now channel aware.</li>
    628 <li>MagickCore, version 7, adds an ExceptionInfo argument to those methods that lacked it in version 6, e.g. <code>NegateImage(image,MagickTrue,exception);</code></li>
    629 <li>All method channel analogs have been removed (e.g. BlurImageChannel()), they are no longer necessary, use pixel traits instead.</li>
    630 <li>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.</li>
    631 <li>The InterpolatePixelMethod enum is now PixelInterpolateMethod.</li>
    632 <li>To account for variable pixel channels, images may now return a different signature.</li>
    633 </ul>
    634 <h4>Deprecated Methods</h4>
    635 <ul>
    636 <li>All ImageMagick version 6 MagickCore and MagickWand deprecated methods are removed and no longer available in ImageMagick version 7.</li>
    637 <li>All MagickCore channel method analogs are removed (e.g. NegateImageChannels()).  For version 7, use pixel traits instead.</li>
    638 <li>The FilterImage() method has been removed.  Use ConvolveImage() instead.</li>
    639 </ul>
    640 </div>
    641   <footer class="magick-footer">
    642     <p><a href="support.html">Donate</a> 
    643      <a href="sitemap.html">Sitemap</a> 
    644     <a href="links.html">Related</a> 
    645     <a href="architecture.html">Architecture</a>
    646 </p>
    647     <p><a href="porting.html#">Back to top</a> 
    648     <a href="http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x89AB63D48277377A">Public Key</a> 
    649     <a href="http://www.imagemagick.org/script/contact.php">Contact Us</a></p>
    650         <p><small>  1999-2016 ImageMagick Studio LLC</small></p>
    651   </footer>
    652 </div><!-- /.container -->
    653 
    654   <script src="https://localhost/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
    655   <script src="../js/magick.html"></script>
    656 </div>
    657 </body>
    658 </html>
    659