cristy | d04e7bf | 2012-03-03 19:19:12 +0000 | [diff] [blame] | 1 | /* |
| 2 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 3 | % % |
| 4 | % % |
| 5 | % % |
| 6 | % CCCC H H AAA N N N N EEEEE L % |
| 7 | % C H H A A NN N NN N E L % |
| 8 | % C HHHHH AAAAA N N N N N N RRR L % |
| 9 | % C H H A A N NN N NN E L % |
| 10 | % CCCC H H A A N N N N EEEEE LLLLL % |
| 11 | % % |
| 12 | % % |
| 13 | % MagickCore Image Channel Methods % |
| 14 | % % |
| 15 | % Software Design % |
| 16 | % John Cristy % |
| 17 | % December 2003 % |
| 18 | % % |
| 19 | % % |
| 20 | % Copyright 1999-2012 ImageMagick Studio LLC, a non-profit organization % |
| 21 | % dedicated to making software imaging solutions freely available. % |
| 22 | % % |
| 23 | % You may not use this file except in compliance with the License. You may % |
| 24 | % obtain a copy of the License at % |
| 25 | % % |
| 26 | % http://www.imagemagick.org/script/license.php % |
| 27 | % % |
| 28 | % Unless required by applicable law or agreed to in writing, software % |
| 29 | % distributed under the License is distributed on an "AS IS" BASIS, % |
| 30 | % WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. % |
| 31 | % See the License for the specific language governing permissions and % |
| 32 | % limitations under the License. % |
| 33 | % % |
| 34 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 35 | % |
| 36 | % |
| 37 | % |
| 38 | */ |
| 39 | |
| 40 | /* |
| 41 | Include declarations. |
| 42 | */ |
| 43 | #include "MagickCore/studio.h" |
cristy | c1119af | 2012-04-16 15:28:23 +0000 | [diff] [blame] | 44 | #include "MagickCore/colorspace-private.h" |
cristy | a15140f | 2012-03-04 01:21:15 +0000 | [diff] [blame] | 45 | #include "MagickCore/image.h" |
| 46 | #include "MagickCore/list.h" |
| 47 | #include "MagickCore/log.h" |
cristy | ab272ac | 2012-03-04 22:08:07 +0000 | [diff] [blame] | 48 | #include "MagickCore/monitor.h" |
| 49 | #include "MagickCore/monitor-private.h" |
cristy | a15140f | 2012-03-04 01:21:15 +0000 | [diff] [blame] | 50 | #include "MagickCore/option.h" |
cristy | ab272ac | 2012-03-04 22:08:07 +0000 | [diff] [blame] | 51 | #include "MagickCore/pixel-accessor.h" |
cristy | 8748f56 | 2012-03-08 13:58:34 +0000 | [diff] [blame] | 52 | #include "MagickCore/string-private.h" |
cristy | a15140f | 2012-03-04 01:21:15 +0000 | [diff] [blame] | 53 | #include "MagickCore/token.h" |
cristy | d04e7bf | 2012-03-03 19:19:12 +0000 | [diff] [blame] | 54 | #include "MagickCore/utility.h" |
| 55 | #include "MagickCore/version.h" |
| 56 | |
| 57 | /* |
| 58 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 59 | % % |
| 60 | % % |
| 61 | % % |
cristy | 5f257b2 | 2012-03-07 00:27:29 +0000 | [diff] [blame] | 62 | % C h a n n e l F x I m a g e % |
cristy | d04e7bf | 2012-03-03 19:19:12 +0000 | [diff] [blame] | 63 | % % |
| 64 | % % |
| 65 | % % |
| 66 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 67 | % |
cristy | 5f257b2 | 2012-03-07 00:27:29 +0000 | [diff] [blame] | 68 | % ChannelFxImage() applies a channel expression to the specified image. The |
| 69 | % expression consists of one or more channels, either mnemonic or numeric (e.g. |
| 70 | % red, 1), separated by actions as follows: |
cristy | ab272ac | 2012-03-04 22:08:07 +0000 | [diff] [blame] | 71 | % |
| 72 | % <=> exchange two channels (e.g. red<=>blue) |
cristy | 7ea920d | 2012-03-16 01:08:01 +0000 | [diff] [blame] | 73 | % => copy one channel to another channel (e.g. red=>green) |
| 74 | % = assign a constant value to a channel (e.g. red=50%) |
| 75 | % , write new image channels in the specified order (e.g. red, green) |
cristy | 3c21361 | 2012-03-16 01:14:48 +0000 | [diff] [blame] | 76 | % | add a new output image for the next set of channel operations |
| 77 | % ; move to the next input image for the source of channel data |
cristy | ab272ac | 2012-03-04 22:08:07 +0000 | [diff] [blame] | 78 | % |
cristy | 7ea920d | 2012-03-16 01:08:01 +0000 | [diff] [blame] | 79 | % For example, to create 3 grayscale images from the red, green, and blue |
| 80 | % channels of an image, use: |
cristy | ab272ac | 2012-03-04 22:08:07 +0000 | [diff] [blame] | 81 | % |
cristy | 3c21361 | 2012-03-16 01:14:48 +0000 | [diff] [blame] | 82 | % -channel-fx "red; green; blue" |
cristy | 7ea920d | 2012-03-16 01:08:01 +0000 | [diff] [blame] | 83 | % |
| 84 | % A channel without an operation symbol implies separate (i.e, semicolon). |
cristy | d04e7bf | 2012-03-03 19:19:12 +0000 | [diff] [blame] | 85 | % |
cristy | 5f257b2 | 2012-03-07 00:27:29 +0000 | [diff] [blame] | 86 | % The format of the ChannelFxImage method is: |
cristy | d04e7bf | 2012-03-03 19:19:12 +0000 | [diff] [blame] | 87 | % |
cristy | 5f257b2 | 2012-03-07 00:27:29 +0000 | [diff] [blame] | 88 | % Image *ChannelFxImage(const Image *image,const char *expression, |
| 89 | % ExceptionInfo *exception) |
cristy | d04e7bf | 2012-03-03 19:19:12 +0000 | [diff] [blame] | 90 | % |
| 91 | % A description of each parameter follows: |
| 92 | % |
cristy | ab272ac | 2012-03-04 22:08:07 +0000 | [diff] [blame] | 93 | % o image: the image. |
cristy | d04e7bf | 2012-03-03 19:19:12 +0000 | [diff] [blame] | 94 | % |
| 95 | % o expression: A channel expression. |
| 96 | % |
| 97 | % o exception: return any errors or warnings in this structure. |
| 98 | % |
| 99 | */ |
cristy | a15140f | 2012-03-04 01:21:15 +0000 | [diff] [blame] | 100 | |
| 101 | typedef enum |
| 102 | { |
| 103 | ExtractChannelOp, |
cristy | 8748f56 | 2012-03-08 13:58:34 +0000 | [diff] [blame] | 104 | AssignChannelOp, |
cristy | a15140f | 2012-03-04 01:21:15 +0000 | [diff] [blame] | 105 | ExchangeChannelOp, |
| 106 | TransferChannelOp |
cristy | 5f257b2 | 2012-03-07 00:27:29 +0000 | [diff] [blame] | 107 | } ChannelFx; |
cristy | a15140f | 2012-03-04 01:21:15 +0000 | [diff] [blame] | 108 | |
cristy | ab272ac | 2012-03-04 22:08:07 +0000 | [diff] [blame] | 109 | static inline size_t MagickMin(const size_t x,const size_t y) |
cristy | a15140f | 2012-03-04 01:21:15 +0000 | [diff] [blame] | 110 | { |
cristy | ab272ac | 2012-03-04 22:08:07 +0000 | [diff] [blame] | 111 | if (x < y) |
| 112 | return(x); |
| 113 | return(y); |
cristy | a15140f | 2012-03-04 01:21:15 +0000 | [diff] [blame] | 114 | } |
| 115 | |
cristy | ab272ac | 2012-03-04 22:08:07 +0000 | [diff] [blame] | 116 | static MagickBooleanType ChannelImage(Image *destination_image, |
cristy | 8748f56 | 2012-03-08 13:58:34 +0000 | [diff] [blame] | 117 | const PixelChannel destination_channel,const ChannelFx channel_op, |
cristy | 3bb378a | 2012-03-08 14:38:52 +0000 | [diff] [blame] | 118 | const Image *source_image,const PixelChannel source_channel, |
cristy | 8748f56 | 2012-03-08 13:58:34 +0000 | [diff] [blame] | 119 | const Quantum pixel,ExceptionInfo *exception) |
cristy | ab272ac | 2012-03-04 22:08:07 +0000 | [diff] [blame] | 120 | { |
| 121 | CacheView |
| 122 | *source_view, |
| 123 | *destination_view; |
| 124 | |
| 125 | MagickBooleanType |
| 126 | status; |
| 127 | |
| 128 | size_t |
| 129 | height; |
| 130 | |
| 131 | ssize_t |
| 132 | y; |
| 133 | |
| 134 | status=MagickTrue; |
cristy | db07095 | 2012-04-20 14:33:00 +0000 | [diff] [blame^] | 135 | source_view=AcquireVirtualCacheView(source_image,exception); |
| 136 | destination_view=AcquireAuthenticCacheView(destination_image,exception); |
cristy | ab272ac | 2012-03-04 22:08:07 +0000 | [diff] [blame] | 137 | height=MagickMin(source_image->rows,destination_image->rows); |
| 138 | #if defined(MAGICKCORE_OPENMP_SUPPORT) |
| 139 | #pragma omp parallel for schedule(static) shared(status) |
| 140 | #endif |
| 141 | for (y=0; y < (ssize_t) height; y++) |
| 142 | { |
cristy | 4ee6040 | 2012-03-11 02:01:20 +0000 | [diff] [blame] | 143 | PixelTrait |
| 144 | destination_traits, |
| 145 | source_traits; |
| 146 | |
cristy | ab272ac | 2012-03-04 22:08:07 +0000 | [diff] [blame] | 147 | register const Quantum |
| 148 | *restrict p; |
| 149 | |
| 150 | register Quantum |
| 151 | *restrict q; |
| 152 | |
| 153 | register ssize_t |
| 154 | x; |
| 155 | |
| 156 | size_t |
| 157 | width; |
| 158 | |
| 159 | if (status == MagickFalse) |
| 160 | continue; |
| 161 | p=GetCacheViewVirtualPixels(source_view,0,y,source_image->columns,1, |
| 162 | exception); |
cristy | 4ee6040 | 2012-03-11 02:01:20 +0000 | [diff] [blame] | 163 | q=GetCacheViewAuthenticPixels(destination_view,0,y, |
cristy | ab272ac | 2012-03-04 22:08:07 +0000 | [diff] [blame] | 164 | destination_image->columns,1,exception); |
| 165 | if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL)) |
| 166 | { |
| 167 | status=MagickFalse; |
| 168 | continue; |
| 169 | } |
cristy | 4ee6040 | 2012-03-11 02:01:20 +0000 | [diff] [blame] | 170 | destination_traits=GetPixelChannelMapTraits(destination_image, |
| 171 | destination_channel); |
| 172 | source_traits=GetPixelChannelMapTraits(source_image,source_channel); |
| 173 | if ((destination_traits == UndefinedPixelTrait) || |
| 174 | (source_traits == UndefinedPixelTrait)) |
| 175 | continue; |
cristy | ab272ac | 2012-03-04 22:08:07 +0000 | [diff] [blame] | 176 | width=MagickMin(source_image->columns,destination_image->columns); |
| 177 | for (x=0; x < (ssize_t) width; x++) |
| 178 | { |
cristy | 8748f56 | 2012-03-08 13:58:34 +0000 | [diff] [blame] | 179 | if (channel_op == AssignChannelOp) |
| 180 | SetPixelChannel(destination_image,destination_channel,pixel,q); |
| 181 | else |
cristy | 4ee6040 | 2012-03-11 02:01:20 +0000 | [diff] [blame] | 182 | SetPixelChannel(destination_image,destination_channel, |
| 183 | GetPixelChannel(source_image,source_channel,p),q); |
| 184 | p+=GetPixelChannels(source_image); |
cristy | ab272ac | 2012-03-04 22:08:07 +0000 | [diff] [blame] | 185 | q+=GetPixelChannels(destination_image); |
| 186 | } |
| 187 | if (SyncCacheViewAuthenticPixels(destination_view,exception) == MagickFalse) |
| 188 | status=MagickFalse; |
| 189 | } |
| 190 | destination_view=DestroyCacheView(destination_view); |
| 191 | source_view=DestroyCacheView(source_view); |
| 192 | return(status); |
| 193 | } |
| 194 | |
cristy | 5f257b2 | 2012-03-07 00:27:29 +0000 | [diff] [blame] | 195 | MagickExport Image *ChannelFxImage(const Image *image,const char *expression, |
| 196 | ExceptionInfo *exception) |
cristy | d04e7bf | 2012-03-03 19:19:12 +0000 | [diff] [blame] | 197 | { |
cristy | 5f257b2 | 2012-03-07 00:27:29 +0000 | [diff] [blame] | 198 | #define ChannelFxImageTag "ChannelFx/Image" |
cristy | ab272ac | 2012-03-04 22:08:07 +0000 | [diff] [blame] | 199 | |
cristy | 5f257b2 | 2012-03-07 00:27:29 +0000 | [diff] [blame] | 200 | ChannelFx |
cristy | a15140f | 2012-03-04 01:21:15 +0000 | [diff] [blame] | 201 | channel_op; |
| 202 | |
cristy | fe88ede | 2012-03-22 00:34:48 +0000 | [diff] [blame] | 203 | ChannelType |
| 204 | channel_mask; |
| 205 | |
cristy | 4ee6040 | 2012-03-11 02:01:20 +0000 | [diff] [blame] | 206 | char |
| 207 | token[MaxTextExtent]; |
| 208 | |
cristy | a15140f | 2012-03-04 01:21:15 +0000 | [diff] [blame] | 209 | const char |
| 210 | *p; |
| 211 | |
cristy | ab272ac | 2012-03-04 22:08:07 +0000 | [diff] [blame] | 212 | const Image |
| 213 | *source_image; |
| 214 | |
cristy | 8748f56 | 2012-03-08 13:58:34 +0000 | [diff] [blame] | 215 | double |
| 216 | pixel; |
| 217 | |
cristy | a15140f | 2012-03-04 01:21:15 +0000 | [diff] [blame] | 218 | Image |
cristy | ab272ac | 2012-03-04 22:08:07 +0000 | [diff] [blame] | 219 | *destination_image; |
cristy | a15140f | 2012-03-04 01:21:15 +0000 | [diff] [blame] | 220 | |
cristy | 4ee6040 | 2012-03-11 02:01:20 +0000 | [diff] [blame] | 221 | MagickBooleanType |
| 222 | status; |
| 223 | |
cristy | a15140f | 2012-03-04 01:21:15 +0000 | [diff] [blame] | 224 | PixelChannel |
cristy | ab272ac | 2012-03-04 22:08:07 +0000 | [diff] [blame] | 225 | source_channel, |
| 226 | destination_channel; |
cristy | a15140f | 2012-03-04 01:21:15 +0000 | [diff] [blame] | 227 | |
cristy | ab272ac | 2012-03-04 22:08:07 +0000 | [diff] [blame] | 228 | ssize_t |
| 229 | channels; |
| 230 | |
| 231 | assert(image != (Image *) NULL); |
| 232 | assert(image->signature == MagickSignature); |
| 233 | if (image->debug != MagickFalse) |
| 234 | (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename); |
| 235 | assert(exception != (ExceptionInfo *) NULL); |
| 236 | assert(exception->signature == MagickSignature); |
| 237 | source_image=image; |
| 238 | destination_image=CloneImage(source_image,0,0,MagickTrue,exception); |
| 239 | if (destination_image == (Image *) NULL) |
| 240 | return((Image *) NULL); |
cristy | fc68ef5 | 2012-03-11 23:33:15 +0000 | [diff] [blame] | 241 | if (destination_image->colorspace == GRAYColorspace) |
cristy | 7020ae6 | 2012-04-18 12:58:34 +0000 | [diff] [blame] | 242 | destination_image->colorspace=sRGBColorspace; |
cristy | ab272ac | 2012-03-04 22:08:07 +0000 | [diff] [blame] | 243 | if (expression == (const char *) NULL) |
| 244 | return(destination_image); |
| 245 | destination_channel=RedPixelChannel; |
cristy | fe88ede | 2012-03-22 00:34:48 +0000 | [diff] [blame] | 246 | channel_mask=UndefinedChannel; |
cristy | 8748f56 | 2012-03-08 13:58:34 +0000 | [diff] [blame] | 247 | pixel=0.0; |
cristy | a15140f | 2012-03-04 01:21:15 +0000 | [diff] [blame] | 248 | p=(char *) expression; |
| 249 | GetMagickToken(p,&p,token); |
cristy | 4ee6040 | 2012-03-11 02:01:20 +0000 | [diff] [blame] | 250 | channel_op=ExtractChannelOp; |
cristy | 09ef5be | 2012-03-13 13:01:27 +0000 | [diff] [blame] | 251 | for (channels=0; *token != '\0'; ) |
cristy | a15140f | 2012-03-04 01:21:15 +0000 | [diff] [blame] | 252 | { |
cristy | a15140f | 2012-03-04 01:21:15 +0000 | [diff] [blame] | 253 | ssize_t |
| 254 | i; |
| 255 | |
| 256 | /* |
| 257 | Interpret channel expression. |
| 258 | */ |
| 259 | if (*token == ',') |
| 260 | { |
cristy | ab272ac | 2012-03-04 22:08:07 +0000 | [diff] [blame] | 261 | destination_channel=(PixelChannel) ((ssize_t) destination_channel+1); |
cristy | a15140f | 2012-03-04 01:21:15 +0000 | [diff] [blame] | 262 | GetMagickToken(p,&p,token); |
| 263 | } |
| 264 | if (*token == '|') |
| 265 | { |
cristy | ab272ac | 2012-03-04 22:08:07 +0000 | [diff] [blame] | 266 | if (GetNextImageInList(source_image) != (Image *) NULL) |
| 267 | source_image=GetNextImageInList(source_image); |
cristy | a15140f | 2012-03-04 01:21:15 +0000 | [diff] [blame] | 268 | else |
cristy | ab272ac | 2012-03-04 22:08:07 +0000 | [diff] [blame] | 269 | source_image=GetFirstImageInList(source_image); |
cristy | a15140f | 2012-03-04 01:21:15 +0000 | [diff] [blame] | 270 | GetMagickToken(p,&p,token); |
| 271 | } |
| 272 | if (*token == ';') |
| 273 | { |
cristy | ab272ac | 2012-03-04 22:08:07 +0000 | [diff] [blame] | 274 | Image |
| 275 | *canvas; |
| 276 | |
cristy | fe88ede | 2012-03-22 00:34:48 +0000 | [diff] [blame] | 277 | SetPixelChannelMapMask(destination_image,channel_mask); |
| 278 | if ((channel_op == ExtractChannelOp) && (destination_channel == 1)) |
| 279 | (void) SetImageColorspace(destination_image,GRAYColorspace,exception); |
cristy | 4ee6040 | 2012-03-11 02:01:20 +0000 | [diff] [blame] | 280 | status=SetImageStorageClass(destination_image,DirectClass,exception); |
| 281 | if (status == MagickFalse) |
| 282 | { |
cristy | fc68ef5 | 2012-03-11 23:33:15 +0000 | [diff] [blame] | 283 | destination_image=DestroyImageList(destination_image); |
| 284 | return(destination_image); |
cristy | 4ee6040 | 2012-03-11 02:01:20 +0000 | [diff] [blame] | 285 | } |
cristy | ab272ac | 2012-03-04 22:08:07 +0000 | [diff] [blame] | 286 | canvas=CloneImage(source_image,0,0,MagickTrue,exception); |
| 287 | if (canvas == (Image *) NULL) |
| 288 | { |
cristy | fc68ef5 | 2012-03-11 23:33:15 +0000 | [diff] [blame] | 289 | destination_image=DestroyImageList(destination_image); |
| 290 | return(destination_image); |
cristy | ab272ac | 2012-03-04 22:08:07 +0000 | [diff] [blame] | 291 | } |
cristy | fc68ef5 | 2012-03-11 23:33:15 +0000 | [diff] [blame] | 292 | if (canvas->colorspace == GRAYColorspace) |
cristy | 7020ae6 | 2012-04-18 12:58:34 +0000 | [diff] [blame] | 293 | canvas->colorspace=sRGBColorspace; |
cristy | ab272ac | 2012-03-04 22:08:07 +0000 | [diff] [blame] | 294 | AppendImageToList(&destination_image,canvas); |
| 295 | destination_image=GetLastImageInList(destination_image); |
cristy | a15140f | 2012-03-04 01:21:15 +0000 | [diff] [blame] | 296 | GetMagickToken(p,&p,token); |
cristy | ab272ac | 2012-03-04 22:08:07 +0000 | [diff] [blame] | 297 | channels=0; |
| 298 | destination_channel=RedPixelChannel; |
cristy | fe88ede | 2012-03-22 00:34:48 +0000 | [diff] [blame] | 299 | channel_mask=UndefinedChannel; |
cristy | a15140f | 2012-03-04 01:21:15 +0000 | [diff] [blame] | 300 | } |
| 301 | i=ParsePixelChannelOption(token); |
| 302 | if (i < 0) |
| 303 | { |
| 304 | (void) ThrowMagickException(exception,GetMagickModule(),OptionError, |
cristy | abb241b | 2012-03-06 01:12:58 +0000 | [diff] [blame] | 305 | "UnrecognizedChannelType","`%s'",token); |
cristy | ab272ac | 2012-03-04 22:08:07 +0000 | [diff] [blame] | 306 | destination_image=DestroyImageList(destination_image); |
cristy | fc68ef5 | 2012-03-11 23:33:15 +0000 | [diff] [blame] | 307 | return(destination_image); |
cristy | a15140f | 2012-03-04 01:21:15 +0000 | [diff] [blame] | 308 | } |
cristy | ab272ac | 2012-03-04 22:08:07 +0000 | [diff] [blame] | 309 | source_channel=(PixelChannel) i; |
cristy | a15140f | 2012-03-04 01:21:15 +0000 | [diff] [blame] | 310 | channel_op=ExtractChannelOp; |
| 311 | GetMagickToken(p,&p,token); |
| 312 | if (*token == '<') |
| 313 | { |
| 314 | channel_op=ExchangeChannelOp; |
| 315 | GetMagickToken(p,&p,token); |
| 316 | } |
| 317 | if (*token == '=') |
cristy | 8748f56 | 2012-03-08 13:58:34 +0000 | [diff] [blame] | 318 | { |
| 319 | if (channel_op != ExchangeChannelOp) |
| 320 | channel_op=AssignChannelOp; |
| 321 | GetMagickToken(p,&p,token); |
| 322 | } |
cristy | a15140f | 2012-03-04 01:21:15 +0000 | [diff] [blame] | 323 | if (*token == '>') |
| 324 | { |
| 325 | if (channel_op != ExchangeChannelOp) |
| 326 | channel_op=TransferChannelOp; |
| 327 | GetMagickToken(p,&p,token); |
| 328 | } |
cristy | 8748f56 | 2012-03-08 13:58:34 +0000 | [diff] [blame] | 329 | switch (channel_op) |
| 330 | { |
| 331 | case AssignChannelOp: |
| 332 | { |
cristy | 41db174 | 2012-03-09 00:57:52 +0000 | [diff] [blame] | 333 | pixel=StringToDoubleInterval(token,(double) QuantumRange+1.0); |
cristy | 3bb378a | 2012-03-08 14:38:52 +0000 | [diff] [blame] | 334 | GetMagickToken(p,&p,token); |
cristy | 8748f56 | 2012-03-08 13:58:34 +0000 | [diff] [blame] | 335 | break; |
| 336 | } |
| 337 | case ExchangeChannelOp: |
| 338 | case TransferChannelOp: |
cristy | a15140f | 2012-03-04 01:21:15 +0000 | [diff] [blame] | 339 | { |
| 340 | i=ParsePixelChannelOption(token); |
| 341 | if (i < 0) |
| 342 | { |
| 343 | (void) ThrowMagickException(exception,GetMagickModule(),OptionError, |
cristy | abb241b | 2012-03-06 01:12:58 +0000 | [diff] [blame] | 344 | "UnrecognizedChannelType","`%s'",token); |
cristy | ab272ac | 2012-03-04 22:08:07 +0000 | [diff] [blame] | 345 | destination_image=DestroyImageList(destination_image); |
cristy | fc68ef5 | 2012-03-11 23:33:15 +0000 | [diff] [blame] | 346 | return(destination_image); |
cristy | a15140f | 2012-03-04 01:21:15 +0000 | [diff] [blame] | 347 | } |
cristy | ab272ac | 2012-03-04 22:08:07 +0000 | [diff] [blame] | 348 | destination_channel=(PixelChannel) i; |
cristy | aa2c16c | 2012-03-25 22:21:35 +0000 | [diff] [blame] | 349 | channel_mask=(ChannelType) (channel_mask | ParseChannelOption(token)); |
cristy | 4b4a93a | 2012-03-21 23:15:56 +0000 | [diff] [blame] | 350 | if (LocaleCompare(token,"gray") == 0) |
cristy | fe88ede | 2012-03-22 00:34:48 +0000 | [diff] [blame] | 351 | (void) SetImageColorspace(destination_image,GRAYColorspace,exception); |
cristy | 542dd0b | 2012-03-18 19:10:09 +0000 | [diff] [blame] | 352 | if ((LocaleCompare(token,"black") == 0) || |
| 353 | (LocaleCompare(token,"c") == 0) || |
| 354 | (LocaleCompare(token,"cyan") == 0) || |
| 355 | (LocaleCompare(token,"k") == 0) || |
| 356 | (LocaleCompare(token,"m") == 0) || |
| 357 | (LocaleCompare(token,"magenta") == 0) || |
| 358 | (LocaleCompare(token,"y") == 0) || |
| 359 | (LocaleCompare(token,"yellow") == 0)) |
cristy | 322d07d | 2012-03-18 21:17:23 +0000 | [diff] [blame] | 360 | (void) SetImageColorspace(destination_image,CMYKColorspace,exception); |
cristy | eef2176 | 2012-03-18 19:12:58 +0000 | [diff] [blame] | 361 | if ((LocaleCompare(token,"Cb") == 0) || |
| 362 | (LocaleCompare(token,"Cr") == 0)) |
cristy | 322d07d | 2012-03-18 21:17:23 +0000 | [diff] [blame] | 363 | (void) SetImageColorspace(destination_image,YCbCrColorspace, |
| 364 | exception); |
| 365 | if (LocaleCompare(token,"alpha") == 0) |
| 366 | (void) SetImageAlpha(destination_image,OpaqueAlpha,exception); |
cristy | 25d5448 | 2012-03-18 22:33:54 +0000 | [diff] [blame] | 367 | if (i >= (ssize_t) GetPixelChannels(destination_image)) |
cristy | dfdb19e | 2012-03-21 22:22:24 +0000 | [diff] [blame] | 368 | (void) SetPixelMetaChannels(destination_image,(size_t) (i- |
| 369 | GetPixelChannels(destination_image)+1),exception); |
cristy | 3bb378a | 2012-03-08 14:38:52 +0000 | [diff] [blame] | 370 | GetMagickToken(p,&p,token); |
cristy | 8748f56 | 2012-03-08 13:58:34 +0000 | [diff] [blame] | 371 | break; |
cristy | a15140f | 2012-03-04 01:21:15 +0000 | [diff] [blame] | 372 | } |
cristy | fe88ede | 2012-03-22 00:34:48 +0000 | [diff] [blame] | 373 | default: |
cristy | 3c21361 | 2012-03-16 01:14:48 +0000 | [diff] [blame] | 374 | break; |
cristy | 7ea920d | 2012-03-16 01:08:01 +0000 | [diff] [blame] | 375 | } |
cristy | 3bb378a | 2012-03-08 14:38:52 +0000 | [diff] [blame] | 376 | status=ChannelImage(destination_image,destination_channel,channel_op, |
| 377 | source_image,source_channel,ClampToQuantum(pixel),exception); |
cristy | a15140f | 2012-03-04 01:21:15 +0000 | [diff] [blame] | 378 | if (status == MagickFalse) |
| 379 | { |
cristy | ab272ac | 2012-03-04 22:08:07 +0000 | [diff] [blame] | 380 | destination_image=DestroyImageList(destination_image); |
cristy | a15140f | 2012-03-04 01:21:15 +0000 | [diff] [blame] | 381 | break; |
| 382 | } |
cristy | 4ee6040 | 2012-03-11 02:01:20 +0000 | [diff] [blame] | 383 | channels++; |
cristy | 8748f56 | 2012-03-08 13:58:34 +0000 | [diff] [blame] | 384 | if (channel_op == ExchangeChannelOp) |
| 385 | { |
cristy | 4ee6040 | 2012-03-11 02:01:20 +0000 | [diff] [blame] | 386 | status=ChannelImage(destination_image,source_channel,channel_op, |
| 387 | source_image,destination_channel,ClampToQuantum(pixel),exception); |
cristy | 8748f56 | 2012-03-08 13:58:34 +0000 | [diff] [blame] | 388 | if (status == MagickFalse) |
| 389 | { |
| 390 | destination_image=DestroyImageList(destination_image); |
| 391 | break; |
| 392 | } |
cristy | 4ee6040 | 2012-03-11 02:01:20 +0000 | [diff] [blame] | 393 | channels++; |
cristy | 8748f56 | 2012-03-08 13:58:34 +0000 | [diff] [blame] | 394 | } |
cristy | fe88ede | 2012-03-22 00:34:48 +0000 | [diff] [blame] | 395 | switch (channel_op) |
| 396 | { |
| 397 | case ExtractChannelOp: |
| 398 | { |
cristy | aa2c16c | 2012-03-25 22:21:35 +0000 | [diff] [blame] | 399 | channel_mask=(ChannelType) (channel_mask | (1 << destination_channel)); |
| 400 | destination_channel=(PixelChannel) (destination_channel+1); |
cristy | fe88ede | 2012-03-22 00:34:48 +0000 | [diff] [blame] | 401 | break; |
| 402 | } |
| 403 | default: |
| 404 | break; |
| 405 | } |
cristy | 5f257b2 | 2012-03-07 00:27:29 +0000 | [diff] [blame] | 406 | status=SetImageProgress(source_image,ChannelFxImageTag,p-expression, |
cristy | ab272ac | 2012-03-04 22:08:07 +0000 | [diff] [blame] | 407 | strlen(expression)); |
| 408 | if (status == MagickFalse) |
| 409 | break; |
cristy | a15140f | 2012-03-04 01:21:15 +0000 | [diff] [blame] | 410 | } |
cristy | fe88ede | 2012-03-22 00:34:48 +0000 | [diff] [blame] | 411 | SetPixelChannelMapMask(destination_image,channel_mask); |
| 412 | if ((channel_op == ExtractChannelOp) && (destination_channel == 1)) |
| 413 | (void) SetImageColorspace(destination_image,GRAYColorspace,exception); |
cristy | 4ee6040 | 2012-03-11 02:01:20 +0000 | [diff] [blame] | 414 | status=SetImageStorageClass(destination_image,DirectClass,exception); |
| 415 | if (status == MagickFalse) |
| 416 | { |
| 417 | destination_image=GetLastImageInList(destination_image); |
| 418 | return((Image *) NULL); |
| 419 | } |
cristy | 09ef5be | 2012-03-13 13:01:27 +0000 | [diff] [blame] | 420 | return(GetFirstImageInList(destination_image)); |
cristy | d04e7bf | 2012-03-03 19:19:12 +0000 | [diff] [blame] | 421 | } |
cristy | 0c64372 | 2012-03-05 19:18:42 +0000 | [diff] [blame] | 422 | |
| 423 | /* |
| 424 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 425 | % % |
| 426 | % % |
| 427 | % % |
| 428 | % C o m b i n e I m a g e s % |
| 429 | % % |
| 430 | % % |
| 431 | % % |
| 432 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 433 | % |
| 434 | % CombineImages() combines one or more images into a single image. The |
| 435 | % grayscale value of the pixels of each image in the sequence is assigned in |
| 436 | % order to the specified channels of the combined image. The typical |
| 437 | % ordering would be image 1 => Red, 2 => Green, 3 => Blue, etc. |
| 438 | % |
| 439 | % The format of the CombineImages method is: |
| 440 | % |
| 441 | % Image *CombineImages(const Image *image,ExceptionInfo *exception) |
| 442 | % |
| 443 | % A description of each parameter follows: |
| 444 | % |
| 445 | % o image: the image. |
| 446 | % |
| 447 | % o exception: return any errors or warnings in this structure. |
| 448 | % |
| 449 | */ |
| 450 | MagickExport Image *CombineImages(const Image *image,ExceptionInfo *exception) |
| 451 | { |
| 452 | #define CombineImageTag "Combine/Image" |
| 453 | |
| 454 | CacheView |
| 455 | *combine_view; |
| 456 | |
| 457 | Image |
| 458 | *combine_image; |
| 459 | |
| 460 | MagickBooleanType |
| 461 | status; |
| 462 | |
| 463 | MagickOffsetType |
| 464 | progress; |
| 465 | |
| 466 | ssize_t |
| 467 | y; |
| 468 | |
| 469 | /* |
| 470 | Ensure the image are the same size. |
| 471 | */ |
| 472 | assert(image != (const Image *) NULL); |
| 473 | assert(image->signature == MagickSignature); |
| 474 | if (image->debug != MagickFalse) |
| 475 | (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename); |
| 476 | assert(exception != (ExceptionInfo *) NULL); |
| 477 | assert(exception->signature == MagickSignature); |
| 478 | combine_image=CloneImage(image,0,0,MagickTrue,exception); |
| 479 | if (combine_image == (Image *) NULL) |
| 480 | return((Image *) NULL); |
| 481 | if (SetImageStorageClass(combine_image,DirectClass,exception) == MagickFalse) |
| 482 | { |
| 483 | combine_image=DestroyImage(combine_image); |
| 484 | return((Image *) NULL); |
| 485 | } |
cristy | c1119af | 2012-04-16 15:28:23 +0000 | [diff] [blame] | 486 | if (IsGrayColorspace(image->colorspace) != MagickFalse) |
| 487 | (void) SetImageColorspace(combine_image,sRGBColorspace,exception); |
cristy | 0c64372 | 2012-03-05 19:18:42 +0000 | [diff] [blame] | 488 | if ((GetPixelAlphaTraits(image) & UpdatePixelTrait) != 0) |
| 489 | combine_image->matte=MagickTrue; |
| 490 | /* |
| 491 | Combine images. |
| 492 | */ |
| 493 | status=MagickTrue; |
| 494 | progress=0; |
cristy | db07095 | 2012-04-20 14:33:00 +0000 | [diff] [blame^] | 495 | combine_view=AcquireAuthenticCacheView(combine_image,exception); |
cristy | 0c64372 | 2012-03-05 19:18:42 +0000 | [diff] [blame] | 496 | for (y=0; y < (ssize_t) combine_image->rows; y++) |
| 497 | { |
| 498 | CacheView |
| 499 | *image_view; |
| 500 | |
| 501 | const Image |
| 502 | *next; |
| 503 | |
| 504 | Quantum |
| 505 | *pixels; |
| 506 | |
| 507 | register const Quantum |
| 508 | *restrict p; |
| 509 | |
| 510 | register Quantum |
| 511 | *restrict q; |
| 512 | |
| 513 | register ssize_t |
| 514 | i; |
| 515 | |
| 516 | if (status == MagickFalse) |
| 517 | continue; |
| 518 | pixels=GetCacheViewAuthenticPixels(combine_view,0,y,combine_image->columns, |
| 519 | 1,exception); |
| 520 | if (pixels == (Quantum *) NULL) |
| 521 | { |
| 522 | status=MagickFalse; |
| 523 | continue; |
| 524 | } |
| 525 | next=image; |
cristy | c1119af | 2012-04-16 15:28:23 +0000 | [diff] [blame] | 526 | for (i=0; i < (ssize_t) GetPixelChannels(combine_image); i++) |
cristy | 0c64372 | 2012-03-05 19:18:42 +0000 | [diff] [blame] | 527 | { |
| 528 | PixelChannel |
| 529 | channel; |
| 530 | |
| 531 | PixelTrait |
cristy | 0c64372 | 2012-03-05 19:18:42 +0000 | [diff] [blame] | 532 | traits; |
| 533 | |
| 534 | register ssize_t |
| 535 | x; |
| 536 | |
| 537 | if (next == (Image *) NULL) |
| 538 | continue; |
cristy | c1119af | 2012-04-16 15:28:23 +0000 | [diff] [blame] | 539 | channel=GetPixelChannelMapChannel(combine_image,i); |
| 540 | traits=GetPixelChannelMapTraits(combine_image,channel); |
| 541 | if (traits == UndefinedPixelTrait) |
cristy | 0c64372 | 2012-03-05 19:18:42 +0000 | [diff] [blame] | 542 | continue; |
cristy | db07095 | 2012-04-20 14:33:00 +0000 | [diff] [blame^] | 543 | image_view=AcquireVirtualCacheView(next,exception); |
cristy | 0c64372 | 2012-03-05 19:18:42 +0000 | [diff] [blame] | 544 | p=GetCacheViewVirtualPixels(image_view,0,y,next->columns,1,exception); |
| 545 | if (p == (const Quantum *) NULL) |
| 546 | continue; |
| 547 | q=pixels; |
| 548 | for (x=0; x < (ssize_t) combine_image->columns; x++) |
| 549 | { |
| 550 | if (x < (ssize_t) image->columns) |
| 551 | { |
| 552 | q[i]=GetPixelGray(image,p); |
| 553 | p+=GetPixelChannels(image); |
| 554 | } |
| 555 | q+=GetPixelChannels(combine_image); |
| 556 | } |
| 557 | image_view=DestroyCacheView(image_view); |
| 558 | next=GetNextImageInList(next); |
| 559 | if (SyncCacheViewAuthenticPixels(combine_view,exception) == MagickFalse) |
| 560 | status=MagickFalse; |
| 561 | if (image->progress_monitor != (MagickProgressMonitor) NULL) |
| 562 | { |
| 563 | MagickBooleanType |
| 564 | proceed; |
| 565 | |
| 566 | proceed=SetImageProgress(image,CombineImageTag,progress++, |
| 567 | combine_image->rows); |
| 568 | if (proceed == MagickFalse) |
| 569 | status=MagickFalse; |
| 570 | } |
| 571 | } |
| 572 | } |
| 573 | combine_view=DestroyCacheView(combine_view); |
| 574 | if (status == MagickFalse) |
| 575 | combine_image=DestroyImage(combine_image); |
| 576 | return(combine_image); |
| 577 | } |
| 578 | |
| 579 | /* |
| 580 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 581 | % % |
| 582 | % % |
| 583 | % % |
| 584 | % S e p a r a t e I m a g e % |
| 585 | % % |
| 586 | % % |
| 587 | % % |
| 588 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 589 | % |
| 590 | % SeparateImage() separates a channel from the image and returns it as a |
| 591 | % grayscale image. |
| 592 | % |
| 593 | % The format of the SeparateImage method is: |
| 594 | % |
| 595 | % Image *SeparateImage(const Image *image,const ChannelType channel, |
| 596 | % ExceptionInfo *exception) |
| 597 | % |
| 598 | % A description of each parameter follows: |
| 599 | % |
| 600 | % o image: the image. |
| 601 | % |
| 602 | % o channel: the image channel. |
| 603 | % |
| 604 | % o exception: return any errors or warnings in this structure. |
| 605 | % |
| 606 | */ |
| 607 | MagickExport Image *SeparateImage(const Image *image, |
| 608 | const ChannelType channel_type,ExceptionInfo *exception) |
| 609 | { |
| 610 | #define GetChannelBit(mask,bit) (((size_t) (mask) >> (size_t) (bit)) & 0x01) |
| 611 | #define SeparateImageTag "Separate/Image" |
| 612 | |
| 613 | CacheView |
| 614 | *image_view, |
| 615 | *separate_view; |
| 616 | |
| 617 | Image |
| 618 | *separate_image; |
| 619 | |
| 620 | MagickBooleanType |
| 621 | status; |
| 622 | |
| 623 | MagickOffsetType |
| 624 | progress; |
| 625 | |
| 626 | ssize_t |
| 627 | y; |
| 628 | |
| 629 | /* |
| 630 | Initialize spread image attributes. |
| 631 | */ |
| 632 | assert(image != (Image *) NULL); |
| 633 | assert(image->signature == MagickSignature); |
| 634 | if (image->debug != MagickFalse) |
| 635 | (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename); |
| 636 | assert(exception != (ExceptionInfo *) NULL); |
| 637 | assert(exception->signature == MagickSignature); |
| 638 | separate_image=CloneImage(image,image->columns,image->rows,MagickTrue, |
| 639 | exception); |
| 640 | if (separate_image == (Image *) NULL) |
| 641 | return((Image *) NULL); |
| 642 | if (SetImageStorageClass(separate_image,DirectClass,exception) == MagickFalse) |
| 643 | { |
| 644 | separate_image=DestroyImage(separate_image); |
| 645 | return((Image *) NULL); |
| 646 | } |
| 647 | separate_image->colorspace=GRAYColorspace; |
| 648 | /* |
| 649 | Separate image. |
| 650 | */ |
| 651 | status=MagickTrue; |
| 652 | progress=0; |
cristy | db07095 | 2012-04-20 14:33:00 +0000 | [diff] [blame^] | 653 | image_view=AcquireVirtualCacheView(image,exception); |
| 654 | separate_view=AcquireAuthenticCacheView(separate_image,exception); |
cristy | 0c64372 | 2012-03-05 19:18:42 +0000 | [diff] [blame] | 655 | #if defined(MAGICKCORE_OPENMP_SUPPORT) |
| 656 | #pragma omp parallel for schedule(static) shared(progress,status) |
| 657 | #endif |
| 658 | for (y=0; y < (ssize_t) image->rows; y++) |
| 659 | { |
| 660 | register const Quantum |
| 661 | *restrict p; |
| 662 | |
| 663 | register Quantum |
| 664 | *restrict q; |
| 665 | |
| 666 | register ssize_t |
| 667 | x; |
| 668 | |
| 669 | if (status == MagickFalse) |
| 670 | continue; |
| 671 | p=GetCacheViewVirtualPixels(image_view,0,y,image->columns,1,exception); |
| 672 | q=QueueCacheViewAuthenticPixels(separate_view,0,y,separate_image->columns,1, |
| 673 | exception); |
| 674 | if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL)) |
| 675 | { |
| 676 | status=MagickFalse; |
| 677 | continue; |
| 678 | } |
| 679 | for (x=0; x < (ssize_t) image->columns; x++) |
| 680 | { |
| 681 | register ssize_t |
| 682 | i; |
| 683 | |
| 684 | if (GetPixelMask(image,p) != 0) |
| 685 | { |
| 686 | p+=GetPixelChannels(image); |
| 687 | q+=GetPixelChannels(separate_image); |
| 688 | continue; |
| 689 | } |
| 690 | SetPixelChannel(separate_image,GrayPixelChannel,0,q); |
| 691 | for (i=0; i < (ssize_t) GetPixelChannels(image); i++) |
| 692 | { |
| 693 | PixelChannel |
| 694 | channel; |
| 695 | |
| 696 | PixelTrait |
| 697 | traits; |
| 698 | |
| 699 | channel=GetPixelChannelMapChannel(image,i); |
| 700 | traits=GetPixelChannelMapTraits(image,channel); |
| 701 | if ((traits == UndefinedPixelTrait) || |
| 702 | (GetChannelBit(channel_type,channel) == 0)) |
| 703 | continue; |
| 704 | SetPixelChannel(separate_image,GrayPixelChannel,p[i],q); |
| 705 | } |
| 706 | p+=GetPixelChannels(image); |
| 707 | q+=GetPixelChannels(separate_image); |
| 708 | } |
| 709 | if (SyncCacheViewAuthenticPixels(separate_view,exception) == MagickFalse) |
| 710 | status=MagickFalse; |
| 711 | if (image->progress_monitor != (MagickProgressMonitor) NULL) |
| 712 | { |
| 713 | MagickBooleanType |
| 714 | proceed; |
| 715 | |
| 716 | #if defined(MAGICKCORE_OPENMP_SUPPORT) |
| 717 | #pragma omp critical (MagickCore_SeparateImage) |
| 718 | #endif |
| 719 | proceed=SetImageProgress(image,SeparateImageTag,progress++,image->rows); |
| 720 | if (proceed == MagickFalse) |
| 721 | status=MagickFalse; |
| 722 | } |
| 723 | } |
| 724 | separate_view=DestroyCacheView(separate_view); |
| 725 | image_view=DestroyCacheView(image_view); |
| 726 | return(separate_image); |
| 727 | } |
| 728 | |
| 729 | /* |
| 730 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 731 | % % |
| 732 | % % |
| 733 | % % |
| 734 | % S e p a r a t e I m a g e s % |
| 735 | % % |
| 736 | % % |
| 737 | % % |
| 738 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 739 | % |
| 740 | % SeparateImages() returns a separate grayscale image for each channel |
| 741 | % specified. |
| 742 | % |
| 743 | % The format of the SeparateImages method is: |
| 744 | % |
cristy | dfdb19e | 2012-03-21 22:22:24 +0000 | [diff] [blame] | 745 | % Image *SeparateImages(const Image *image,ExceptionInfo *exception) |
cristy | 0c64372 | 2012-03-05 19:18:42 +0000 | [diff] [blame] | 746 | % |
| 747 | % A description of each parameter follows: |
| 748 | % |
| 749 | % o image: the image. |
| 750 | % |
| 751 | % o exception: return any errors or warnings in this structure. |
| 752 | % |
| 753 | */ |
cristy | dfdb19e | 2012-03-21 22:22:24 +0000 | [diff] [blame] | 754 | MagickExport Image *SeparateImages(const Image *image,ExceptionInfo *exception) |
cristy | 0c64372 | 2012-03-05 19:18:42 +0000 | [diff] [blame] | 755 | { |
| 756 | Image |
| 757 | *images, |
| 758 | *separate_image; |
| 759 | |
| 760 | register ssize_t |
| 761 | i; |
| 762 | |
| 763 | assert(image != (Image *) NULL); |
| 764 | assert(image->signature == MagickSignature); |
| 765 | if (image->debug != MagickFalse) |
| 766 | (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename); |
| 767 | images=NewImageList(); |
| 768 | for (i=0; i < (ssize_t) GetPixelChannels(image); i++) |
| 769 | { |
| 770 | PixelChannel |
| 771 | channel; |
| 772 | |
| 773 | PixelTrait |
| 774 | traits; |
| 775 | |
| 776 | channel=GetPixelChannelMapChannel(image,i); |
| 777 | traits=GetPixelChannelMapTraits(image,channel); |
| 778 | if ((traits == UndefinedPixelTrait) || |
| 779 | ((traits & UpdatePixelTrait) == 0)) |
| 780 | continue; |
| 781 | separate_image=SeparateImage(image,(ChannelType) (1 << channel),exception); |
| 782 | if (separate_image != (Image *) NULL) |
| 783 | AppendImageToList(&images,separate_image); |
| 784 | } |
| 785 | return(images); |
| 786 | } |