MagickCore  7.0.8
Convert, Edit, Or Compose Bitmap Images
channel.c
Go to the documentation of this file.
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 EEE 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 % Cristy %
17 % December 2003 %
18 % %
19 % %
20 % Copyright 1999-2018 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 % https://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"
45 #include "MagickCore/channel.h"
48 #include "MagickCore/enhance.h"
49 #include "MagickCore/image.h"
50 #include "MagickCore/list.h"
51 #include "MagickCore/log.h"
52 #include "MagickCore/monitor.h"
54 #include "MagickCore/option.h"
57 #include "MagickCore/resource_.h"
60 #include "MagickCore/token.h"
61 #include "MagickCore/utility.h"
62 #include "MagickCore/version.h"
63 
64 /*
65 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
66 % %
67 % %
68 % %
69 % C h a n n e l F x I m a g e %
70 % %
71 % %
72 % %
73 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
74 %
75 % ChannelFxImage() applies a channel expression to the specified image. The
76 % expression consists of one or more channels, either mnemonic or numeric (e.g.
77 % red, 1), separated by actions as follows:
78 %
79 % <=> exchange two channels (e.g. red<=>blue)
80 % => copy one channel to another channel (e.g. red=>green)
81 % = assign a constant value to a channel (e.g. red=50%)
82 % , write new image channels in the specified order (e.g. red, green)
83 % | add a new output image for the next set of channel operations
84 % ; move to the next input image for the source of channel data
85 %
86 % For example, to create 3 grayscale images from the red, green, and blue
87 % channels of an image, use:
88 %
89 % -channel-fx "red; green; blue"
90 %
91 % A channel without an operation symbol implies separate (i.e, semicolon).
92 %
93 % The format of the ChannelFxImage method is:
94 %
95 % Image *ChannelFxImage(const Image *image,const char *expression,
96 % ExceptionInfo *exception)
97 %
98 % A description of each parameter follows:
99 %
100 % o image: the image.
101 %
102 % o expression: A channel expression.
103 %
104 % o exception: return any errors or warnings in this structure.
105 %
106 */
107 
108 typedef enum
109 {
114 } ChannelFx;
115 
116 static MagickBooleanType ChannelImage(Image *destination_image,
117  const PixelChannel destination_channel,const ChannelFx channel_op,
118  const Image *source_image,const PixelChannel source_channel,
119  const Quantum pixel,ExceptionInfo *exception)
120 {
121  CacheView
122  *source_view,
123  *destination_view;
124 
126  status;
127 
128  size_t
129  height,
130  width;
131 
132  ssize_t
133  y;
134 
135  status=MagickTrue;
136  source_view=AcquireVirtualCacheView(source_image,exception);
137  destination_view=AcquireAuthenticCacheView(destination_image,exception);
138  height=MagickMin(source_image->rows,destination_image->rows);
139  width=MagickMin(source_image->columns,destination_image->columns);
140 #if defined(MAGICKCORE_OPENMP_SUPPORT)
141  #pragma omp parallel for schedule(static) shared(status) \
142  magick_number_threads(source_image,source_image,height,1)
143 #endif
144  for (y=0; y < (ssize_t) height; y++)
145  {
146  PixelTrait
147  destination_traits,
148  source_traits;
149 
150  register const Quantum
151  *magick_restrict p;
152 
153  register Quantum
154  *magick_restrict q;
155 
156  register ssize_t
157  x;
158 
159  if (status == MagickFalse)
160  continue;
161  p=GetCacheViewVirtualPixels(source_view,0,y,source_image->columns,1,
162  exception);
163  q=GetCacheViewAuthenticPixels(destination_view,0,y,
164  destination_image->columns,1,exception);
165  if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
166  {
167  status=MagickFalse;
168  continue;
169  }
170  destination_traits=GetPixelChannelTraits(destination_image,
171  destination_channel);
172  source_traits=GetPixelChannelTraits(source_image,source_channel);
173  if ((destination_traits == UndefinedPixelTrait) ||
174  (source_traits == UndefinedPixelTrait))
175  continue;
176  for (x=0; x < (ssize_t) width; x++)
177  {
178  if (channel_op == AssignChannelOp)
179  SetPixelChannel(destination_image,destination_channel,pixel,q);
180  else
181  SetPixelChannel(destination_image,destination_channel,
182  GetPixelChannel(source_image,source_channel,p),q);
183  p+=GetPixelChannels(source_image);
184  q+=GetPixelChannels(destination_image);
185  }
186  if (SyncCacheViewAuthenticPixels(destination_view,exception) == MagickFalse)
187  status=MagickFalse;
188  }
189  destination_view=DestroyCacheView(destination_view);
190  source_view=DestroyCacheView(source_view);
191  return(status);
192 }
193 
194 MagickExport Image *ChannelFxImage(const Image *image,const char *expression,
195  ExceptionInfo *exception)
196 {
197 #define ChannelFxImageTag "ChannelFx/Image"
198 
199  ChannelFx
200  channel_op;
201 
203  channel_mask;
204 
205  char
206  token[MagickPathExtent];
207 
208  const char
209  *p;
210 
211  const Image
212  *source_image;
213 
214  double
215  pixel;
216 
217  Image
218  *destination_image;
219 
221  status;
222 
224  source_channel,
225  destination_channel;
226 
227  ssize_t
228  channels;
229 
230  assert(image != (Image *) NULL);
231  assert(image->signature == MagickCoreSignature);
232  if (image->debug != MagickFalse)
233  (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
234  assert(exception != (ExceptionInfo *) NULL);
235  assert(exception->signature == MagickCoreSignature);
236  source_image=image;
237  destination_image=CloneImage(source_image,0,0,MagickTrue,exception);
238  if (destination_image == (Image *) NULL)
239  return((Image *) NULL);
240  if (expression == (const char *) NULL)
241  return(destination_image);
242  status=SetImageStorageClass(destination_image,DirectClass,exception);
243  if (status == MagickFalse)
244  {
245  destination_image=GetLastImageInList(destination_image);
246  return((Image *) NULL);
247  }
248  destination_channel=RedPixelChannel;
249  channel_mask=UndefinedChannel;
250  pixel=0.0;
251  p=(char *) expression;
252  GetNextToken(p,&p,MagickPathExtent,token);
253  channel_op=ExtractChannelOp;
254  for (channels=0; *token != '\0'; )
255  {
256  ssize_t
257  i;
258 
259  /*
260  Interpret channel expression.
261  */
262  switch (*token)
263  {
264  case ',':
265  {
266  GetNextToken(p,&p,MagickPathExtent,token);
267  break;
268  }
269  case '|':
270  {
271  if (GetNextImageInList(source_image) != (Image *) NULL)
272  source_image=GetNextImageInList(source_image);
273  else
274  source_image=GetFirstImageInList(source_image);
275  GetNextToken(p,&p,MagickPathExtent,token);
276  break;
277  }
278  case ';':
279  {
280  Image
281  *canvas;
282 
283  (void) SetPixelChannelMask(destination_image,channel_mask);
284  if ((channel_op == ExtractChannelOp) && (channels == 1))
285  {
286  (void) SetPixelMetaChannels(destination_image,0,exception);
287  (void) SetImageColorspace(destination_image,GRAYColorspace,
288  exception);
289  }
290  canvas=CloneImage(source_image,0,0,MagickTrue,exception);
291  if (canvas == (Image *) NULL)
292  {
293  destination_image=DestroyImageList(destination_image);
294  return(destination_image);
295  }
296  AppendImageToList(&destination_image,canvas);
297  destination_image=GetLastImageInList(destination_image);
298  status=SetImageStorageClass(destination_image,DirectClass,exception);
299  if (status == MagickFalse)
300  {
301  destination_image=GetLastImageInList(destination_image);
302  return((Image *) NULL);
303  }
304  GetNextToken(p,&p,MagickPathExtent,token);
305  channels=0;
306  destination_channel=RedPixelChannel;
307  channel_mask=UndefinedChannel;
308  break;
309  }
310  default:
311  break;
312  }
313  i=ParsePixelChannelOption(token);
314  if (i < 0)
315  {
317  "UnrecognizedChannelType","`%s'",token);
318  destination_image=DestroyImageList(destination_image);
319  return(destination_image);
320  }
321  source_channel=(PixelChannel) i;
322  channel_op=ExtractChannelOp;
323  GetNextToken(p,&p,MagickPathExtent,token);
324  if (*token == '<')
325  {
326  channel_op=ExchangeChannelOp;
327  GetNextToken(p,&p,MagickPathExtent,token);
328  }
329  if (*token == '=')
330  {
331  if (channel_op != ExchangeChannelOp)
332  channel_op=AssignChannelOp;
333  GetNextToken(p,&p,MagickPathExtent,token);
334  }
335  if (*token == '>')
336  {
337  if (channel_op != ExchangeChannelOp)
338  channel_op=TransferChannelOp;
339  GetNextToken(p,&p,MagickPathExtent,token);
340  }
341  switch (channel_op)
342  {
343  case AssignChannelOp:
344  case ExchangeChannelOp:
345  case TransferChannelOp:
346  {
347  if (channel_op == AssignChannelOp)
348  pixel=StringToDoubleInterval(token,(double) QuantumRange+1.0);
349  else
350  {
351  i=ParsePixelChannelOption(token);
352  if (i < 0)
353  {
354  (void) ThrowMagickException(exception,GetMagickModule(),
355  OptionError,"UnrecognizedChannelType","`%s'",token);
356  destination_image=DestroyImageList(destination_image);
357  return(destination_image);
358  }
359  }
360  destination_channel=(PixelChannel) i;
361  if (i >= (ssize_t) GetPixelChannels(destination_image))
362  (void) SetPixelMetaChannels(destination_image,(size_t) (
363  destination_channel-GetPixelChannels(destination_image)+1),
364  exception);
365  if (image->colorspace != UndefinedColorspace)
366  switch (destination_channel)
367  {
368  case RedPixelChannel:
369  case GreenPixelChannel:
370  case BluePixelChannel:
371  case BlackPixelChannel:
372  case IndexPixelChannel:
373  break;
374  case AlphaPixelChannel:
375  {
376  destination_image->alpha_trait=BlendPixelTrait;
377  break;
378  }
380  {
381  destination_image->channels|=CompositeMaskChannel;
382  break;
383  }
385  {
386  destination_image->channels|=ReadMaskChannel;
387  break;
388  }
390  {
391  destination_image->channels|=WriteMaskChannel;
392  break;
393  }
394  case MetaPixelChannel:
395  default:
396  {
397  (void) SetPixelMetaChannels(destination_image,(size_t) (
398  destination_channel-GetPixelChannels(destination_image)+1),
399  exception);
400  break;
401  }
402  }
403  channel_mask=(ChannelType) (channel_mask | ParseChannelOption(token));
404  if (((channels >= 1) || (destination_channel >= 1)) &&
405  (IsGrayColorspace(destination_image->colorspace) != MagickFalse))
406  (void) SetImageColorspace(destination_image,sRGBColorspace,exception);
407  GetNextToken(p,&p,MagickPathExtent,token);
408  break;
409  }
410  default:
411  break;
412  }
413  status=ChannelImage(destination_image,destination_channel,channel_op,
414  source_image,source_channel,ClampToQuantum(pixel),exception);
415  if (status == MagickFalse)
416  {
417  destination_image=DestroyImageList(destination_image);
418  break;
419  }
420  channels++;
421  if (channel_op == ExchangeChannelOp)
422  {
423  status=ChannelImage(destination_image,source_channel,channel_op,
424  source_image,destination_channel,ClampToQuantum(pixel),exception);
425  if (status == MagickFalse)
426  {
427  destination_image=DestroyImageList(destination_image);
428  break;
429  }
430  channels++;
431  }
432  switch (channel_op)
433  {
434  case ExtractChannelOp:
435  {
436  channel_mask=(ChannelType) (channel_mask |
437  (1UL << destination_channel));
438  destination_channel=(PixelChannel) (destination_channel+1);
439  break;
440  }
441  default:
442  break;
443  }
444  status=SetImageProgress(source_image,ChannelFxImageTag,p-expression,
445  strlen(expression));
446  if (status == MagickFalse)
447  break;
448  }
449  (void) SetPixelChannelMask(destination_image,channel_mask);
450  if ((channel_op == ExtractChannelOp) && (channels == 1))
451  {
452  (void) SetPixelMetaChannels(destination_image,0,exception);
453  (void) SetImageColorspace(destination_image,GRAYColorspace,exception);
454  }
455  return(GetFirstImageInList(destination_image));
456 }
457 
458 /*
459 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
460 % %
461 % %
462 % %
463 % C o m b i n e I m a g e s %
464 % %
465 % %
466 % %
467 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
468 %
469 % CombineImages() combines one or more images into a single image. The
470 % grayscale value of the pixels of each image in the sequence is assigned in
471 % order to the specified channels of the combined image. The typical
472 % ordering would be image 1 => Red, 2 => Green, 3 => Blue, etc.
473 %
474 % The format of the CombineImages method is:
475 %
476 % Image *CombineImages(const Image *images,const ColorspaceType colorspace,
477 % ExceptionInfo *exception)
478 %
479 % A description of each parameter follows:
480 %
481 % o images: the image sequence.
482 %
483 % o colorspace: the image colorspace.
484 %
485 % o exception: return any errors or warnings in this structure.
486 %
487 */
489  const ColorspaceType colorspace,ExceptionInfo *exception)
490 {
491 #define CombineImageTag "Combine/Image"
492 
493  CacheView
494  *combine_view;
495 
496  Image
497  *combine_image;
498 
500  status;
501 
503  progress;
504 
505  ssize_t
506  y;
507 
508  /*
509  Ensure the image are the same size.
510  */
511  assert(image != (const Image *) NULL);
512  assert(image->signature == MagickCoreSignature);
513  if (image->debug != MagickFalse)
514  (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
515  assert(exception != (ExceptionInfo *) NULL);
516  assert(exception->signature == MagickCoreSignature);
517  combine_image=CloneImage(image,0,0,MagickTrue,exception);
518  if (combine_image == (Image *) NULL)
519  return((Image *) NULL);
520  if (SetImageStorageClass(combine_image,DirectClass,exception) == MagickFalse)
521  {
522  combine_image=DestroyImage(combine_image);
523  return((Image *) NULL);
524  }
525  if (colorspace != UndefinedColorspace)
526  (void) SetImageColorspace(combine_image,colorspace,exception);
527  else
528  if (fabs(image->gamma-1.0) <= MagickEpsilon)
529  (void) SetImageColorspace(combine_image,RGBColorspace,exception);
530  else
531  (void) SetImageColorspace(combine_image,sRGBColorspace,exception);
532  switch (combine_image->colorspace)
533  {
534  case UndefinedColorspace:
535  case sRGBColorspace:
536  {
537  if (GetImageListLength(image) > 3)
538  combine_image->alpha_trait=BlendPixelTrait;
539  break;
540  }
542  case GRAYColorspace:
543  {
544  if (GetImageListLength(image) > 1)
545  combine_image->alpha_trait=BlendPixelTrait;
546  break;
547  }
548  case CMYKColorspace:
549  {
550  if (GetImageListLength(image) > 4)
551  combine_image->alpha_trait=BlendPixelTrait;
552  break;
553  }
554  default:
555  break;
556  }
557  /*
558  Combine images.
559  */
560  status=MagickTrue;
561  progress=0;
562  combine_view=AcquireAuthenticCacheView(combine_image,exception);
563  for (y=0; y < (ssize_t) combine_image->rows; y++)
564  {
565  CacheView
566  *image_view;
567 
568  const Image
569  *next;
570 
571  Quantum
572  *pixels;
573 
574  register const Quantum
575  *magick_restrict p;
576 
577  register Quantum
578  *magick_restrict q;
579 
580  register ssize_t
581  i;
582 
583  if (status == MagickFalse)
584  continue;
585  pixels=GetCacheViewAuthenticPixels(combine_view,0,y,combine_image->columns,
586  1,exception);
587  if (pixels == (Quantum *) NULL)
588  {
589  status=MagickFalse;
590  continue;
591  }
592  next=image;
593  for (i=0; i < (ssize_t) GetPixelChannels(combine_image); i++)
594  {
595  register ssize_t
596  x;
597 
598  PixelChannel channel = GetPixelChannelChannel(combine_image,i);
599  PixelTrait traits = GetPixelChannelTraits(combine_image,channel);
600  if (traits == UndefinedPixelTrait)
601  continue;
602  if (next == (Image *) NULL)
603  continue;
604  image_view=AcquireVirtualCacheView(next,exception);
605  p=GetCacheViewVirtualPixels(image_view,0,y,next->columns,1,exception);
606  if (p == (const Quantum *) NULL)
607  continue;
608  q=pixels;
609  for (x=0; x < (ssize_t) combine_image->columns; x++)
610  {
611  if (x < (ssize_t) next->columns)
612  {
613  q[i]=GetPixelGray(next,p);
614  p+=GetPixelChannels(next);
615  }
616  q+=GetPixelChannels(combine_image);
617  }
618  image_view=DestroyCacheView(image_view);
619  next=GetNextImageInList(next);
620  }
621  if (SyncCacheViewAuthenticPixels(combine_view,exception) == MagickFalse)
622  status=MagickFalse;
623  if (image->progress_monitor != (MagickProgressMonitor) NULL)
624  {
626  proceed;
627 
628  proceed=SetImageProgress(image,CombineImageTag,progress++,
629  combine_image->rows);
630  if (proceed == MagickFalse)
631  status=MagickFalse;
632  }
633  }
634  combine_view=DestroyCacheView(combine_view);
635  if (status == MagickFalse)
636  combine_image=DestroyImage(combine_image);
637  return(combine_image);
638 }
639 
640 /*
641 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
642 % %
643 % %
644 % %
645 % G e t I m a g e A l p h a C h a n n e l %
646 % %
647 % %
648 % %
649 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
650 %
651 % GetImageAlphaChannel() returns MagickFalse if the image alpha channel is
652 % not activated. That is, the image is RGB rather than RGBA or CMYK rather
653 % than CMYKA.
654 %
655 % The format of the GetImageAlphaChannel method is:
656 %
657 % MagickBooleanType GetImageAlphaChannel(const Image *image)
658 %
659 % A description of each parameter follows:
660 %
661 % o image: the image.
662 %
663 */
665 {
666  assert(image != (const Image *) NULL);
667  if (image->debug != MagickFalse)
668  (void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");
669  assert(image->signature == MagickCoreSignature);
671 }
672 
673 /*
674 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
675 % %
676 % %
677 % %
678 % S e p a r a t e I m a g e %
679 % %
680 % %
681 % %
682 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
683 %
684 % SeparateImage() separates a channel from the image and returns it as a
685 % grayscale image.
686 %
687 % The format of the SeparateImage method is:
688 %
689 % Image *SeparateImage(const Image *image,const ChannelType channel,
690 % ExceptionInfo *exception)
691 %
692 % A description of each parameter follows:
693 %
694 % o image: the image.
695 %
696 % o channel: the image channel.
697 %
698 % o exception: return any errors or warnings in this structure.
699 %
700 */
702  const ChannelType channel_type,ExceptionInfo *exception)
703 {
704 #define GetChannelBit(mask,bit) (((size_t) (mask) >> (size_t) (bit)) & 0x01)
705 #define SeparateImageTag "Separate/Image"
706 
707  CacheView
708  *image_view,
709  *separate_view;
710 
711  Image
712  *separate_image;
713 
715  status;
716 
718  progress;
719 
720  ssize_t
721  y;
722 
723  /*
724  Initialize separate image attributes.
725  */
726  assert(image != (Image *) NULL);
727  assert(image->signature == MagickCoreSignature);
728  if (image->debug != MagickFalse)
729  (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
730  assert(exception != (ExceptionInfo *) NULL);
731  assert(exception->signature == MagickCoreSignature);
732  separate_image=CloneImage(image,0,0,MagickTrue,
733  exception);
734  if (separate_image == (Image *) NULL)
735  return((Image *) NULL);
736  if (SetImageStorageClass(separate_image,DirectClass,exception) == MagickFalse)
737  {
738  separate_image=DestroyImage(separate_image);
739  return((Image *) NULL);
740  }
741  separate_image->alpha_trait=UndefinedPixelTrait;
742  (void) SetImageColorspace(separate_image,GRAYColorspace,exception);
743  separate_image->gamma=image->gamma;
744  /*
745  Separate image.
746  */
747  status=MagickTrue;
748  progress=0;
749  image_view=AcquireVirtualCacheView(image,exception);
750  separate_view=AcquireAuthenticCacheView(separate_image,exception);
751 #if defined(MAGICKCORE_OPENMP_SUPPORT)
752  #pragma omp parallel for schedule(static) shared(progress,status) \
753  magick_number_threads(image,image,image->rows,1)
754 #endif
755  for (y=0; y < (ssize_t) image->rows; y++)
756  {
757  register const Quantum
758  *magick_restrict p;
759 
760  register Quantum
761  *magick_restrict q;
762 
763  register ssize_t
764  x;
765 
766  if (status == MagickFalse)
767  continue;
768  p=GetCacheViewVirtualPixels(image_view,0,y,image->columns,1,exception);
769  q=QueueCacheViewAuthenticPixels(separate_view,0,y,separate_image->columns,1,
770  exception);
771  if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
772  {
773  status=MagickFalse;
774  continue;
775  }
776  for (x=0; x < (ssize_t) image->columns; x++)
777  {
778  register ssize_t
779  i;
780 
781  SetPixelChannel(separate_image,GrayPixelChannel,(Quantum) 0,q);
782  for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
783  {
784  PixelChannel channel = GetPixelChannelChannel(image,i);
785  PixelTrait traits = GetPixelChannelTraits(image,channel);
786  if ((traits == UndefinedPixelTrait) ||
787  (GetChannelBit(channel_type,channel) == 0))
788  continue;
789  SetPixelChannel(separate_image,GrayPixelChannel,p[i],q);
790  }
791  p+=GetPixelChannels(image);
792  q+=GetPixelChannels(separate_image);
793  }
794  if (SyncCacheViewAuthenticPixels(separate_view,exception) == MagickFalse)
795  status=MagickFalse;
796  if (image->progress_monitor != (MagickProgressMonitor) NULL)
797  {
799  proceed;
800 
801 #if defined(MAGICKCORE_OPENMP_SUPPORT)
802  #pragma omp critical (MagickCore_SeparateImage)
803 #endif
804  proceed=SetImageProgress(image,SeparateImageTag,progress++,image->rows);
805  if (proceed == MagickFalse)
806  status=MagickFalse;
807  }
808  }
809  separate_view=DestroyCacheView(separate_view);
810  image_view=DestroyCacheView(image_view);
811  (void) SetImageChannelMask(separate_image,DefaultChannels);
812  if (status == MagickFalse)
813  separate_image=DestroyImage(separate_image);
814  return(separate_image);
815 }
816 
817 /*
818 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
819 % %
820 % %
821 % %
822 % S e p a r a t e I m a g e s %
823 % %
824 % %
825 % %
826 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
827 %
828 % SeparateImages() returns a separate grayscale image for each channel
829 % specified.
830 %
831 % The format of the SeparateImages method is:
832 %
833 % Image *SeparateImages(const Image *image,ExceptionInfo *exception)
834 %
835 % A description of each parameter follows:
836 %
837 % o image: the image.
838 %
839 % o exception: return any errors or warnings in this structure.
840 %
841 */
843 {
844  Image
845  *images,
846  *separate_image;
847 
848  register ssize_t
849  i;
850 
851  assert(image != (Image *) NULL);
852  assert(image->signature == MagickCoreSignature);
853  if (image->debug != MagickFalse)
854  (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
855  images=NewImageList();
856  for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
857  {
858  PixelChannel channel = GetPixelChannelChannel(image,i);
859  PixelTrait traits = GetPixelChannelTraits(image,channel);
860  if ((traits == UndefinedPixelTrait) || ((traits & UpdatePixelTrait) == 0))
861  continue;
862  separate_image=SeparateImage(image,(ChannelType) (1UL << channel),
863  exception);
864  if (separate_image != (Image *) NULL)
865  AppendImageToList(&images,separate_image);
866  }
867  if (images == (Image *) NULL)
868  images=SeparateImage(image,UndefinedChannel,exception);
869  return(images);
870 }
871 
872 /*
873 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
874 % %
875 % %
876 % %
877 % S e t I m a g e A l p h a C h a n n e l %
878 % %
879 % %
880 % %
881 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
882 %
883 % SetImageAlphaChannel() activates, deactivates, resets, or sets the alpha
884 % channel.
885 %
886 % The format of the SetImageAlphaChannel method is:
887 %
888 % MagickBooleanType SetImageAlphaChannel(Image *image,
889 % const AlphaChannelOption alpha_type,ExceptionInfo *exception)
890 %
891 % A description of each parameter follows:
892 %
893 % o image: the image.
894 %
895 % o alpha_type: The alpha channel type: ActivateAlphaChannel,
896 % AssociateAlphaChannel, CopyAlphaChannel, DeactivateAlphaChannel,
897 % DisassociateAlphaChannel, ExtractAlphaChannel, OffAlphaChannel,
898 % OnAlphaChannel, OpaqueAlphaChannel, SetAlphaChannel, ShapeAlphaChannel,
899 % and TransparentAlphaChannel.
900 %
901 % o exception: return any errors or warnings in this structure.
902 %
903 */
904 
905 static inline void FlattenPixelInfo(const Image *image,const PixelInfo *p,
906  const double alpha,const Quantum *q,const double beta,
907  Quantum *composite)
908 {
909  double
910  Da,
911  gamma,
912  Sa;
913 
914  register ssize_t
915  i;
916 
917  /*
918  Compose pixel p over pixel q with the given alpha.
919  */
920  Sa=QuantumScale*alpha;
921  Da=QuantumScale*beta,
922  gamma=Sa*(-Da)+Sa+Da;
923  gamma=PerceptibleReciprocal(gamma);
924  for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
925  {
926  PixelChannel channel = GetPixelChannelChannel(image,i);
927  PixelTrait traits = GetPixelChannelTraits(image,channel);
928  if (traits == UndefinedPixelTrait)
929  continue;
930  switch (channel)
931  {
932  case RedPixelChannel:
933  {
934  composite[i]=ClampToQuantum(gamma*MagickOver_((double) q[i],beta,
935  (double) p->red,alpha));
936  break;
937  }
938  case GreenPixelChannel:
939  {
940  composite[i]=ClampToQuantum(gamma*MagickOver_((double) q[i],beta,
941  (double) p->green,alpha));
942  break;
943  }
944  case BluePixelChannel:
945  {
946  composite[i]=ClampToQuantum(gamma*MagickOver_((double) q[i],beta,
947  (double) p->blue,alpha));
948  break;
949  }
950  case BlackPixelChannel:
951  {
952  composite[i]=ClampToQuantum(gamma*MagickOver_((double) q[i],beta,
953  (double) p->black,alpha));
954  break;
955  }
956  case AlphaPixelChannel:
957  {
958  composite[i]=ClampToQuantum(QuantumRange*(Sa*(-Da)+Sa+Da));
959  break;
960  }
961  default:
962  break;
963  }
964  }
965 }
966 
968  const AlphaChannelOption alpha_type,ExceptionInfo *exception)
969 {
970  CacheView
971  *image_view;
972 
974  status;
975 
976  ssize_t
977  y;
978 
979  assert(image != (Image *) NULL);
980  if (image->debug != MagickFalse)
981  (void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");
982  assert(image->signature == MagickCoreSignature);
983  status=MagickTrue;
984  switch (alpha_type)
985  {
987  {
989  break;
990  }
992  {
993  /*
994  Associate alpha.
995  */
996  status=SetImageStorageClass(image,DirectClass,exception);
997  if (status == MagickFalse)
998  break;
999  image_view=AcquireAuthenticCacheView(image,exception);
1000 #if defined(MAGICKCORE_OPENMP_SUPPORT)
1001  #pragma omp parallel for schedule(static) shared(status) \
1002  magick_number_threads(image,image,image->rows,1)
1003 #endif
1004  for (y=0; y < (ssize_t) image->rows; y++)
1005  {
1006  register Quantum
1007  *magick_restrict q;
1008 
1009  register ssize_t
1010  x;
1011 
1012  if (status == MagickFalse)
1013  continue;
1014  q=GetCacheViewAuthenticPixels(image_view,0,y,image->columns,1,
1015  exception);
1016  if (q == (Quantum *) NULL)
1017  {
1018  status=MagickFalse;
1019  continue;
1020  }
1021  for (x=0; x < (ssize_t) image->columns; x++)
1022  {
1023  double
1024  gamma;
1025 
1026  register ssize_t
1027  i;
1028 
1029  gamma=QuantumScale*GetPixelAlpha(image,q);
1030  for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
1031  {
1032  PixelChannel channel = GetPixelChannelChannel(image,i);
1033  PixelTrait traits = GetPixelChannelTraits(image,channel);
1034  if (channel == AlphaPixelChannel)
1035  continue;
1036  if ((traits & UpdatePixelTrait) == 0)
1037  continue;
1038  q[i]=ClampToQuantum(gamma*q[i]);
1039  }
1040  q+=GetPixelChannels(image);
1041  }
1042  if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)
1043  status=MagickFalse;
1044  }
1045  image_view=DestroyCacheView(image_view);
1046  image->alpha_trait=CopyPixelTrait;
1047  return(status);
1048  }
1050  {
1051  /*
1052  Set transparent pixels to background color.
1053  */
1054  if (image->alpha_trait == UndefinedPixelTrait)
1055  break;
1056  status=SetImageStorageClass(image,DirectClass,exception);
1057  if (status == MagickFalse)
1058  break;
1059  image_view=AcquireAuthenticCacheView(image,exception);
1060 #if defined(MAGICKCORE_OPENMP_SUPPORT)
1061  #pragma omp parallel for schedule(static) shared(status) \
1062  magick_number_threads(image,image,image->rows,1)
1063 #endif
1064  for (y=0; y < (ssize_t) image->rows; y++)
1065  {
1066  register Quantum
1067  *magick_restrict q;
1068 
1069  register ssize_t
1070  x;
1071 
1072  if (status == MagickFalse)
1073  continue;
1074  q=GetCacheViewAuthenticPixels(image_view,0,y,image->columns,1,
1075  exception);
1076  if (q == (Quantum *) NULL)
1077  {
1078  status=MagickFalse;
1079  continue;
1080  }
1081  for (x=0; x < (ssize_t) image->columns; x++)
1082  {
1083  if (GetPixelAlpha(image,q) == TransparentAlpha)
1084  {
1085  SetPixelViaPixelInfo(image,&image->background_color,q);
1087  }
1088  q+=GetPixelChannels(image);
1089  }
1090  if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)
1091  status=MagickFalse;
1092  }
1093  image_view=DestroyCacheView(image_view);
1094  return(status);
1095  }
1096  case CopyAlphaChannel:
1097  {
1099  status=CompositeImage(image,image,IntensityCompositeOp,MagickTrue,0,0,
1100  exception);
1101  break;
1102  }
1104  {
1105  if (image->alpha_trait == UndefinedPixelTrait)
1106  status=SetImageAlpha(image,OpaqueAlpha,exception);
1107  image->alpha_trait=CopyPixelTrait;
1108  break;
1109  }
1111  {
1112  /*
1113  Disassociate alpha.
1114  */
1115  status=SetImageStorageClass(image,DirectClass,exception);
1116  if (status == MagickFalse)
1117  break;
1119  image_view=AcquireAuthenticCacheView(image,exception);
1120 #if defined(MAGICKCORE_OPENMP_SUPPORT)
1121  #pragma omp parallel for schedule(static) shared(status) \
1122  magick_number_threads(image,image,image->rows,1)
1123 #endif
1124  for (y=0; y < (ssize_t) image->rows; y++)
1125  {
1126  register Quantum
1127  *magick_restrict q;
1128 
1129  register ssize_t
1130  x;
1131 
1132  if (status == MagickFalse)
1133  continue;
1134  q=GetCacheViewAuthenticPixels(image_view,0,y,image->columns,1,
1135  exception);
1136  if (q == (Quantum *) NULL)
1137  {
1138  status=MagickFalse;
1139  continue;
1140  }
1141  for (x=0; x < (ssize_t) image->columns; x++)
1142  {
1143  double
1144  gamma,
1145  Sa;
1146 
1147  register ssize_t
1148  i;
1149 
1150  Sa=QuantumScale*GetPixelAlpha(image,q);
1151  gamma=PerceptibleReciprocal(Sa);
1152  for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
1153  {
1154  PixelChannel channel = GetPixelChannelChannel(image,i);
1155  PixelTrait traits = GetPixelChannelTraits(image,channel);
1156  if (channel == AlphaPixelChannel)
1157  continue;
1158  if ((traits & UpdatePixelTrait) == 0)
1159  continue;
1160  q[i]=ClampToQuantum(gamma*q[i]);
1161  }
1162  q+=GetPixelChannels(image);
1163  }
1164  if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)
1165  status=MagickFalse;
1166  }
1167  image_view=DestroyCacheView(image_view);
1169  return(status);
1170  }
1171  case DiscreteAlphaChannel:
1172  {
1173  if (image->alpha_trait == UndefinedPixelTrait)
1174  status=SetImageAlpha(image,OpaqueAlpha,exception);
1176  break;
1177  }
1178  case ExtractAlphaChannel:
1179  {
1180  status=CompositeImage(image,image,AlphaCompositeOp,MagickTrue,0,0,
1181  exception);
1183  break;
1184  }
1185  case OffAlphaChannel:
1186  {
1188  break;
1189  }
1190  case OnAlphaChannel:
1191  {
1192  if (image->alpha_trait == UndefinedPixelTrait)
1193  status=SetImageAlpha(image,OpaqueAlpha,exception);
1195  break;
1196  }
1197  case OpaqueAlphaChannel:
1198  {
1199  status=SetImageAlpha(image,OpaqueAlpha,exception);
1200  break;
1201  }
1202  case RemoveAlphaChannel:
1203  {
1204  /*
1205  Remove transparency.
1206  */
1207  if (image->alpha_trait == UndefinedPixelTrait)
1208  break;
1209  status=SetImageStorageClass(image,DirectClass,exception);
1210  if (status == MagickFalse)
1211  break;
1212  image_view=AcquireAuthenticCacheView(image,exception);
1213 #if defined(MAGICKCORE_OPENMP_SUPPORT)
1214  #pragma omp parallel for schedule(static) shared(status) \
1215  magick_number_threads(image,image,image->rows,1)
1216 #endif
1217  for (y=0; y < (ssize_t) image->rows; y++)
1218  {
1219  register Quantum
1220  *magick_restrict q;
1221 
1222  register ssize_t
1223  x;
1224 
1225  if (status == MagickFalse)
1226  continue;
1227  q=GetCacheViewAuthenticPixels(image_view,0,y,image->columns,1,
1228  exception);
1229  if (q == (Quantum *) NULL)
1230  {
1231  status=MagickFalse;
1232  continue;
1233  }
1234  for (x=0; x < (ssize_t) image->columns; x++)
1235  {
1236  FlattenPixelInfo(image,&image->background_color,
1237  image->background_color.alpha,q,(double) GetPixelAlpha(image,q),q);
1238  q+=GetPixelChannels(image);
1239  }
1240  if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)
1241  status=MagickFalse;
1242  }
1243  image_view=DestroyCacheView(image_view);
1245  break;
1246  }
1247  case SetAlphaChannel:
1248  {
1249  if (image->alpha_trait == UndefinedPixelTrait)
1250  status=SetImageAlpha(image,OpaqueAlpha,exception);
1251  break;
1252  }
1253  case ShapeAlphaChannel:
1254  {
1255  /*
1256  Set alpha channel by shape.
1257  */
1258  status=SetImageStorageClass(image,DirectClass,exception);
1259  if (status == MagickFalse)
1260  break;
1262  (void) SetImageMask(image,WritePixelMask,image,exception);
1263  (void) LevelImageColors(image,&image->background_color,
1264  &image->background_color,MagickTrue,exception);
1265  (void) SetImageMask(image,WritePixelMask,(Image *) NULL,exception);
1266  break;
1267  }
1269  {
1270  status=SetImageAlpha(image,TransparentAlpha,exception);
1271  break;
1272  }
1273  case UndefinedAlphaChannel:
1274  break;
1275  }
1276  if (status == MagickFalse)
1277  return(status);
1278  (void) SetPixelChannelMask(image,image->channel_mask);
1279  return(SyncImagePixelCache(image,exception));
1280 }
size_t rows
Definition: image.h:172
#define magick_restrict
Definition: MagickCore.h:41
MagickExport CacheView * DestroyCacheView(CacheView *cache_view)
Definition: cache-view.c:252
static double MagickOver_(const double p, const double alpha, const double q, const double beta)
#define TransparentAlpha
Definition: image.h:26
static MagickBooleanType SetImageProgress(const Image *image, const char *tag, const MagickOffsetType offset, const MagickSizeType extent)
#define GetChannelBit(mask, bit)
MagickProgressMonitor progress_monitor
Definition: image.h:303
static Quantum GetPixelAlpha(const Image *magick_restrict image, const Quantum *magick_restrict pixel)
PixelTrait alpha_trait
Definition: pixel.h:179
AlphaChannelOption
Definition: image.h:28
static Quantum GetPixelGray(const Image *magick_restrict image, const Quantum *magick_restrict pixel)
size_t signature
Definition: exception.h:123
ChannelFx
Definition: channel.c:108
#define CombineImageTag
#define OpaqueAlpha
Definition: image.h:25
static Quantum GetPixelChannel(const Image *magick_restrict image, const PixelChannel channel, const Quantum *magick_restrict pixel)
MagickPrivate MagickBooleanType SyncImagePixelCache(Image *, ExceptionInfo *)
Definition: cache.c:5501
MagickRealType red
Definition: pixel.h:191
MagickExport MagickBooleanType SetImageAlpha(Image *image, const Quantum alpha, ExceptionInfo *exception)
Definition: image.c:2314
static PixelTrait GetPixelChannelTraits(const Image *magick_restrict image, const PixelChannel channel)
MagickExport Image * ChannelFxImage(const Image *image, const char *expression, ExceptionInfo *exception)
Definition: channel.c:194
static void SetPixelViaPixelInfo(const Image *magick_restrict image, const PixelInfo *magick_restrict pixel_info, Quantum *magick_restrict pixel)
static MagickBooleanType IsGrayColorspace(const ColorspaceType colorspace)
MagickExport const Quantum * GetCacheViewVirtualPixels(const CacheView *cache_view, const ssize_t x, const ssize_t y, const size_t columns, const size_t rows, ExceptionInfo *exception)
Definition: cache-view.c:651
MagickRealType alpha
Definition: pixel.h:191
#define MagickEpsilon
Definition: magick-type.h:110
MagickExport MagickBooleanType CompositeImage(Image *image, const Image *composite, const CompositeOperator compose, const MagickBooleanType clip_to_self, const ssize_t x_offset, const ssize_t y_offset, ExceptionInfo *exception)
Definition: composite.c:528
MagickExport Image * CombineImages(const Image *image, const ColorspaceType colorspace, ExceptionInfo *exception)
Definition: channel.c:488
Definition: log.h:52
ssize_t MagickOffsetType
Definition: magick-type.h:127
MagickExport ssize_t ParseChannelOption(const char *channels)
Definition: option.c:2839
Definition: image.h:151
#define MagickCoreSignature
MagickExport Quantum * GetCacheViewAuthenticPixels(CacheView *cache_view, const ssize_t x, const ssize_t y, const size_t columns, const size_t rows, ExceptionInfo *exception)
Definition: cache-view.c:299
MagickExport Image * GetFirstImageInList(const Image *images)
Definition: list.c:545
MagickExport MagickBooleanType SetImageMask(Image *image, const PixelMask type, const Image *mask, ExceptionInfo *exception)
Definition: image.c:3157
MagickExport MagickBooleanType SetImageAlphaChannel(Image *image, const AlphaChannelOption alpha_type, ExceptionInfo *exception)
Definition: channel.c:967
MagickBooleanType
Definition: magick-type.h:156
MagickExport Image * NewImageList(void)
Definition: list.c:922
static double PerceptibleReciprocal(const double x)
static void FlattenPixelInfo(const Image *image, const PixelInfo *p, const double alpha, const Quantum *q, const double beta, Quantum *composite)
Definition: channel.c:905
MagickExport Image * SeparateImage(const Image *image, const ChannelType channel_type, ExceptionInfo *exception)
Definition: channel.c:701
ChannelType channel_mask
Definition: image.h:288
#define MagickPathExtent
PixelTrait alpha_trait
Definition: image.h:280
MagickRealType blue
Definition: pixel.h:191
MagickExport ChannelType SetPixelChannelMask(Image *image, const ChannelType channel_mask)
Definition: pixel.c:6276
MagickExport ChannelType SetImageChannelMask(Image *image, const ChannelType channel_mask)
Definition: image.c:2476
MagickExport Quantum * QueueCacheViewAuthenticPixels(CacheView *cache_view, const ssize_t x, const ssize_t y, const size_t columns, const size_t rows, ExceptionInfo *exception)
Definition: cache-view.c:977
MagickExport MagickBooleanType ThrowMagickException(ExceptionInfo *exception, const char *module, const char *function, const size_t line, const ExceptionType severity, const char *tag, const char *format,...)
Definition: exception.c:1064
MagickExport MagickBooleanType LogMagickEvent(const LogEventType type, const char *module, const char *function, const size_t line, const char *format,...)
Definition: log.c:1397
size_t signature
Definition: image.h:354
MagickExport MagickBooleanType LevelImageColors(Image *image, const PixelInfo *black_color, const PixelInfo *white_color, const MagickBooleanType invert, ExceptionInfo *exception)
Definition: enhance.c:2652
#define QuantumScale
Definition: magick-type.h:113
size_t columns
Definition: image.h:172
MagickBooleanType(* MagickProgressMonitor)(const char *, const MagickOffsetType, const MagickSizeType, void *)
Definition: monitor.h:26
MagickExport Image * GetLastImageInList(const Image *images)
Definition: list.c:721
ChannelType
Definition: pixel.h:33
MagickExport MagickBooleanType SetImageStorageClass(Image *image, const ClassType storage_class, ExceptionInfo *exception)
Definition: image.c:2592
MagickExport Image * DestroyImageList(Image *images)
Definition: list.c:446
PixelChannel
Definition: pixel.h:67
static size_t GetPixelChannels(const Image *magick_restrict image)
char filename[MagickPathExtent]
Definition: image.h:319
#define GetMagickModule()
Definition: log.h:28
static Quantum ClampToQuantum(const MagickRealType value)
Definition: quantum.h:84
static PixelChannel GetPixelChannelChannel(const Image *magick_restrict image, const ssize_t offset)
MagickExport CacheView * AcquireVirtualCacheView(const Image *image, ExceptionInfo *exception)
Definition: cache-view.c:149
MagickExport void GetNextToken(const char *start, const char **end, const size_t extent, char *token)
Definition: token.c:171
static double StringToDoubleInterval(const char *string, const double interval)
unsigned short Quantum
Definition: magick-type.h:82
MagickExport MagickBooleanType SetImageColorspace(Image *image, const ColorspaceType colorspace, ExceptionInfo *exception)
Definition: colorspace.c:1134
MagickExport MagickBooleanType GetImageAlphaChannel(const Image *image)
Definition: channel.c:664
ChannelType channels
Definition: image.h:366
MagickExport Image * GetNextImageInList(const Image *images)
Definition: list.c:755
MagickRealType black
Definition: pixel.h:191
#define SeparateImageTag
static void SetPixelChannel(const Image *magick_restrict image, const PixelChannel channel, const Quantum quantum, Quantum *magick_restrict pixel)
MagickExport void AppendImageToList(Image **images, const Image *append)
Definition: list.c:77
#define MagickMin(x, y)
Definition: image-private.h:27
ColorspaceType
Definition: colorspace.h:25
#define ChannelFxImageTag
MagickRealType green
Definition: pixel.h:191
MagickExport ssize_t ParsePixelChannelOption(const char *channels)
Definition: option.c:3065
#define MagickExport
MagickExport MagickBooleanType SyncCacheViewAuthenticPixels(CacheView *magick_restrict cache_view, ExceptionInfo *exception)
Definition: cache-view.c:1100
MagickExport MagickBooleanType SetPixelMetaChannels(Image *image, const size_t number_meta_channels, ExceptionInfo *exception)
Definition: pixel.c:6360
MagickExport CacheView * AcquireAuthenticCacheView(const Image *image, ExceptionInfo *exception)
Definition: cache-view.c:112
PixelTrait
Definition: pixel.h:135
PixelInfo background_color
Definition: image.h:179
MagickExport size_t GetImageListLength(const Image *images)
Definition: list.c:680
static MagickBooleanType ChannelImage(Image *destination_image, const PixelChannel destination_channel, const ChannelFx channel_op, const Image *source_image, const PixelChannel source_channel, const Quantum pixel, ExceptionInfo *exception)
Definition: channel.c:116
MagickExport Image * SeparateImages(const Image *image, ExceptionInfo *exception)
Definition: channel.c:842
MagickExport Image * DestroyImage(Image *image)
Definition: image.c:1177
MagickExport Image * CloneImage(const Image *image, const size_t columns, const size_t rows, const MagickBooleanType detach, ExceptionInfo *exception)
Definition: image.c:794
double gamma
Definition: image.h:186
ColorspaceType colorspace
Definition: image.h:157
#define QuantumRange
Definition: magick-type.h:83
MagickBooleanType debug
Definition: image.h:334