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