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