magick-image.c

Go to the documentation of this file.
00001 /*
00002 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00003 %                                                                             %
00004 %                                                                             %
00005 %                                                                             %
00006 %                 M   M   AAA    GGGG  IIIII   CCCC  K   K                    %
00007 %                 MM MM  A   A  G        I    C      K  K                     %
00008 %                 M M M  AAAAA  G GGG    I    C      KKK                      %
00009 %                 M   M  A   A  G   G    I    C      K  K                     %
00010 %                 M   M  A   A   GGGG  IIIII   CCCC  K   K                    %
00011 %                                                                             %
00012 %                     IIIII  M   M   AAA    GGGG  EEEEE                       %
00013 %                       I    MM MM  A   A  G      E                           %
00014 %                       I    M M M  AAAAA  G  GG  EEE                         %
00015 %                       I    M   M  A   A  G   G  E                           %
00016 %                     IIIII  M   M  A   A   GGGG  EEEEE                       %
00017 %                                                                             %
00018 %                                                                             %
00019 %                          MagickWand Image Methods                           %
00020 %                                                                             %
00021 %                               Software Design                               %
00022 %                                 John Cristy                                 %
00023 %                                 August 2003                                 %
00024 %                                                                             %
00025 %                                                                             %
00026 %  Copyright 1999-2009 ImageMagick Studio LLC, a non-profit organization      %
00027 %  dedicated to making software imaging solutions freely available.           %
00028 %                                                                             %
00029 %  You may not use this file except in compliance with the License.  You may  %
00030 %  obtain a copy of the License at                                            %
00031 %                                                                             %
00032 %    http://www.imagemagick.org/script/license.php                            %
00033 %                                                                             %
00034 %  Unless required by applicable law or agreed to in writing, software        %
00035 %  distributed under the License is distributed on an "AS IS" BASIS,          %
00036 %  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   %
00037 %  See the License for the specific language governing permissions and        %
00038 %  limitations under the License.                                             %
00039 %                                                                             %
00040 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00041 %
00042 %
00043 %
00044 */
00045 
00046 /*
00047   Include declarations.
00048 */
00049 #include "wand/studio.h"
00050 #include "wand/MagickWand.h"
00051 #include "wand/magick-wand-private.h"
00052 #include "wand/wand.h"
00053 #include "wand/pixel-wand-private.h"
00054 
00055 /*
00056   Define declarations.
00057 */
00058 #define ThrowWandException(severity,tag,context) \
00059 { \
00060   (void) ThrowMagickException(wand->exception,GetMagickModule(),severity, \
00061     tag,"`%s'",context); \
00062   return(MagickFalse); \
00063 }
00064 #define MagickWandId  "MagickWand"
00065 
00066 /*
00067 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00068 %                                                                             %
00069 %                                                                             %
00070 %                                                                             %
00071 +   C l o n e M a g i c k W a n d F r o m I m a g e s                         %
00072 %                                                                             %
00073 %                                                                             %
00074 %                                                                             %
00075 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00076 %
00077 %  CloneMagickWandFromImages() clones the magick wand and inserts a new image
00078 %  list.
00079 %
00080 %  The format of the CloneMagickWandFromImages method is:
00081 %
00082 %      MagickWand *CloneMagickWandFromImages(const MagickWand *wand,
00083 %        Image *images)
00084 %
00085 %  A description of each parameter follows:
00086 %
00087 %    o wand: the magick wand.
00088 %
00089 %    o images: replace the image list with these image(s).
00090 %
00091 */
00092 static MagickWand *CloneMagickWandFromImages(const MagickWand *wand,
00093   Image *images)
00094 {
00095   MagickWand
00096     *clone_wand;
00097 
00098   assert(wand != (MagickWand *) NULL);
00099   assert(wand->signature == WandSignature);
00100   if (wand->debug != MagickFalse)
00101     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
00102   clone_wand=(MagickWand *) AcquireMagickMemory(sizeof(*clone_wand));
00103   if (clone_wand == (MagickWand *) NULL)
00104     ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
00105       images->filename);
00106   (void) ResetMagickMemory(clone_wand,0,sizeof(*clone_wand));
00107   clone_wand->id=AcquireWandId();
00108   (void) FormatMagickString(clone_wand->name,MaxTextExtent,"%s-%lu",
00109     MagickWandId,clone_wand->id);
00110   clone_wand->exception=AcquireExceptionInfo();
00111   InheritException(clone_wand->exception,wand->exception);
00112   clone_wand->image_info=CloneImageInfo(wand->image_info);
00113   clone_wand->quantize_info=CloneQuantizeInfo(wand->quantize_info);
00114   clone_wand->images=images;
00115   clone_wand->debug=IsEventLogging();
00116   if (clone_wand->debug != MagickFalse)
00117     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clone_wand->name);
00118   clone_wand->signature=WandSignature;
00119   return(clone_wand);
00120 }
00121 
00122 /*
00123 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00124 %                                                                             %
00125 %                                                                             %
00126 %                                                                             %
00127 %   G e t I m a g e F r o m M a g i c k W a n d                               %
00128 %                                                                             %
00129 %                                                                             %
00130 %                                                                             %
00131 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00132 %
00133 %  GetImageFromMagickWand() returns the current image from the magick wand.
00134 %
00135 %  The format of the GetImageFromMagickWand method is:
00136 %
00137 %      Image *GetImageFromMagickWand(const MagickWand *wand)
00138 %
00139 %  A description of each parameter follows:
00140 %
00141 %    o wand: the magick wand.
00142 %
00143 */
00144 WandExport Image *GetImageFromMagickWand(const MagickWand *wand)
00145 {
00146   assert(wand != (MagickWand *) NULL);
00147   assert(wand->signature == WandSignature);
00148   if (wand->debug != MagickFalse)
00149     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
00150   if (wand->images == (Image *) NULL)
00151     {
00152       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
00153         "ContainsNoImages","`%s'",wand->name);
00154       return((Image *) NULL);
00155     }
00156   return(wand->images);
00157 }
00158 
00159 /*
00160 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00161 %                                                                             %
00162 %                                                                             %
00163 %                                                                             %
00164 %   M a g i c k A d a p t i v e S h a r p e n I m a g e                       %
00165 %                                                                             %
00166 %                                                                             %
00167 %                                                                             %
00168 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00169 %
00170 %  MagickAdaptiveBlurImage() adaptively blurs the image by blurring
00171 %  less intensely near image edges and more intensely far from edges. We
00172 %  blur the image with a Gaussian operator of the given radius and standard
00173 %  deviation (sigma).  For reasonable results, radius should be larger than
00174 %  sigma.  Use a radius of 0 and MagickAdaptiveBlurImage() selects a
00175 %  suitable radius for you.
00176 %
00177 %  The format of the MagickAdaptiveBlurImage method is:
00178 %
00179 %      MagickBooleanType MagickAdaptiveBlurImage(MagickWand *wand,
00180 %        const double radius,const double sigma)
00181 %      MagickBooleanType MagickAdaptiveBlurImageChannel(MagickWand *wand,
00182 %        const ChannelType channel,const double radius,const double sigma)
00183 %
00184 %  A description of each parameter follows:
00185 %
00186 %    o wand: the magick wand.
00187 %
00188 %    o channel: the image channel(s).
00189 %
00190 %    o radius: the radius of the Gaussian, in pixels, not counting the center
00191 %      pixel.
00192 %
00193 %    o sigma: the standard deviation of the Gaussian, in pixels.
00194 %
00195 */
00196 
00197 WandExport MagickBooleanType MagickAdaptiveBlurImage(MagickWand *wand,
00198   const double radius,const double sigma)
00199 {
00200   MagickBooleanType
00201     status;
00202 
00203   status=MagickAdaptiveBlurImageChannel(wand,DefaultChannels,radius,sigma);
00204   return(status);
00205 }
00206 
00207 WandExport MagickBooleanType MagickAdaptiveBlurImageChannel(MagickWand *wand,
00208   const ChannelType channel,const double radius,const double sigma)
00209 {
00210   Image
00211     *sharp_image;
00212 
00213   assert(wand != (MagickWand *) NULL);
00214   assert(wand->signature == WandSignature);
00215   if (wand->debug != MagickFalse)
00216     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
00217   if (wand->images == (Image *) NULL)
00218     ThrowWandException(WandError,"ContainsNoImages",wand->name);
00219   sharp_image=AdaptiveBlurImageChannel(wand->images,channel,radius,sigma,
00220     wand->exception);
00221   if (sharp_image == (Image *) NULL)
00222     return(MagickFalse);
00223   ReplaceImageInList(&wand->images,sharp_image);
00224   return(MagickTrue);
00225 }
00226 
00227 /*
00228 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00229 %                                                                             %
00230 %                                                                             %
00231 %                                                                             %
00232 %   M a g i c k A d a p t i v e R e s i z e I m a g e                         %
00233 %                                                                             %
00234 %                                                                             %
00235 %                                                                             %
00236 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00237 %
00238 %  MagickAdaptiveResizeImage() adaptively resize image with data dependent
00239 %  triangulation.
00240 %
00241 %      MagickBooleanType MagickAdaptiveResizeImage(MagickWand *wand,
00242 %        const unsigned long columns,const unsigned long rows)
00243 %
00244 %  A description of each parameter follows:
00245 %
00246 %    o wand: the magick wand.
00247 %
00248 %    o columns: the number of columns in the scaled image.
00249 %
00250 %    o rows: the number of rows in the scaled image.
00251 %
00252 */
00253 WandExport MagickBooleanType MagickAdaptiveResizeImage(MagickWand *wand,
00254   const unsigned long columns,const unsigned long rows)
00255 {
00256   Image
00257     *resize_image;
00258 
00259   assert(wand != (MagickWand *) NULL);
00260   assert(wand->signature == WandSignature);
00261   if (wand->debug != MagickFalse)
00262     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
00263   if (wand->images == (Image *) NULL)
00264     ThrowWandException(WandError,"ContainsNoImages",wand->name);
00265   resize_image=AdaptiveResizeImage(wand->images,columns,rows,wand->exception);
00266   if (resize_image == (Image *) NULL)
00267     return(MagickFalse);
00268   ReplaceImageInList(&wand->images,resize_image);
00269   return(MagickTrue);
00270 }
00271 
00272 /*
00273 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00274 %                                                                             %
00275 %                                                                             %
00276 %                                                                             %
00277 %   M a g i c k A d a p t i v e S h a r p e n I m a g e                       %
00278 %                                                                             %
00279 %                                                                             %
00280 %                                                                             %
00281 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00282 %
00283 %  MagickAdaptiveSharpenImage() adaptively sharpens the image by sharpening
00284 %  more intensely near image edges and less intensely far from edges. We
00285 %  sharpen the image with a Gaussian operator of the given radius and standard
00286 %  deviation (sigma).  For reasonable results, radius should be larger than
00287 %  sigma.  Use a radius of 0 and MagickAdaptiveSharpenImage() selects a
00288 %  suitable radius for you.
00289 %
00290 %  The format of the MagickAdaptiveSharpenImage method is:
00291 %
00292 %      MagickBooleanType MagickAdaptiveSharpenImage(MagickWand *wand,
00293 %        const double radius,const double sigma)
00294 %      MagickBooleanType MagickAdaptiveSharpenImageChannel(MagickWand *wand,
00295 %        const ChannelType channel,const double radius,const double sigma)
00296 %
00297 %  A description of each parameter follows:
00298 %
00299 %    o wand: the magick wand.
00300 %
00301 %    o channel: the image channel(s).
00302 %
00303 %    o radius: the radius of the Gaussian, in pixels, not counting the center
00304 %      pixel.
00305 %
00306 %    o sigma: the standard deviation of the Gaussian, in pixels.
00307 %
00308 */
00309 
00310 WandExport MagickBooleanType MagickAdaptiveSharpenImage(MagickWand *wand,
00311   const double radius,const double sigma)
00312 {
00313   MagickBooleanType
00314     status;
00315 
00316   status=MagickAdaptiveSharpenImageChannel(wand,DefaultChannels,radius,sigma);
00317   return(status);
00318 }
00319 
00320 WandExport MagickBooleanType MagickAdaptiveSharpenImageChannel(MagickWand *wand,
00321   const ChannelType channel,const double radius,const double sigma)
00322 {
00323   Image
00324     *sharp_image;
00325 
00326   assert(wand != (MagickWand *) NULL);
00327   assert(wand->signature == WandSignature);
00328   if (wand->debug != MagickFalse)
00329     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
00330   if (wand->images == (Image *) NULL)
00331     ThrowWandException(WandError,"ContainsNoImages",wand->name);
00332   sharp_image=AdaptiveSharpenImageChannel(wand->images,channel,radius,sigma,
00333     wand->exception);
00334   if (sharp_image == (Image *) NULL)
00335     return(MagickFalse);
00336   ReplaceImageInList(&wand->images,sharp_image);
00337   return(MagickTrue);
00338 }
00339 
00340 /*
00341 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00342 %                                                                             %
00343 %                                                                             %
00344 %                                                                             %
00345 %   M a g i c k A d a p t i v e T h r e s h o l d I m a g e                   %
00346 %                                                                             %
00347 %                                                                             %
00348 %                                                                             %
00349 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00350 %
00351 %  MagickAdaptiveThresholdImage() selects an individual threshold for each pixel
00352 %  based on the range of intensity values in its local neighborhood.  This
00353 %  allows for thresholding of an image whose global intensity histogram
00354 %  doesn't contain distinctive peaks.
00355 %
00356 %  The format of the AdaptiveThresholdImage method is:
00357 %
00358 %      MagickBooleanType MagickAdaptiveThresholdImage(MagickWand *wand,
00359 %        const unsigned long width,const unsigned long height,const long offset)
00360 %
00361 %  A description of each parameter follows:
00362 %
00363 %    o wand: the magick wand.
00364 %
00365 %    o width: the width of the local neighborhood.
00366 %
00367 %    o height: the height of the local neighborhood.
00368 %
00369 %    o offset: the mean offset.
00370 %
00371 */
00372 WandExport MagickBooleanType MagickAdaptiveThresholdImage(MagickWand *wand,
00373   const unsigned long width,const unsigned long height,const long offset)
00374 {
00375   Image
00376     *threshold_image;
00377 
00378   assert(wand != (MagickWand *) NULL);
00379   assert(wand->signature == WandSignature);
00380   if (wand->debug != MagickFalse)
00381     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
00382   if (wand->images == (Image *) NULL)
00383     ThrowWandException(WandError,"ContainsNoImages",wand->name);
00384   threshold_image=AdaptiveThresholdImage(wand->images,width,height,offset,
00385     wand->exception);
00386   if (threshold_image == (Image *) NULL)
00387     return(MagickFalse);
00388   ReplaceImageInList(&wand->images,threshold_image);
00389   return(MagickTrue);
00390 }
00391 
00392 /*
00393 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00394 %                                                                             %
00395 %                                                                             %
00396 %                                                                             %
00397 %   M a g i c k A d d I m a g e                                               %
00398 %                                                                             %
00399 %                                                                             %
00400 %                                                                             %
00401 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00402 %
00403 %  MagickAddImage() adds the specified images at the current image location.
00404 %
00405 %  The format of the MagickAddImage method is:
00406 %
00407 %      MagickBooleanType MagickAddImage(MagickWand *wand,
00408 %        const MagickWand *add_wand)
00409 %
00410 %  A description of each parameter follows:
00411 %
00412 %    o wand: the magick wand.
00413 %
00414 %    o add_wand: A wand that contains images to add at the current image
00415 %      location.
00416 %
00417 */
00418 
00419 static inline MagickBooleanType InsertImageInWand(MagickWand *wand,
00420   Image *images)
00421 {
00422   Image
00423     *sentinel;
00424 
00425   sentinel=wand->images;
00426   if (sentinel == (Image *) NULL)
00427     {
00428       wand->images=GetFirstImageInList(images);
00429       return(MagickTrue);
00430     }
00431   if (wand->active == MagickFalse)
00432     {
00433       if ((wand->pend != MagickFalse) && (sentinel->next == (Image *) NULL))
00434         {
00435           AppendImageToList(&sentinel,images);
00436           wand->images=GetLastImageInList(images);
00437           return(MagickTrue);
00438         }
00439       if ((wand->pend != MagickFalse) && (sentinel->previous == (Image *) NULL))
00440         {
00441           PrependImageToList(&sentinel,images);
00442           wand->images=GetFirstImageInList(images);
00443           return(MagickTrue);
00444         }
00445     }
00446   InsertImageInList(&sentinel,images);
00447   wand->images=GetFirstImageInList(images);
00448   return(MagickTrue);
00449 }
00450 
00451 WandExport MagickBooleanType MagickAddImage(MagickWand *wand,
00452   const MagickWand *add_wand)
00453 {
00454   Image
00455     *images;
00456 
00457   assert(wand != (MagickWand *) NULL);
00458   assert(wand->signature == WandSignature);
00459   if (wand->debug != MagickFalse)
00460     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
00461   assert(add_wand != (MagickWand *) NULL);
00462   assert(add_wand->signature == WandSignature);
00463   if (add_wand->images == (Image *) NULL)
00464     ThrowWandException(WandError,"ContainsNoImages",add_wand->name);
00465   images=CloneImageList(add_wand->images,wand->exception);
00466   if (images == (Image *) NULL)
00467     return(MagickFalse);
00468   return(InsertImageInWand(wand,images));
00469 }
00470 
00471 /*
00472 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00473 %                                                                             %
00474 %                                                                             %
00475 %                                                                             %
00476 %     M a g i c k A d d N o i s e I m a g e                                   %
00477 %                                                                             %
00478 %                                                                             %
00479 %                                                                             %
00480 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00481 %
00482 %  MagickAddNoiseImage() adds random noise to the image.
00483 %
00484 %  The format of the MagickAddNoiseImage method is:
00485 %
00486 %      MagickBooleanType MagickAddNoiseImage(MagickWand *wand,
00487 %        const NoiseType noise_type)
00488 %      MagickBooleanType MagickAddNoiseImageChannel(MagickWand *wand,
00489 %        const ChannelType channel,const NoiseType noise_type)
00490 %
00491 %  A description of each parameter follows:
00492 %
00493 %    o wand: the magick wand.
00494 %
00495 %    o channel: the image channel(s).
00496 %
00497 %    o noise_type:  The type of noise: Uniform, Gaussian, Multiplicative,
00498 %      Impulse, Laplacian, or Poisson.
00499 %
00500 */
00501 
00502 WandExport MagickBooleanType MagickAddNoiseImage(MagickWand *wand,
00503   const NoiseType noise_type)
00504 {
00505   MagickBooleanType
00506     status;
00507 
00508   status=MagickAddNoiseImageChannel(wand,DefaultChannels,noise_type);
00509   return(status);
00510 }
00511 
00512 WandExport MagickBooleanType MagickAddNoiseImageChannel(MagickWand *wand,
00513   const ChannelType channel,const NoiseType noise_type)
00514 {
00515   Image
00516     *noise_image;
00517 
00518   assert(wand != (MagickWand *) NULL);
00519   assert(wand->signature == WandSignature);
00520   if (wand->debug != MagickFalse)
00521     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
00522   if (wand->images == (Image *) NULL)
00523     ThrowWandException(WandError,"ContainsNoImages",wand->name);
00524   noise_image=AddNoiseImageChannel(wand->images,channel,noise_type,
00525     wand->exception);
00526   if (noise_image == (Image *) NULL)
00527     return(MagickFalse);
00528   ReplaceImageInList(&wand->images,noise_image);
00529   return(MagickTrue);
00530 }
00531 
00532 /*
00533 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00534 %                                                                             %
00535 %                                                                             %
00536 %                                                                             %
00537 %   M a g i c k A f f i n e T r a n s f o r m I m a g e                       %
00538 %                                                                             %
00539 %                                                                             %
00540 %                                                                             %
00541 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00542 %
00543 %  MagickAffineTransformImage() transforms an image as dictated by the affine
00544 %  matrix of the drawing wand.
00545 %
00546 %  The format of the MagickAffineTransformImage method is:
00547 %
00548 %      MagickBooleanType MagickAffineTransformImage(MagickWand *wand,
00549 %        const DrawingWand *drawing_wand)
00550 %
00551 %  A description of each parameter follows:
00552 %
00553 %    o wand: the magick wand.
00554 %
00555 %    o drawing_wand: the draw wand.
00556 %
00557 */
00558 WandExport MagickBooleanType MagickAffineTransformImage(MagickWand *wand,
00559   const DrawingWand *drawing_wand)
00560 {
00561   DrawInfo
00562     *draw_info;
00563 
00564   Image
00565     *affine_image;
00566 
00567   assert(wand != (MagickWand *) NULL);
00568   assert(wand->signature == WandSignature);
00569   if (wand->debug != MagickFalse)
00570     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
00571   if (wand->images == (Image *) NULL)
00572     ThrowWandException(WandError,"ContainsNoImages",wand->name);
00573   draw_info=PeekDrawingWand(drawing_wand);
00574   if (draw_info == (DrawInfo *) NULL)
00575     return(MagickFalse);
00576   affine_image=AffineTransformImage(wand->images,&draw_info->affine,
00577     wand->exception);
00578   draw_info=DestroyDrawInfo(draw_info);
00579   if (affine_image == (Image *) NULL)
00580     return(MagickFalse);
00581   ReplaceImageInList(&wand->images,affine_image);
00582   return(MagickTrue);
00583 }
00584 
00585 /*
00586 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00587 %                                                                             %
00588 %                                                                             %
00589 %                                                                             %
00590 %   M a g i c k A n n o t a t e I m a g e                                     %
00591 %                                                                             %
00592 %                                                                             %
00593 %                                                                             %
00594 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00595 %
00596 %  MagickAnnotateImage() annotates an image with text.
00597 %
00598 %  The format of the MagickAnnotateImage method is:
00599 %
00600 %      MagickBooleanType MagickAnnotateImage(MagickWand *wand,
00601 %        const DrawingWand *drawing_wand,const double x,const double y,
00602 %        const double angle,const char *text)
00603 %
00604 %  A description of each parameter follows:
00605 %
00606 %    o wand: the magick wand.
00607 %
00608 %    o drawing_wand: the draw wand.
00609 %
00610 %    o x: x ordinate to left of text
00611 %
00612 %    o y: y ordinate to text baseline
00613 %
00614 %    o angle: rotate text relative to this angle.
00615 %
00616 %    o text: text to draw
00617 %
00618 */
00619 WandExport MagickBooleanType MagickAnnotateImage(MagickWand *wand,
00620   const DrawingWand *drawing_wand,const double x,const double y,
00621   const double angle,const char *text)
00622 {
00623   char
00624     geometry[MaxTextExtent];
00625 
00626   DrawInfo
00627     *draw_info;
00628 
00629   MagickBooleanType
00630     status;
00631 
00632   assert(wand != (MagickWand *) NULL);
00633   assert(wand->signature == WandSignature);
00634   if (wand->debug != MagickFalse)
00635     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
00636   if (wand->images == (Image *) NULL)
00637     ThrowWandException(WandError,"ContainsNoImages",wand->name);
00638   draw_info=PeekDrawingWand(drawing_wand);
00639   if (draw_info == (DrawInfo *) NULL)
00640     return(MagickFalse);
00641   (void) CloneString(&draw_info->text,text);
00642   (void) FormatMagickString(geometry,MaxTextExtent,"%+g%+g",x,y);
00643   draw_info->affine.sx=cos(DegreesToRadians(fmod(angle,360.0)));
00644   draw_info->affine.rx=sin(DegreesToRadians(fmod(angle,360.0)));
00645   draw_info->affine.ry=(-sin(DegreesToRadians(fmod(angle,360.0))));
00646   draw_info->affine.sy=cos(DegreesToRadians(fmod(angle,360.0)));
00647   (void) CloneString(&draw_info->geometry,geometry);
00648   status=AnnotateImage(wand->images,draw_info);
00649   draw_info=DestroyDrawInfo(draw_info);
00650   if (status == MagickFalse)
00651     InheritException(wand->exception,&wand->images->exception);
00652   return(status);
00653 }
00654 
00655 /*
00656 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00657 %                                                                             %
00658 %                                                                             %
00659 %                                                                             %
00660 %   M a g i c k A n i m a t e I m a g e s                                     %
00661 %                                                                             %
00662 %                                                                             %
00663 %                                                                             %
00664 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00665 %
00666 %  MagickAnimateImages() animates an image or image sequence.
00667 %
00668 %  The format of the MagickAnimateImages method is:
00669 %
00670 %      MagickBooleanType MagickAnimateImages(MagickWand *wand,
00671 %        const char *server_name)
00672 %
00673 %  A description of each parameter follows:
00674 %
00675 %    o wand: the magick wand.
00676 %
00677 %    o server_name: the X server name.
00678 %
00679 */
00680 WandExport MagickBooleanType MagickAnimateImages(MagickWand *wand,
00681   const char *server_name)
00682 {
00683   MagickBooleanType
00684     status;
00685 
00686   assert(wand != (MagickWand *) NULL);
00687   assert(wand->signature == WandSignature);
00688   if (wand->debug != MagickFalse)
00689     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
00690   (void) CloneString(&wand->image_info->server_name,server_name);
00691   status=AnimateImages(wand->image_info,wand->images);
00692   if (status == MagickFalse)
00693     InheritException(wand->exception,&wand->images->exception);
00694   return(status);
00695 }
00696 
00697 /*
00698 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00699 %                                                                             %
00700 %                                                                             %
00701 %                                                                             %
00702 %   M a g i c k A p p e n d I m a g e s                                       %
00703 %                                                                             %
00704 %                                                                             %
00705 %                                                                             %
00706 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00707 %
00708 %  MagickAppendImages() append a set of images.
00709 %
00710 %  The format of the MagickAppendImages method is:
00711 %
00712 %      MagickWand *MagickAppendImages(MagickWand *wand,
00713 %        const MagickBooleanType stack)
00714 %
00715 %  A description of each parameter follows:
00716 %
00717 %    o wand: the magick wand.
00718 %
00719 %    o stack: By default, images are stacked left-to-right. Set stack to
00720 %      MagickTrue to stack them top-to-bottom.
00721 %
00722 */
00723 WandExport MagickWand *MagickAppendImages(MagickWand *wand,
00724   const MagickBooleanType stack)
00725 {
00726   Image
00727     *append_image;
00728 
00729   assert(wand != (MagickWand *) NULL);
00730   assert(wand->signature == WandSignature);
00731   if (wand->debug != MagickFalse)
00732     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
00733   if (wand->images == (Image *) NULL)
00734     return((MagickWand *) NULL);
00735   append_image=AppendImages(wand->images,stack,wand->exception);
00736   if (append_image == (Image *) NULL)
00737     return((MagickWand *) NULL);
00738   return(CloneMagickWandFromImages(wand,append_image));
00739 }
00740 
00741 /*
00742 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00743 %                                                                             %
00744 %                                                                             %
00745 %                                                                             %
00746 %   M a g i c k A u t o G a m m a I m a g e                                   %
00747 %                                                                             %
00748 %                                                                             %
00749 %                                                                             %
00750 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00751 %
00752 %  MagickAutoGammaImage() extracts the 'mean' from the image and adjust the
00753 %  image to try make set its gamma appropriatally.
00754 %
00755 %  The format of the MagickAutoGammaImage method is:
00756 %
00757 %      MagickBooleanType MagickAutoGammaImage(MagickWand *wand)
00758 %      MagickBooleanType MagickAutoGammaImageChannel(MagickWand *wand,
00759 %        const ChannelType channel)
00760 %
00761 %  A description of each parameter follows:
00762 %
00763 %    o wand: the magick wand.
00764 %
00765 %    o channel: the image channel(s).
00766 %
00767 */
00768 WandExport MagickBooleanType MagickAutoGammaImage(MagickWand *wand)
00769 {
00770   MagickBooleanType
00771     status;
00772 
00773   status=MagickAutoGammaImageChannel(wand,DefaultChannels);
00774   return(status);
00775 }
00776 
00777 WandExport MagickBooleanType MagickAutoGammaImageChannel(MagickWand *wand,
00778   const ChannelType channel)
00779 {
00780   MagickBooleanType
00781     status;
00782 
00783   assert(wand != (MagickWand *) NULL);
00784   assert(wand->signature == WandSignature);
00785   if (wand->debug != MagickFalse)
00786     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
00787   if (wand->images == (Image *) NULL)
00788     ThrowWandException(WandError,"ContainsNoImages",wand->name);
00789   status=AutoGammaImageChannel(wand->images,channel);
00790   if (status == MagickFalse)
00791     InheritException(wand->exception,&wand->images->exception);
00792   return(status);
00793 }
00794 
00795 /*
00796 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00797 %                                                                             %
00798 %                                                                             %
00799 %                                                                             %
00800 %   M a g i c k A u t o L e v e l I m a g e                                   %
00801 %                                                                             %
00802 %                                                                             %
00803 %                                                                             %
00804 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00805 %
00806 %  MagickAutoLevelImage() adjusts the levels of a particular image channel by
00807 %  scaling the minimum and maximum values to the full quantum range.
00808 %
00809 %  The format of the MagickAutoLevelImage method is:
00810 %
00811 %      MagickBooleanType MagickAutoLevelImage(MagickWand *wand)
00812 %      MagickBooleanType MagickAutoLevelImageChannel(MagickWand *wand,
00813 %        const ChannelType channel)
00814 %
00815 %  A description of each parameter follows:
00816 %
00817 %    o wand: the magick wand.
00818 %
00819 %    o channel: the image channel(s).
00820 %
00821 */
00822 WandExport MagickBooleanType MagickAutoLevelImage(MagickWand *wand)
00823 {
00824   MagickBooleanType
00825     status;
00826 
00827   status=MagickAutoLevelImageChannel(wand,DefaultChannels);
00828   return(status);
00829 }
00830 
00831 WandExport MagickBooleanType MagickAutoLevelImageChannel(MagickWand *wand,
00832   const ChannelType channel)
00833 {
00834   MagickBooleanType
00835     status;
00836 
00837   assert(wand != (MagickWand *) NULL);
00838   assert(wand->signature == WandSignature);
00839   if (wand->debug != MagickFalse)
00840     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
00841   if (wand->images == (Image *) NULL)
00842     ThrowWandException(WandError,"ContainsNoImages",wand->name);
00843   status=AutoLevelImageChannel(wand->images,channel);
00844   if (status == MagickFalse)
00845     InheritException(wand->exception,&wand->images->exception);
00846   return(status);
00847 }
00848 
00849 /*
00850 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00851 %                                                                             %
00852 %                                                                             %
00853 %                                                                             %
00854 %   M a g i c k A v e r a g e I m a g e s                                     %
00855 %                                                                             %
00856 %                                                                             %
00857 %                                                                             %
00858 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00859 %
00860 %  MagickAverageImages() average a set of images.
00861 %
00862 %  The format of the MagickAverageImages method is:
00863 %
00864 %      MagickWand *MagickAverageImages(MagickWand *wand)
00865 %
00866 %  A description of each parameter follows:
00867 %
00868 %    o wand: the magick wand.
00869 %
00870 */
00871 WandExport MagickWand *MagickAverageImages(MagickWand *wand)
00872 {
00873   Image
00874     *average_image;
00875 
00876   assert(wand != (MagickWand *) NULL);
00877   assert(wand->signature == WandSignature);
00878   if (wand->debug != MagickFalse)
00879     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
00880   if (wand->images == (Image *) NULL)
00881     return((MagickWand *) NULL);
00882   average_image=AverageImages(wand->images,wand->exception);
00883   if (average_image == (Image *) NULL)
00884     return((MagickWand *) NULL);
00885   return(CloneMagickWandFromImages(wand,average_image));
00886 }
00887 
00888 /*
00889 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00890 %                                                                             %
00891 %                                                                             %
00892 %                                                                             %
00893 %   M a g i c k B l a c k T h r e s h o l d I m a g e                         %
00894 %                                                                             %
00895 %                                                                             %
00896 %                                                                             %
00897 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00898 %
00899 %  MagickBlackThresholdImage() is like MagickThresholdImage() but  forces all
00900 %  pixels below the threshold into black while leaving all pixels above the
00901 %  threshold unchanged.
00902 %
00903 %  The format of the MagickBlackThresholdImage method is:
00904 %
00905 %      MagickBooleanType MagickBlackThresholdImage(MagickWand *wand,
00906 %        const PixelWand *threshold)
00907 %
00908 %  A description of each parameter follows:
00909 %
00910 %    o wand: the magick wand.
00911 %
00912 %    o threshold: the pixel wand.
00913 %
00914 */
00915 WandExport MagickBooleanType MagickBlackThresholdImage(MagickWand *wand,
00916   const PixelWand *threshold)
00917 {
00918   char
00919     thresholds[MaxTextExtent];
00920 
00921   MagickBooleanType
00922     status;
00923 
00924   assert(wand != (MagickWand *) NULL);
00925   assert(wand->signature == WandSignature);
00926   if (wand->debug != MagickFalse)
00927     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
00928   if (wand->images == (Image *) NULL)
00929     ThrowWandException(WandError,"ContainsNoImages",wand->name);
00930   (void) FormatMagickString(thresholds,MaxTextExtent,
00931     QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
00932     PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
00933     PixelGetBlueQuantum(threshold),PixelGetOpacityQuantum(threshold));
00934   status=BlackThresholdImage(wand->images,thresholds);
00935   if (status == MagickFalse)
00936     InheritException(wand->exception,&wand->images->exception);
00937   return(status);
00938 }
00939 
00940 /*
00941 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00942 %                                                                             %
00943 %                                                                             %
00944 %                                                                             %
00945 %   M a g i c k B l u e S h i f t I m a g e                                   %
00946 %                                                                             %
00947 %                                                                             %
00948 %                                                                             %
00949 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00950 %
00951 %  MagickBlueShiftImage() mutes the colors of the image to simulate a scene at
00952 %  nighttime in the moonlight.
00953 %
00954 %  The format of the MagickBlueShiftImage method is:
00955 %
00956 %      MagickBooleanType MagickBlueShiftImage(MagickWand *wand,
00957 %        const double factor)
00958 %
00959 %  A description of each parameter follows:
00960 %
00961 %    o wand: the magick wand.
00962 %
00963 %    o factor: the blue shift factor (default 1.5)
00964 %
00965 */
00966 WandExport MagickBooleanType MagickBlueShiftImage(MagickWand *wand,
00967   const double factor)
00968 {
00969   Image
00970     *shift_image;
00971 
00972   assert(wand != (MagickWand *) NULL);
00973   assert(wand->signature == WandSignature);
00974   if (wand->debug != MagickFalse)
00975     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
00976   if (wand->images == (Image *) NULL)
00977     ThrowWandException(WandError,"ContainsNoImages",wand->name);
00978   shift_image=BlueShiftImage(wand->images,factor,wand->exception);
00979   if (shift_image == (Image *) NULL)
00980     return(MagickFalse);
00981   ReplaceImageInList(&wand->images,shift_image);
00982   return(MagickTrue);
00983 }
00984 
00985 /*
00986 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00987 %                                                                             %
00988 %                                                                             %
00989 %                                                                             %
00990 %   M a g i c k B l u r I m a g e                                             %
00991 %                                                                             %
00992 %                                                                             %
00993 %                                                                             %
00994 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00995 %
00996 %  MagickBlurImage() blurs an image.  We convolve the image with a
00997 %  gaussian operator of the given radius and standard deviation (sigma).
00998 %  For reasonable results, the radius should be larger than sigma.  Use a
00999 %  radius of 0 and BlurImage() selects a suitable radius for you.
01000 %
01001 %  The format of the MagickBlurImage method is:
01002 %
01003 %      MagickBooleanType MagickBlurImage(MagickWand *wand,const double radius,
01004 %        const double sigma)
01005 %      MagickBooleanType MagickBlurImageChannel(MagickWand *wand,
01006 %        const ChannelType channel,const double radius,const double sigma)
01007 %
01008 %  A description of each parameter follows:
01009 %
01010 %    o wand: the magick wand.
01011 %
01012 %    o channel: the image channel(s).
01013 %
01014 %    o radius: the radius of the , in pixels, not counting the center
01015 %      pixel.
01016 %
01017 %    o sigma: the standard deviation of the , in pixels.
01018 %
01019 */
01020 
01021 WandExport MagickBooleanType MagickBlurImage(MagickWand *wand,
01022   const double radius,const double sigma)
01023 {
01024   MagickBooleanType
01025     status;
01026 
01027   status=MagickBlurImageChannel(wand,DefaultChannels,radius,sigma);
01028   return(status);
01029 }
01030 
01031 WandExport MagickBooleanType MagickBlurImageChannel(MagickWand *wand,
01032   const ChannelType channel,const double radius,const double sigma)
01033 {
01034   Image
01035     *blur_image;
01036 
01037   assert(wand != (MagickWand *) NULL);
01038   assert(wand->signature == WandSignature);
01039   if (wand->debug != MagickFalse)
01040     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
01041   if (wand->images == (Image *) NULL)
01042     ThrowWandException(WandError,"ContainsNoImages",wand->name);
01043   blur_image=BlurImageChannel(wand->images,channel,radius,sigma,
01044     wand->exception);
01045   if (blur_image == (Image *) NULL)
01046     return(MagickFalse);
01047   ReplaceImageInList(&wand->images,blur_image);
01048   return(MagickTrue);
01049 }
01050 
01051 /*
01052 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01053 %                                                                             %
01054 %                                                                             %
01055 %                                                                             %
01056 %   M a g i c k B o r d e r I m a g e                                         %
01057 %                                                                             %
01058 %                                                                             %
01059 %                                                                             %
01060 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01061 %
01062 %  MagickBorderImage() surrounds the image with a border of the color defined
01063 %  by the bordercolor pixel wand.
01064 %
01065 %  The format of the MagickBorderImage method is:
01066 %
01067 %      MagickBooleanType MagickBorderImage(MagickWand *wand,
01068 %        const PixelWand *bordercolor,const unsigned long width,
01069 %        const unsigned long height)
01070 %
01071 %  A description of each parameter follows:
01072 %
01073 %    o wand: the magick wand.
01074 %
01075 %    o bordercolor: the border color pixel wand.
01076 %
01077 %    o width: the border width.
01078 %
01079 %    o height: the border height.
01080 %
01081 */
01082 WandExport MagickBooleanType MagickBorderImage(MagickWand *wand,
01083   const PixelWand *bordercolor,const unsigned long width,
01084   const unsigned long height)
01085 {
01086   Image
01087     *border_image;
01088 
01089   RectangleInfo
01090     border_info;
01091 
01092   assert(wand != (MagickWand *) NULL);
01093   assert(wand->signature == WandSignature);
01094   if (wand->debug != MagickFalse)
01095     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
01096   if (wand->images == (Image *) NULL)
01097     ThrowWandException(WandError,"ContainsNoImages",wand->name);
01098   border_info.width=width;
01099   border_info.height=height;
01100   border_info.x=0;
01101   border_info.y=0;
01102   PixelGetQuantumColor(bordercolor,&wand->images->border_color);
01103   border_image=BorderImage(wand->images,&border_info,wand->exception);
01104   if (border_image == (Image *) NULL)
01105     return(MagickFalse);
01106   ReplaceImageInList(&wand->images,border_image);
01107   return(MagickTrue);
01108 }
01109 
01110 /*
01111 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01112 %                                                                             %
01113 %                                                                             %
01114 %                                                                             %
01115 %   M a g i c k C h a r c o a l I m a g e                                     %
01116 %                                                                             %
01117 %                                                                             %
01118 %                                                                             %
01119 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01120 %
01121 %  MagickCharcoalImage() simulates a charcoal drawing.
01122 %
01123 %  The format of the MagickCharcoalImage method is:
01124 %
01125 %      MagickBooleanType MagickCharcoalImage(MagickWand *wand,
01126 %        const double radius,const double sigma)
01127 %
01128 %  A description of each parameter follows:
01129 %
01130 %    o wand: the magick wand.
01131 %
01132 %    o radius: the radius of the Gaussian, in pixels, not counting the center
01133 %      pixel.
01134 %
01135 %    o sigma: the standard deviation of the Gaussian, in pixels.
01136 %
01137 */
01138 WandExport MagickBooleanType MagickCharcoalImage(MagickWand *wand,
01139   const double radius,const double sigma)
01140 {
01141   Image
01142     *charcoal_image;
01143 
01144   assert(wand != (MagickWand *) NULL);
01145   assert(wand->signature == WandSignature);
01146   if (wand->debug != MagickFalse)
01147     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
01148   if (wand->images == (Image *) NULL)
01149     ThrowWandException(WandError,"ContainsNoImages",wand->name);
01150   charcoal_image=CharcoalImage(wand->images,radius,sigma,wand->exception);
01151   if (charcoal_image == (Image *) NULL)
01152     return(MagickFalse);
01153   ReplaceImageInList(&wand->images,charcoal_image);
01154   return(MagickTrue);
01155 }
01156 
01157 /*
01158 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01159 %                                                                             %
01160 %                                                                             %
01161 %                                                                             %
01162 %   M a g i c k C h o p I m a g e                                             %
01163 %                                                                             %
01164 %                                                                             %
01165 %                                                                             %
01166 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01167 %
01168 %  MagickChopImage() removes a region of an image and collapses the image to
01169 %  occupy the removed portion
01170 %
01171 %  The format of the MagickChopImage method is:
01172 %
01173 %      MagickBooleanType MagickChopImage(MagickWand *wand,
01174 %        const unsigned long width,const unsigned long height,const long x,
01175 %        const long y)
01176 %
01177 %  A description of each parameter follows:
01178 %
01179 %    o wand: the magick wand.
01180 %
01181 %    o width: the region width.
01182 %
01183 %    o height: the region height.
01184 %
01185 %    o x: the region x offset.
01186 %
01187 %    o y: the region y offset.
01188 %
01189 %
01190 */
01191 WandExport MagickBooleanType MagickChopImage(MagickWand *wand,
01192   const unsigned long width,const unsigned long height,const long x,
01193   const long y)
01194 {
01195   Image
01196     *chop_image;
01197 
01198   RectangleInfo
01199     chop;
01200 
01201   assert(wand != (MagickWand *) NULL);
01202   assert(wand->signature == WandSignature);
01203   if (wand->debug != MagickFalse)
01204     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
01205   if (wand->images == (Image *) NULL)
01206     ThrowWandException(WandError,"ContainsNoImages",wand->name);
01207   chop.width=width;
01208   chop.height=height;
01209   chop.x=x;
01210   chop.y=y;
01211   chop_image=ChopImage(wand->images,&chop,wand->exception);
01212   if (chop_image == (Image *) NULL)
01213     return(MagickFalse);
01214   ReplaceImageInList(&wand->images,chop_image);
01215   return(MagickTrue);
01216 }
01217 
01218 /*
01219 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01220 %                                                                             %
01221 %                                                                             %
01222 %                                                                             %
01223 %   M a g i c k C l a m p I m a g e                                           %
01224 %                                                                             %
01225 %                                                                             %
01226 %                                                                             %
01227 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01228 %
01229 %  MagickClampImage() restricts the color range from 0 to the quantum depth.
01230 %
01231 %  The format of the MagickClampImage method is:
01232 %
01233 %      MagickBooleanType MagickClampImage(MagickWand *wand)
01234 %      MagickBooleanType MagickClampImageChannel(MagickWand *wand,
01235 %        const ChannelType channel)
01236 %
01237 %  A description of each parameter follows:
01238 %
01239 %    o wand: the magick wand.
01240 %
01241 %    o channel: the channel.
01242 %
01243 */
01244 
01245 WandExport MagickBooleanType MagickClampImage(MagickWand *wand)
01246 {
01247   MagickBooleanType
01248     status;
01249 
01250   status=MagickClampImageChannel(wand,DefaultChannels);
01251   return(status);
01252 }
01253 
01254 WandExport MagickBooleanType MagickClampImageChannel(MagickWand *wand,
01255   const ChannelType channel)
01256 {
01257   MagickBooleanType
01258     status;
01259 
01260   assert(wand != (MagickWand *) NULL);
01261   assert(wand->signature == WandSignature);
01262   if (wand->debug != MagickFalse)
01263     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
01264   if (wand->images == (Image *) NULL)
01265     ThrowWandException(WandError,"ContainsNoImages",wand->name);
01266   status=ClampImageChannel(wand->images,channel);
01267   if (status == MagickFalse)
01268     InheritException(wand->exception,&wand->images->exception);
01269   return(status);
01270 }
01271 
01272 /*
01273 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01274 %                                                                             %
01275 %                                                                             %
01276 %                                                                             %
01277 %   M a g i c k C l i p I m a g e                                             %
01278 %                                                                             %
01279 %                                                                             %
01280 %                                                                             %
01281 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01282 %
01283 %  MagickClipImage() clips along the first path from the 8BIM profile, if
01284 %  present.
01285 %
01286 %  The format of the MagickClipImage method is:
01287 %
01288 %      MagickBooleanType MagickClipImage(MagickWand *wand)
01289 %
01290 %  A description of each parameter follows:
01291 %
01292 %    o wand: the magick wand.
01293 %
01294 */
01295 WandExport MagickBooleanType MagickClipImage(MagickWand *wand)
01296 {
01297   MagickBooleanType
01298     status;
01299 
01300   assert(wand != (MagickWand *) NULL);
01301   assert(wand->signature == WandSignature);
01302   if (wand->debug != MagickFalse)
01303     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
01304   if (wand->images == (Image *) NULL)
01305     ThrowWandException(WandError,"ContainsNoImages",wand->name);
01306   status=ClipImage(wand->images);
01307   if (status == MagickFalse)
01308     InheritException(wand->exception,&wand->images->exception);
01309   return(status);
01310 }
01311 
01312 /*
01313 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01314 %                                                                             %
01315 %                                                                             %
01316 %                                                                             %
01317 %   M a g i c k C l i p I m a g e P a t h                                     %
01318 %                                                                             %
01319 %                                                                             %
01320 %                                                                             %
01321 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01322 %
01323 %  MagickClipImagePath() clips along the named paths from the 8BIM profile, if
01324 %  present. Later operations take effect inside the path.  Id may be a number
01325 %  if preceded with #, to work on a numbered path, e.g., "#1" to use the first
01326 %  path.
01327 %
01328 %  The format of the MagickClipImagePath method is:
01329 %
01330 %      MagickBooleanType MagickClipImagePath(MagickWand *wand,
01331 %        const char *pathname,const MagickBooleanType inside)
01332 %
01333 %  A description of each parameter follows:
01334 %
01335 %    o wand: the magick wand.
01336 %
01337 %    o pathname: name of clipping path resource. If name is preceded by #, use
01338 %      clipping path numbered by name.
01339 %
01340 %    o inside: if non-zero, later operations take effect inside clipping path.
01341 %      Otherwise later operations take effect outside clipping path.
01342 %
01343 */
01344 WandExport MagickBooleanType MagickClipImagePath(MagickWand *wand,
01345   const char *pathname,const MagickBooleanType inside)
01346 {
01347   MagickBooleanType
01348     status;
01349 
01350   assert(wand != (MagickWand *) NULL);
01351   assert(wand->signature == WandSignature);
01352   if (wand->debug != MagickFalse)
01353     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
01354   if (wand->images == (Image *) NULL)
01355     ThrowWandException(WandError,"ContainsNoImages",wand->name);
01356   status=ClipImagePath(wand->images,pathname,inside);
01357   if (status == MagickFalse)
01358     InheritException(wand->exception,&wand->images->exception);
01359   return(status);
01360 }
01361 
01362 /*
01363 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01364 %                                                                             %
01365 %                                                                             %
01366 %                                                                             %
01367 %   M a g i c k C l u t I m a g e                                             %
01368 %                                                                             %
01369 %                                                                             %
01370 %                                                                             %
01371 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01372 %
01373 %  MagickClutImage() replaces colors in the image from a color lookup table.
01374 %
01375 %  The format of the MagickClutImage method is:
01376 %
01377 %      MagickBooleanType MagickClutImage(MagickWand *wand,
01378 %        const MagickWand *clut_wand)
01379 %      MagickBooleanType MagickClutImageChannel(MagickWand *wand,
01380 %        const ChannelType channel,const MagickWand *clut_wand)
01381 %
01382 %  A description of each parameter follows:
01383 %
01384 %    o wand: the magick wand.
01385 %
01386 %    o clut_image: the clut image.
01387 %
01388 */
01389 
01390 WandExport MagickBooleanType MagickClutImage(MagickWand *wand,
01391   const MagickWand *clut_wand)
01392 {
01393   MagickBooleanType
01394     status;
01395 
01396   status=MagickClutImageChannel(wand,DefaultChannels,clut_wand);
01397   return(status);
01398 }
01399 
01400 WandExport MagickBooleanType MagickClutImageChannel(MagickWand *wand,
01401   const ChannelType channel,const MagickWand *clut_wand)
01402 {
01403   MagickBooleanType
01404     status;
01405 
01406   assert(wand != (MagickWand *) NULL);
01407   assert(wand->signature == WandSignature);
01408   if (wand->debug != MagickFalse)
01409     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
01410   if ((wand->images == (Image *) NULL) || (clut_wand->images == (Image *) NULL))
01411     ThrowWandException(WandError,"ContainsNoImages",wand->name);
01412   status=ClutImageChannel(wand->images,channel,clut_wand->images);
01413   if (status == MagickFalse)
01414     InheritException(wand->exception,&wand->images->exception);
01415   return(status);
01416 }
01417 
01418 /*
01419 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01420 %                                                                             %
01421 %                                                                             %
01422 %                                                                             %
01423 %   M a g i c k C o a l e s c e I m a g e s                                   %
01424 %                                                                             %
01425 %                                                                             %
01426 %                                                                             %
01427 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01428 %
01429 %  MagickCoalesceImages() composites a set of images while respecting any page
01430 %  offsets and disposal methods.  GIF, MIFF, and MNG animation sequences
01431 %  typically start with an image background and each subsequent image
01432 %  varies in size and offset.  MagickCoalesceImages() returns a new sequence
01433 %  where each image in the sequence is the same size as the first and
01434 %  composited with the next image in the sequence.
01435 %
01436 %  The format of the MagickCoalesceImages method is:
01437 %
01438 %      MagickWand *MagickCoalesceImages(MagickWand *wand)
01439 %
01440 %  A description of each parameter follows:
01441 %
01442 %    o wand: the magick wand.
01443 %
01444 */
01445 WandExport MagickWand *MagickCoalesceImages(MagickWand *wand)
01446 {
01447   Image
01448     *coalesce_image;
01449 
01450   assert(wand != (MagickWand *) NULL);
01451   assert(wand->signature == WandSignature);
01452   if (wand->debug != MagickFalse)
01453     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
01454   if (wand->images == (Image *) NULL)
01455     return((MagickWand *) NULL);
01456   coalesce_image=CoalesceImages(wand->images,wand->exception);
01457   if (coalesce_image == (Image *) NULL)
01458     return((MagickWand *) NULL);
01459   return(CloneMagickWandFromImages(wand,coalesce_image));
01460 }
01461 
01462 /*
01463 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01464 %                                                                             %
01465 %                                                                             %
01466 %                                                                             %
01467 %   M a g i c k C o l o r D e c i s i o n I m a g e                           %
01468 %                                                                             %
01469 %                                                                             %
01470 %                                                                             %
01471 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01472 %
01473 %  MagickColorDecisionListImage() accepts a lightweight Color Correction
01474 %  Collection (CCC) file which solely contains one or more color corrections
01475 %  and applies the color correction to the image.  Here is a sample CCC file:
01476 %
01477 %    <ColorCorrectionCollection xmlns="urn:ASC:CDL:v1.2">
01478 %          <ColorCorrection id="cc03345">
01479 %                <SOPNode>
01480 %                     <Slope> 0.9 1.2 0.5 </Slope>
01481 %                     <Offset> 0.4 -0.5 0.6 </Offset>
01482 %                     <Power> 1.0 0.8 1.5 </Power>
01483 %                </SOPNode>
01484 %                <SATNode>
01485 %                     <Saturation> 0.85 </Saturation>
01486 %                </SATNode>
01487 %          </ColorCorrection>
01488 %    </ColorCorrectionCollection>
01489 %
01490 %  which includes the offset, slope, and power for each of the RGB channels
01491 %  as well as the saturation.
01492 %
01493 %  The format of the MagickColorDecisionListImage method is:
01494 %
01495 %      MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
01496 %        const double gamma)
01497 %
01498 %  A description of each parameter follows:
01499 %
01500 %    o wand: the magick wand.
01501 %
01502 %    o color_correction_collection: the color correction collection in XML.
01503 %
01504 */
01505 WandExport MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
01506   const char *color_correction_collection)
01507 {
01508   MagickBooleanType
01509     status;
01510 
01511   assert(wand != (MagickWand *) NULL);
01512   assert(wand->signature == WandSignature);
01513   if (wand->debug != MagickFalse)
01514     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
01515   if (wand->images == (Image *) NULL)
01516     ThrowWandException(WandError,"ContainsNoImages",wand->name);
01517   status=ColorDecisionListImage(wand->images,color_correction_collection);
01518   if (status == MagickFalse)
01519     InheritException(wand->exception,&wand->images->exception);
01520   return(status);
01521 }
01522 
01523 /*
01524 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01525 %                                                                             %
01526 %                                                                             %
01527 %                                                                             %
01528 %   M a g i c k C o l o r i z e I m a g e                                     %
01529 %                                                                             %
01530 %                                                                             %
01531 %                                                                             %
01532 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01533 %
01534 %  MagickColorizeImage() blends the fill color with each pixel in the image.
01535 %
01536 %  The format of the MagickColorizeImage method is:
01537 %
01538 %      MagickBooleanType MagickColorizeImage(MagickWand *wand,
01539 %        const PixelWand *colorize,const PixelWand *opacity)
01540 %
01541 %  A description of each parameter follows:
01542 %
01543 %    o wand: the magick wand.
01544 %
01545 %    o colorize: the colorize pixel wand.
01546 %
01547 %    o opacity: the opacity pixel wand.
01548 %
01549 */
01550 WandExport MagickBooleanType MagickColorizeImage(MagickWand *wand,
01551   const PixelWand *colorize,const PixelWand *opacity)
01552 {
01553   char
01554     percent_opaque[MaxTextExtent];
01555 
01556   Image
01557     *colorize_image;
01558 
01559   PixelPacket
01560     target;
01561 
01562   assert(wand != (MagickWand *) NULL);
01563   assert(wand->signature == WandSignature);
01564   if (wand->debug != MagickFalse)
01565     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
01566   if (wand->images == (Image *) NULL)
01567     ThrowWandException(WandError,"ContainsNoImages",wand->name);
01568   (void) FormatMagickString(percent_opaque,MaxTextExtent,"%g,%g,%g,%g",
01569     (double) (100.0*QuantumScale*PixelGetRedQuantum(opacity)),
01570     (double) (100.0*QuantumScale*PixelGetGreenQuantum(opacity)),
01571     (double) (100.0*QuantumScale*PixelGetBlueQuantum(opacity)),
01572     (double) (100.0*QuantumScale*PixelGetOpacityQuantum(opacity)));
01573   PixelGetQuantumColor(colorize,&target);
01574   colorize_image=ColorizeImage(wand->images,percent_opaque,target,
01575     wand->exception);
01576   if (colorize_image == (Image *) NULL)
01577     return(MagickFalse);
01578   ReplaceImageInList(&wand->images,colorize_image);
01579   return(MagickTrue);
01580 }
01581 
01582 /*
01583 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01584 %                                                                             %
01585 %                                                                             %
01586 %                                                                             %
01587 %   M a g i c k C o m b i n e I m a g e s                                     %
01588 %                                                                             %
01589 %                                                                             %
01590 %                                                                             %
01591 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01592 %
01593 %  MagickCombineImages() combines one or more images into a single image.  The
01594 %  grayscale value of the pixels of each image in the sequence is assigned in
01595 %  order to the specified  hannels of the combined image.   The typical
01596 %  ordering would be image 1 => Red, 2 => Green, 3 => Blue, etc.
01597 %
01598 %  The format of the MagickCombineImages method is:
01599 %
01600 %      MagickWand *MagickCombineImages(MagickWand *wand,
01601 %        const ChannelType channel)
01602 %
01603 %  A description of each parameter follows:
01604 %
01605 %    o wand: the magick wand.
01606 %
01607 %    o channel: the channel.
01608 %
01609 */
01610 WandExport MagickWand *MagickCombineImages(MagickWand *wand,
01611   const ChannelType channel)
01612 {
01613   Image
01614     *combine_image;
01615 
01616   assert(wand != (MagickWand *) NULL);
01617   assert(wand->signature == WandSignature);
01618   if (wand->debug != MagickFalse)
01619     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
01620   if (wand->images == (Image *) NULL)
01621     return((MagickWand *) NULL);
01622   combine_image=CombineImages(wand->images,channel,wand->exception);
01623   if (combine_image == (Image *) NULL)
01624     return((MagickWand *) NULL);
01625   return(CloneMagickWandFromImages(wand,combine_image));
01626 }
01627 
01628 /*
01629 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01630 %                                                                             %
01631 %                                                                             %
01632 %                                                                             %
01633 %   M a g i c k C o m m e n t I m a g e                                       %
01634 %                                                                             %
01635 %                                                                             %
01636 %                                                                             %
01637 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01638 %
01639 %  MagickCommentImage() adds a comment to your image.
01640 %
01641 %  The format of the MagickCommentImage method is:
01642 %
01643 %      MagickBooleanType MagickCommentImage(MagickWand *wand,
01644 %        const char *comment)
01645 %
01646 %  A description of each parameter follows:
01647 %
01648 %    o wand: the magick wand.
01649 %
01650 %    o comment: the image comment.
01651 %
01652 */
01653 WandExport MagickBooleanType MagickCommentImage(MagickWand *wand,
01654   const char *comment)
01655 {
01656   MagickBooleanType
01657     status;
01658 
01659   assert(wand != (MagickWand *) NULL);
01660   assert(wand->signature == WandSignature);
01661   if (wand->debug != MagickFalse)
01662     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
01663   if (wand->images == (Image *) NULL)
01664     ThrowWandException(WandError,"ContainsNoImages",wand->name);
01665   status=SetImageProperty(wand->images,"comment",comment);
01666   if (status == MagickFalse)
01667     InheritException(wand->exception,&wand->images->exception);
01668   return(status);
01669 }
01670 
01671 /*
01672 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01673 %                                                                             %
01674 %                                                                             %
01675 %                                                                             %
01676 %   M a g i c k C o m p a r e I m a g e C h a n n e l s                       %
01677 %                                                                             %
01678 %                                                                             %
01679 %                                                                             %
01680 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01681 %
01682 %  MagickCompareImageChannels() compares one or more image channels of an image
01683 %  to a reconstructed image and returns the difference image.
01684 %
01685 %  The format of the MagickCompareImageChannels method is:
01686 %
01687 %      MagickWand *MagickCompareImageChannels(MagickWand *wand,
01688 %        const MagickWand *reference,const ChannelType channel,
01689 %        const MetricType metric,double *distortion)
01690 %
01691 %  A description of each parameter follows:
01692 %
01693 %    o wand: the magick wand.
01694 %
01695 %    o reference: the reference wand.
01696 %
01697 %    o channel: the channel.
01698 %
01699 %    o metric: the metric.
01700 %
01701 %    o distortion: the computed distortion between the images.
01702 %
01703 */
01704 WandExport MagickWand *MagickCompareImageChannels(MagickWand *wand,
01705   const MagickWand *reference,const ChannelType channel,const MetricType metric,
01706   double *distortion)
01707 {
01708   Image
01709     *compare_image;
01710 
01711   assert(wand != (MagickWand *) NULL);
01712   assert(wand->signature == WandSignature);
01713   if (wand->debug != MagickFalse)
01714     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
01715   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
01716     {
01717       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
01718         "ContainsNoImages","`%s'",wand->name);
01719       return((MagickWand *) NULL);
01720     }
01721   compare_image=CompareImageChannels(wand->images,reference->images,channel,
01722     metric,distortion,&wand->images->exception);
01723   if (compare_image == (Image *) NULL)
01724     return((MagickWand *) NULL);
01725   return(CloneMagickWandFromImages(wand,compare_image));
01726 }
01727 
01728 /*
01729 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01730 %                                                                             %
01731 %                                                                             %
01732 %                                                                             %
01733 %   M a g i c k C o m p a r e I m a g e L a y e r s                           %
01734 %                                                                             %
01735 %                                                                             %
01736 %                                                                             %
01737 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01738 %
01739 %  MagickCompareImageLayers() compares each image with the next in a sequence
01740 %  and returns the maximum bounding region of any pixel differences it
01741 %  discovers.
01742 %
01743 %  The format of the MagickCompareImageLayers method is:
01744 %
01745 %      MagickWand *MagickCompareImageLayers(MagickWand *wand,
01746 %        const ImageLayerMethod method)
01747 %
01748 %  A description of each parameter follows:
01749 %
01750 %    o wand: the magick wand.
01751 %
01752 %    o method: the compare method.
01753 %
01754 */
01755 WandExport MagickWand *MagickCompareImageLayers(MagickWand *wand,
01756   const ImageLayerMethod method)
01757 {
01758   Image
01759     *layers_image;
01760 
01761   assert(wand != (MagickWand *) NULL);
01762   assert(wand->signature == WandSignature);
01763   if (wand->debug != MagickFalse)
01764     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
01765   if (wand->images == (Image *) NULL)
01766     return((MagickWand *) NULL);
01767   layers_image=CompareImageLayers(wand->images,method,wand->exception);
01768   if (layers_image == (Image *) NULL)
01769     return((MagickWand *) NULL);
01770   return(CloneMagickWandFromImages(wand,layers_image));
01771 }
01772 
01773 /*
01774 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01775 %                                                                             %
01776 %                                                                             %
01777 %                                                                             %
01778 %   M a g i c k C o m p a r e I m a g e s                                     %
01779 %                                                                             %
01780 %                                                                             %
01781 %                                                                             %
01782 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01783 %
01784 %  MagickCompareImages() compares an image to a reconstructed image and returns
01785 %  the specified difference image.
01786 %
01787 %  The format of the MagickCompareImages method is:
01788 %
01789 %      MagickWand *MagickCompareImages(MagickWand *wand,
01790 %        const MagickWand *reference,const MetricType metric,
01791 %        double *distortion)
01792 %
01793 %  A description of each parameter follows:
01794 %
01795 %    o wand: the magick wand.
01796 %
01797 %    o reference: the reference wand.
01798 %
01799 %    o metric: the metric.
01800 %
01801 %    o distortion: the computed distortion between the images.
01802 %
01803 */
01804 WandExport MagickWand *MagickCompareImages(MagickWand *wand,
01805   const MagickWand *reference,const MetricType metric,double *distortion)
01806 {
01807   Image
01808     *compare_image;
01809 
01810 
01811   assert(wand != (MagickWand *) NULL);
01812   assert(wand->signature == WandSignature);
01813   if (wand->debug != MagickFalse)
01814     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
01815   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
01816     {
01817       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
01818         "ContainsNoImages","`%s'",wand->name);
01819       return((MagickWand *) NULL);
01820     }
01821   compare_image=CompareImages(wand->images,reference->images,metric,distortion,
01822     &wand->images->exception);
01823   if (compare_image == (Image *) NULL)
01824     return((MagickWand *) NULL);
01825   return(CloneMagickWandFromImages(wand,compare_image));
01826 }
01827 
01828 /*
01829 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01830 %                                                                             %
01831 %                                                                             %
01832 %                                                                             %
01833 %   M a g i c k C o m p o s i t e I m a g e                                   %
01834 %                                                                             %
01835 %                                                                             %
01836 %                                                                             %
01837 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01838 %
01839 %  MagickCompositeImage() composite one image onto another at the specified
01840 %  offset.
01841 %
01842 %  The format of the MagickCompositeImage method is:
01843 %
01844 %      MagickBooleanType MagickCompositeImage(MagickWand *wand,
01845 %        const MagickWand *composite_wand,const CompositeOperator compose,
01846 %        const long x,const long y)
01847 %      MagickBooleanType MagickCompositeImageChannel(MagickWand *wand,
01848 %        const ChannelType channel,const MagickWand *composite_wand,
01849 %        const CompositeOperator compose,const long x,const long y)
01850 %
01851 %  A description of each parameter follows:
01852 %
01853 %    o wand: the magick wand.
01854 %
01855 %    o composite_image: the composite image.
01856 %
01857 %    o compose: This operator affects how the composite is applied to the
01858 %      image.  The default is Over.  Choose from these operators:
01859 %
01860 %        OverCompositeOp       InCompositeOp         OutCompositeOp
01861 %        AtopCompositeOp       XorCompositeOp        PlusCompositeOp
01862 %        MinusCompositeOp      AddCompositeOp        SubtractCompositeOp
01863 %        DifferenceCompositeOp BumpmapCompositeOp    CopyCompositeOp
01864 %        DisplaceCompositeOp
01865 %
01866 %    o x: the column offset of the composited image.
01867 %
01868 %    o y: the row offset of the composited image.
01869 %
01870 */
01871 
01872 WandExport MagickBooleanType MagickCompositeImage(MagickWand *wand,
01873   const MagickWand *composite_wand,const CompositeOperator compose,const long x,
01874   const long y)
01875 {
01876   MagickBooleanType
01877     status;
01878 
01879   status=MagickCompositeImageChannel(wand,DefaultChannels,composite_wand,
01880     compose,x,y);
01881   return(status);
01882 }
01883 
01884 WandExport MagickBooleanType MagickCompositeImageChannel(MagickWand *wand,
01885   const ChannelType channel,const MagickWand *composite_wand,
01886   const CompositeOperator compose,const long x,const long y)
01887 {
01888   MagickBooleanType
01889     status;
01890 
01891   assert(wand != (MagickWand *) NULL);
01892   assert(wand->signature == WandSignature);
01893   if (wand->debug != MagickFalse)
01894     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
01895   if ((wand->images == (Image *) NULL) ||
01896       (composite_wand->images == (Image *) NULL))
01897     ThrowWandException(WandError,"ContainsNoImages",wand->name);
01898   status=CompositeImageChannel(wand->images,channel,compose,
01899     composite_wand->images,x,y);
01900   if (status == MagickFalse)
01901     InheritException(wand->exception,&wand->images->exception);
01902   return(status);
01903 }
01904 
01905 /*
01906 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01907 %                                                                             %
01908 %                                                                             %
01909 %                                                                             %
01910 %   M a g i c k C o n t r a s t I m a g e                                     %
01911 %                                                                             %
01912 %                                                                             %
01913 %                                                                             %
01914 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01915 %
01916 %  MagickContrastImage() enhances the intensity differences between the lighter
01917 %  and darker elements of the image.  Set sharpen to a value other than 0 to
01918 %  increase the image contrast otherwise the contrast is reduced.
01919 %
01920 %  The format of the MagickContrastImage method is:
01921 %
01922 %      MagickBooleanType MagickContrastImage(MagickWand *wand,
01923 %        const MagickBooleanType sharpen)
01924 %
01925 %  A description of each parameter follows:
01926 %
01927 %    o wand: the magick wand.
01928 %
01929 %    o sharpen: Increase or decrease image contrast.
01930 %
01931 %
01932 */
01933 WandExport MagickBooleanType MagickContrastImage(MagickWand *wand,
01934   const MagickBooleanType sharpen)
01935 {
01936   MagickBooleanType
01937     status;
01938 
01939   assert(wand != (MagickWand *) NULL);
01940   assert(wand->signature == WandSignature);
01941   if (wand->debug != MagickFalse)
01942     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
01943   if (wand->images == (Image *) NULL)
01944     ThrowWandException(WandError,"ContainsNoImages",wand->name);
01945   status=ContrastImage(wand->images,sharpen);
01946   if (status == MagickFalse)
01947     InheritException(wand->exception,&wand->images->exception);
01948   return(status);
01949 }
01950 
01951 /*
01952 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01953 %                                                                             %
01954 %                                                                             %
01955 %                                                                             %
01956 %   M a g i c k C o n t r a s t S t r e t c h I m a g e                       %
01957 %                                                                             %
01958 %                                                                             %
01959 %                                                                             %
01960 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01961 %
01962 %  MagickContrastStretchImage() enhances the contrast of a color image by
01963 %  adjusting the pixels color to span the entire range of colors available.
01964 %  You can also reduce the influence of a particular channel with a gamma
01965 %  value of 0.
01966 %
01967 %  The format of the MagickContrastStretchImage method is:
01968 %
01969 %      MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
01970 %        const double black_point,const double white_point)
01971 %      MagickBooleanType MagickContrastStretchImageChannel(MagickWand *wand,
01972 %        const ChannelType channel,const double black_point,
01973 %        const double white_point)
01974 %
01975 %  A description of each parameter follows:
01976 %
01977 %    o wand: the magick wand.
01978 %
01979 %    o channel: the image channel(s).
01980 %
01981 %    o black_point: the black point.
01982 %
01983 %    o white_point: the white point.
01984 %
01985 */
01986 
01987 WandExport MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
01988   const double black_point,const double white_point)
01989 {
01990   MagickBooleanType
01991     status;
01992 
01993   status=MagickContrastStretchImageChannel(wand,DefaultChannels,black_point,
01994     white_point);
01995   return(status);
01996 }
01997 
01998 WandExport MagickBooleanType MagickContrastStretchImageChannel(MagickWand *wand,
01999   const ChannelType channel,const double black_point,const double white_point)
02000 {
02001   MagickBooleanType
02002     status;
02003 
02004   assert(wand != (MagickWand *) NULL);
02005   assert(wand->signature == WandSignature);
02006   if (wand->debug != MagickFalse)
02007     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02008   if (wand->images == (Image *) NULL)
02009     ThrowWandException(WandError,"ContainsNoImages",wand->name);
02010   status=ContrastStretchImageChannel(wand->images,channel,black_point,
02011     white_point);
02012   if (status == MagickFalse)
02013     InheritException(wand->exception,&wand->images->exception);
02014   return(status);
02015 }
02016 
02017 /*
02018 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02019 %                                                                             %
02020 %                                                                             %
02021 %                                                                             %
02022 %   M a g i c k C o n v o l v e I m a g e                                     %
02023 %                                                                             %
02024 %                                                                             %
02025 %                                                                             %
02026 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02027 %
02028 %  MagickConvolveImage() applies a custom convolution kernel to the image.
02029 %
02030 %  The format of the MagickConvolveImage method is:
02031 %
02032 %      MagickBooleanType MagickConvolveImage(MagickWand *wand,
02033 %        const unsigned long order,const double *kernel)
02034 %      MagickBooleanType MagickConvolveImageChannel(MagickWand *wand,
02035 %        const ChannelType channel,const unsigned long order,
02036 %        const double *kernel)
02037 %
02038 %  A description of each parameter follows:
02039 %
02040 %    o wand: the magick wand.
02041 %
02042 %    o channel: the image channel(s).
02043 %
02044 %    o order: the number of columns and rows in the filter kernel.
02045 %
02046 %    o kernel: An array of doubles representing the convolution kernel.
02047 %
02048 */
02049 
02050 WandExport MagickBooleanType MagickConvolveImage(MagickWand *wand,
02051   const unsigned long order,const double *kernel)
02052 {
02053   MagickBooleanType
02054     status;
02055 
02056   status=MagickConvolveImageChannel(wand,DefaultChannels,order,kernel);
02057   return(status);
02058 }
02059 
02060 WandExport MagickBooleanType MagickConvolveImageChannel(MagickWand *wand,
02061   const ChannelType channel,const unsigned long order,const double *kernel)
02062 {
02063   Image
02064     *convolve_image;
02065 
02066   assert(wand != (MagickWand *) NULL);
02067   assert(wand->signature == WandSignature);
02068   if (wand->debug != MagickFalse)
02069     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02070   if (kernel == (const double *) NULL)
02071     return(MagickFalse);
02072   if (wand->images == (Image *) NULL)
02073     ThrowWandException(WandError,"ContainsNoImages",wand->name);
02074   convolve_image=ConvolveImageChannel(wand->images,channel,order,kernel,
02075     wand->exception);
02076   if (convolve_image == (Image *) NULL)
02077     return(MagickFalse);
02078   ReplaceImageInList(&wand->images,convolve_image);
02079   return(MagickTrue);
02080 }
02081 
02082 /*
02083 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02084 %                                                                             %
02085 %                                                                             %
02086 %                                                                             %
02087 %   M a g i c k C r o p I m a g e                                             %
02088 %                                                                             %
02089 %                                                                             %
02090 %                                                                             %
02091 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02092 %
02093 %  MagickCropImage() extracts a region of the image.
02094 %
02095 %  The format of the MagickCropImage method is:
02096 %
02097 %      MagickBooleanType MagickCropImage(MagickWand *wand,
02098 %        const unsigned long width,const unsigned long height,const long x,
02099 %        const long y)
02100 %
02101 %  A description of each parameter follows:
02102 %
02103 %    o wand: the magick wand.
02104 %
02105 %    o width: the region width.
02106 %
02107 %    o height: the region height.
02108 %
02109 %    o x: the region x-offset.
02110 %
02111 %    o y: the region y-offset.
02112 %
02113 */
02114 WandExport MagickBooleanType MagickCropImage(MagickWand *wand,
02115   const unsigned long width,const unsigned long height,const long x,
02116   const long y)
02117 {
02118   Image
02119     *crop_image;
02120 
02121   RectangleInfo
02122     crop;
02123 
02124   assert(wand != (MagickWand *) NULL);
02125   assert(wand->signature == WandSignature);
02126   if (wand->debug != MagickFalse)
02127     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02128   if (wand->images == (Image *) NULL)
02129     ThrowWandException(WandError,"ContainsNoImages",wand->name);
02130   crop.width=width;
02131   crop.height=height;
02132   crop.x=x;
02133   crop.y=y;
02134   crop_image=CropImage(wand->images,&crop,wand->exception);
02135   if (crop_image == (Image *) NULL)
02136     return(MagickFalse);
02137   ReplaceImageInList(&wand->images,crop_image);
02138   return(MagickTrue);
02139 }
02140 
02141 /*
02142 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02143 %                                                                             %
02144 %                                                                             %
02145 %                                                                             %
02146 %   M a g i c k C y c l e C o l o r m a p I m a g e                           %
02147 %                                                                             %
02148 %                                                                             %
02149 %                                                                             %
02150 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02151 %
02152 %  MagickCycleColormapImage() displaces an image's colormap by a given number
02153 %  of positions.  If you cycle the colormap a number of times you can produce
02154 %  a psychodelic effect.
02155 %
02156 %  The format of the MagickCycleColormapImage method is:
02157 %
02158 %      MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
02159 %        const long displace)
02160 %
02161 %  A description of each parameter follows:
02162 %
02163 %    o wand: the magick wand.
02164 %
02165 %    o pixel_wand: the pixel wand.
02166 %
02167 */
02168 WandExport MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
02169   const long displace)
02170 {
02171   MagickBooleanType
02172     status;
02173 
02174   assert(wand != (MagickWand *) NULL);
02175   assert(wand->signature == WandSignature);
02176   if (wand->debug != MagickFalse)
02177     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02178   if (wand->images == (Image *) NULL)
02179     ThrowWandException(WandError,"ContainsNoImages",wand->name);
02180   status=CycleColormapImage(wand->images,displace);
02181   if (status == MagickFalse)
02182     InheritException(wand->exception,&wand->images->exception);
02183   return(status);
02184 }
02185 
02186 /*
02187 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02188 %                                                                             %
02189 %                                                                             %
02190 %                                                                             %
02191 %   M a g i c k C o n s t i t u t e I m a g e                                 %
02192 %                                                                             %
02193 %                                                                             %
02194 %                                                                             %
02195 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02196 %
02197 %  MagickConstituteImage() adds an image to the wand comprised of the pixel
02198 %  data you supply.  The pixel data must be in scanline order top-to-bottom.
02199 %  The data can be char, short int, int, float, or double.  Float and double
02200 %  require the pixels to be normalized [0..1], otherwise [0..Max],  where Max
02201 %  is the maximum value the type can accomodate (e.g. 255 for char).  For
02202 %  example, to create a 640x480 image from unsigned red-green-blue character
02203 %  data, use
02204 %
02205 %      MagickConstituteImage(wand,640,640,"RGB",CharPixel,pixels);
02206 %
02207 %  The format of the MagickConstituteImage method is:
02208 %
02209 %      MagickBooleanType MagickConstituteImage(MagickWand *wand,
02210 %        const unsigned long columns,const unsigned long rows,const char *map,
02211 %        const StorageType storage,void *pixels)
02212 %
02213 %  A description of each parameter follows:
02214 %
02215 %    o wand: the magick wand.
02216 %
02217 %    o columns: width in pixels of the image.
02218 %
02219 %    o rows: height in pixels of the image.
02220 %
02221 %    o map:  This string reflects the expected ordering of the pixel array.
02222 %      It can be any combination or order of R = red, G = green, B = blue,
02223 %      A = alpha (0 is transparent), O = opacity (0 is opaque), C = cyan,
02224 %      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
02225 %      P = pad.
02226 %
02227 %    o storage: Define the data type of the pixels.  Float and double types are
02228 %      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
02229 %      these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
02230 %      LongPixel, QuantumPixel, or ShortPixel.
02231 %
02232 %    o pixels: This array of values contain the pixel components as defined by
02233 %      map and type.  You must preallocate this array where the expected
02234 %      length varies depending on the values of width, height, map, and type.
02235 %
02236 %
02237 */
02238 WandExport MagickBooleanType MagickConstituteImage(MagickWand *wand,
02239   const unsigned long columns,const unsigned long rows,const char *map,
02240   const StorageType storage,const void *pixels)
02241 {
02242   Image
02243     *images;
02244 
02245   assert(wand != (MagickWand *) NULL);
02246   assert(wand->signature == WandSignature);
02247   if (wand->debug != MagickFalse)
02248     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02249   images=ConstituteImage(columns,rows,map,storage,pixels,wand->exception);
02250   if (images == (Image *) NULL)
02251     return(MagickFalse);
02252   return(InsertImageInWand(wand,images));
02253 }
02254 
02255 /*
02256 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02257 %                                                                             %
02258 %                                                                             %
02259 %                                                                             %
02260 %   M a g i c k D e c i p h e r I m a g e                                     %
02261 %                                                                             %
02262 %                                                                             %
02263 %                                                                             %
02264 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02265 %
02266 %  MagickDecipherImage() converts cipher pixels to plain pixels.
02267 %
02268 %  The format of the MagickDecipherImage method is:
02269 %
02270 %      MagickBooleanType MagickDecipherImage(MagickWand *wand,
02271 %        const char *passphrase)
02272 %
02273 %  A description of each parameter follows:
02274 %
02275 %    o wand: the magick wand.
02276 %
02277 %    o passphrase: the passphrase.
02278 %
02279 */
02280 WandExport MagickBooleanType MagickDecipherImage(MagickWand *wand,
02281   const char *passphrase)
02282 {
02283   assert(wand != (MagickWand *) NULL);
02284   assert(wand->signature == WandSignature);
02285   if (wand->debug != MagickFalse)
02286     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02287   if (wand->images == (Image *) NULL)
02288     ThrowWandException(WandError,"ContainsNoImages",wand->name);
02289   return(DecipherImage(wand->images,passphrase,&wand->images->exception));
02290 }
02291 
02292 /*
02293 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02294 %                                                                             %
02295 %                                                                             %
02296 %                                                                             %
02297 %   M a g i c k D e c o n s t r u c t I m a g e s                             %
02298 %                                                                             %
02299 %                                                                             %
02300 %                                                                             %
02301 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02302 %
02303 %  MagickDeconstructImages() compares each image with the next in a sequence
02304 %  and returns the maximum bounding region of any pixel differences it
02305 %  discovers.
02306 %
02307 %  The format of the MagickDeconstructImages method is:
02308 %
02309 %      MagickWand *MagickDeconstructImages(MagickWand *wand)
02310 %
02311 %  A description of each parameter follows:
02312 %
02313 %    o wand: the magick wand.
02314 %
02315 */
02316 WandExport MagickWand *MagickDeconstructImages(MagickWand *wand)
02317 {
02318   Image
02319     *deconstruct_image;
02320 
02321   assert(wand != (MagickWand *) NULL);
02322   assert(wand->signature == WandSignature);
02323   if (wand->debug != MagickFalse)
02324     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02325   if (wand->images == (Image *) NULL)
02326     return((MagickWand *) NULL);
02327   deconstruct_image=DeconstructImages(wand->images,wand->exception);
02328   if (deconstruct_image == (Image *) NULL)
02329     return((MagickWand *) NULL);
02330   return(CloneMagickWandFromImages(wand,deconstruct_image));
02331 }
02332 
02333 /*
02334 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02335 %                                                                             %
02336 %                                                                             %
02337 %                                                                             %
02338 %     M a g i c k D e s k e w I m a g e                                       %
02339 %                                                                             %
02340 %                                                                             %
02341 %                                                                             %
02342 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02343 %
02344 %  MagickDeskewImage() removes skew from the image.  Skew is an artifact that
02345 %  occurs in scanned images because of the camera being misaligned,
02346 %  imperfections in the scanning or surface, or simply because the paper was
02347 %  not placed completely flat when scanned.
02348 %
02349 %  The format of the MagickDeskewImage method is:
02350 %
02351 %      MagickBooleanType MagickDeskewImage(MagickWand *wand,
02352 %        const double threshold)
02353 %
02354 %  A description of each parameter follows:
02355 %
02356 %    o wand: the magick wand.
02357 %
02358 %    o threshold: separate background from foreground.
02359 %
02360 */
02361 WandExport MagickBooleanType MagickDeskewImage(MagickWand *wand,
02362   const double threshold)
02363 {
02364   Image
02365     *sepia_image;
02366 
02367   assert(wand != (MagickWand *) NULL);
02368   assert(wand->signature == WandSignature);
02369   if (wand->debug != MagickFalse)
02370     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02371   if (wand->images == (Image *) NULL)
02372     ThrowWandException(WandError,"ContainsNoImages",wand->name);
02373   sepia_image=DeskewImage(wand->images,threshold,wand->exception);
02374   if (sepia_image == (Image *) NULL)
02375     return(MagickFalse);
02376   ReplaceImageInList(&wand->images,sepia_image);
02377   return(MagickTrue);
02378 }
02379 
02380 /*
02381 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02382 %                                                                             %
02383 %                                                                             %
02384 %                                                                             %
02385 %     M a g i c k D e s p e c k l e I m a g e                                 %
02386 %                                                                             %
02387 %                                                                             %
02388 %                                                                             %
02389 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02390 %
02391 %  MagickDespeckleImage() reduces the speckle noise in an image while
02392 %  perserving the edges of the original image.
02393 %
02394 %  The format of the MagickDespeckleImage method is:
02395 %
02396 %      MagickBooleanType MagickDespeckleImage(MagickWand *wand)
02397 %
02398 %  A description of each parameter follows:
02399 %
02400 %    o wand: the magick wand.
02401 %
02402 */
02403 WandExport MagickBooleanType MagickDespeckleImage(MagickWand *wand)
02404 {
02405   Image
02406     *despeckle_image;
02407 
02408   assert(wand != (MagickWand *) NULL);
02409   assert(wand->signature == WandSignature);
02410   if (wand->debug != MagickFalse)
02411     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02412   if (wand->images == (Image *) NULL)
02413     ThrowWandException(WandError,"ContainsNoImages",wand->name);
02414   despeckle_image=DespeckleImage(wand->images,wand->exception);
02415   if (despeckle_image == (Image *) NULL)
02416     return(MagickFalse);
02417   ReplaceImageInList(&wand->images,despeckle_image);
02418   return(MagickTrue);
02419 }
02420 
02421 /*
02422 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02423 %                                                                             %
02424 %                                                                             %
02425 %                                                                             %
02426 %   M a g i c k D e s t r o y I m a g e                                       %
02427 %                                                                             %
02428 %                                                                             %
02429 %                                                                             %
02430 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02431 %
02432 %  MagickDestroyImage() dereferences an image, deallocating memory associated
02433 %  with the image if the reference count becomes zero.
02434 %
02435 %  The format of the MagickDestroyImage method is:
02436 %
02437 %      Image *MagickDestroyImage(Image *image)
02438 %
02439 %  A description of each parameter follows:
02440 %
02441 %    o image: the image.
02442 %
02443 */
02444 WandExport Image *MagickDestroyImage(Image *image)
02445 {
02446   return(DestroyImage(image));
02447 }
02448 
02449 /*
02450 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02451 %                                                                             %
02452 %                                                                             %
02453 %                                                                             %
02454 %   M a g i c k D i s p l a y I m a g e                                       %
02455 %                                                                             %
02456 %                                                                             %
02457 %                                                                             %
02458 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02459 %
02460 %  MagickDisplayImage() displays an image.
02461 %
02462 %  The format of the MagickDisplayImage method is:
02463 %
02464 %      MagickBooleanType MagickDisplayImage(MagickWand *wand,
02465 %        const char *server_name)
02466 %
02467 %  A description of each parameter follows:
02468 %
02469 %    o wand: the magick wand.
02470 %
02471 %    o server_name: the X server name.
02472 %
02473 */
02474 WandExport MagickBooleanType MagickDisplayImage(MagickWand *wand,
02475   const char *server_name)
02476 {
02477   Image
02478     *image;
02479 
02480   MagickBooleanType
02481     status;
02482 
02483   assert(wand != (MagickWand *) NULL);
02484   assert(wand->signature == WandSignature);
02485   if (wand->debug != MagickFalse)
02486     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02487   if (wand->images == (Image *) NULL)
02488     ThrowWandException(WandError,"ContainsNoImages",wand->name);
02489   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
02490   if (image == (Image *) NULL)
02491     return(MagickFalse);
02492   (void) CloneString(&wand->image_info->server_name,server_name);
02493   status=DisplayImages(wand->image_info,image);
02494   if (status == MagickFalse)
02495     InheritException(wand->exception,&image->exception);
02496   image=DestroyImage(image);
02497   return(status);
02498 }
02499 
02500 /*
02501 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02502 %                                                                             %
02503 %                                                                             %
02504 %                                                                             %
02505 %   M a g i c k D i s p l a y I m a g e s                                     %
02506 %                                                                             %
02507 %                                                                             %
02508 %                                                                             %
02509 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02510 %
02511 %  MagickDisplayImages() displays an image or image sequence.
02512 %
02513 %  The format of the MagickDisplayImages method is:
02514 %
02515 %      MagickBooleanType MagickDisplayImages(MagickWand *wand,
02516 %        const char *server_name)
02517 %
02518 %  A description of each parameter follows:
02519 %
02520 %    o wand: the magick wand.
02521 %
02522 %    o server_name: the X server name.
02523 %
02524 */
02525 WandExport MagickBooleanType MagickDisplayImages(MagickWand *wand,
02526   const char *server_name)
02527 {
02528   MagickBooleanType
02529     status;
02530 
02531   assert(wand != (MagickWand *) NULL);
02532   assert(wand->signature == WandSignature);
02533   if (wand->debug != MagickFalse)
02534     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02535   (void) CloneString(&wand->image_info->server_name,server_name);
02536   status=DisplayImages(wand->image_info,wand->images);
02537   if (status == MagickFalse)
02538     InheritException(wand->exception,&wand->images->exception);
02539   return(status);
02540 }
02541 
02542 /*
02543 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02544 %                                                                             %
02545 %                                                                             %
02546 %                                                                             %
02547 %   M a g i c k D i s t o r t I m a g e                                       %
02548 %                                                                             %
02549 %                                                                             %
02550 %                                                                             %
02551 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02552 %
02553 %  MagickDistortImage() distorts an image using various distortion methods, by
02554 %  mapping color lookups of the source image to a new destination image
02555 %  usally of the same size as the source image, unless 'bestfit' is set to
02556 %  true.
02557 %
02558 %  If 'bestfit' is enabled, and distortion allows it, the destination image is
02559 %  adjusted to ensure the whole source 'image' will just fit within the final
02560 %  destination image, which will be sized and offset accordingly.  Also in
02561 %  many cases the virtual offset of the source image will be taken into
02562 %  account in the mapping.
02563 %
02564 %  The format of the MagickDistortImage method is:
02565 %
02566 %      MagickBooleanType MagickDistortImage(MagickWand *wand,
02567 %        const DistortImageMethod method,const unsigned long number_arguments,
02568 %        const double *arguments,const MagickBooleanType bestfit)
02569 %
02570 %  A description of each parameter follows:
02571 %
02572 %    o image: the image to be distorted.
02573 %
02574 %    o method: the method of image distortion.
02575 %
02576 %        ArcDistortion always ignores the source image offset, and always
02577 %        'bestfit' the destination image with the top left corner offset
02578 %        relative to the polar mapping center.
02579 %
02580 %        Bilinear has no simple inverse mapping so it does not allow 'bestfit'
02581 %        style of image distortion.
02582 %
02583 %        Affine, Perspective, and Bilinear, do least squares fitting of the
02584 %        distortion when more than the minimum number of control point pairs
02585 %        are provided.
02586 %
02587 %        Perspective, and Bilinear, falls back to a Affine distortion when less
02588 %        that 4 control point pairs are provided. While Affine distortions let
02589 %        you use any number of control point pairs, that is Zero pairs is a
02590 %        no-Op (viewport only) distrotion, one pair is a translation and two
02591 %        pairs of control points do a scale-rotate-translate, without any
02592 %        shearing.
02593 %
02594 %    o number_arguments: the number of arguments given for this distortion
02595 %      method.
02596 %
02597 %    o arguments: the arguments for this distortion method.
02598 %
02599 %    o bestfit: Attempt to resize destination to fit distorted source.
02600 %
02601 */
02602 WandExport MagickBooleanType MagickDistortImage(MagickWand *wand,
02603   const DistortImageMethod method,const unsigned long number_arguments,
02604   const double *arguments,const MagickBooleanType bestfit)
02605 {
02606   Image
02607     *distort_image;
02608 
02609   assert(wand != (MagickWand *) NULL);
02610   assert(wand->signature == WandSignature);
02611   if (wand->debug != MagickFalse)
02612     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02613   if (wand->images == (Image *) NULL)
02614     ThrowWandException(WandError,"ContainsNoImages",wand->name);
02615   distort_image=DistortImage(wand->images,method,number_arguments,arguments,
02616     bestfit,wand->exception);
02617   if (distort_image == (Image *) NULL)
02618     return(MagickFalse);
02619   ReplaceImageInList(&wand->images,distort_image);
02620   return(MagickTrue);
02621 }
02622 
02623 /*
02624 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02625 %                                                                             %
02626 %                                                                             %
02627 %                                                                             %
02628 %   M a g i c k D r a w I m a g e                                             %
02629 %                                                                             %
02630 %                                                                             %
02631 %                                                                             %
02632 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02633 %
02634 %  MagickDrawImage() renders the drawing wand on the current image.
02635 %
02636 %  The format of the MagickDrawImage method is:
02637 %
02638 %      MagickBooleanType MagickDrawImage(MagickWand *wand,
02639 %        const DrawingWand *drawing_wand)
02640 %
02641 %  A description of each parameter follows:
02642 %
02643 %    o wand: the magick wand.
02644 %
02645 %    o drawing_wand: the draw wand.
02646 %
02647 */
02648 WandExport MagickBooleanType MagickDrawImage(MagickWand *wand,
02649   const DrawingWand *drawing_wand)
02650 {
02651   char
02652     *primitive;
02653 
02654   DrawInfo
02655     *draw_info;
02656 
02657   MagickBooleanType
02658     status;
02659 
02660   assert(wand != (MagickWand *) NULL);
02661   assert(wand->signature == WandSignature);
02662   if (wand->debug != MagickFalse)
02663     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02664   if (wand->images == (Image *) NULL)
02665     ThrowWandException(WandError,"ContainsNoImages",wand->name);
02666   draw_info=PeekDrawingWand(drawing_wand);
02667   if ((draw_info == (DrawInfo *) NULL) ||
02668       (draw_info->primitive == (char *) NULL))
02669     return(MagickFalse);
02670   primitive=AcquireString(draw_info->primitive);
02671   draw_info=DestroyDrawInfo(draw_info);
02672   draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
02673   draw_info->primitive=primitive;
02674   status=DrawImage(wand->images,draw_info);
02675   if (status == MagickFalse)
02676     InheritException(wand->exception,&wand->images->exception);
02677   draw_info=DestroyDrawInfo(draw_info);
02678   return(status);
02679 }
02680 
02681 /*
02682 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02683 %                                                                             %
02684 %                                                                             %
02685 %                                                                             %
02686 %   M a g i c k E d g e I m a g e                                             %
02687 %                                                                             %
02688 %                                                                             %
02689 %                                                                             %
02690 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02691 %
02692 %  MagickEdgeImage() enhance edges within the image with a convolution filter
02693 %  of the given radius.  Use a radius of 0 and Edge() selects a suitable
02694 %  radius for you.
02695 %
02696 %  The format of the MagickEdgeImage method is:
02697 %
02698 %      MagickBooleanType MagickEdgeImage(MagickWand *wand,const double radius)
02699 %
02700 %  A description of each parameter follows:
02701 %
02702 %    o wand: the magick wand.
02703 %
02704 %    o radius: the radius of the pixel neighborhood.
02705 %
02706 */
02707 WandExport MagickBooleanType MagickEdgeImage(MagickWand *wand,
02708   const double radius)
02709 {
02710   Image
02711     *edge_image;
02712 
02713   assert(wand != (MagickWand *) NULL);
02714   assert(wand->signature == WandSignature);
02715   if (wand->debug != MagickFalse)
02716     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02717   if (wand->images == (Image *) NULL)
02718     ThrowWandException(WandError,"ContainsNoImages",wand->name);
02719   edge_image=EdgeImage(wand->images,radius,wand->exception);
02720   if (edge_image == (Image *) NULL)
02721     return(MagickFalse);
02722   ReplaceImageInList(&wand->images,edge_image);
02723   return(MagickTrue);
02724 }
02725 
02726 /*
02727 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02728 %                                                                             %
02729 %                                                                             %
02730 %                                                                             %
02731 %   M a g i c k E m b o s s I m a g e                                         %
02732 %                                                                             %
02733 %                                                                             %
02734 %                                                                             %
02735 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02736 %
02737 %  MagickEmbossImage() returns a grayscale image with a three-dimensional
02738 %  effect.  We convolve the image with a Gaussian operator of the given radius
02739 %  and standard deviation (sigma).  For reasonable results, radius should be
02740 %  larger than sigma.  Use a radius of 0 and Emboss() selects a suitable
02741 %  radius for you.
02742 %
02743 %  The format of the MagickEmbossImage method is:
02744 %
02745 %      MagickBooleanType MagickEmbossImage(MagickWand *wand,const double radius,
02746 %        const double sigma)
02747 %
02748 %  A description of each parameter follows:
02749 %
02750 %    o wand: the magick wand.
02751 %
02752 %    o radius: the radius of the Gaussian, in pixels, not counting the center
02753 %      pixel.
02754 %
02755 %    o sigma: the standard deviation of the Gaussian, in pixels.
02756 %
02757 */
02758 WandExport MagickBooleanType MagickEmbossImage(MagickWand *wand,
02759   const double radius,const double sigma)
02760 {
02761   Image
02762     *emboss_image;
02763 
02764   assert(wand != (MagickWand *) NULL);
02765   assert(wand->signature == WandSignature);
02766   if (wand->debug != MagickFalse)
02767     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02768   if (wand->images == (Image *) NULL)
02769     ThrowWandException(WandError,"ContainsNoImages",wand->name);
02770   emboss_image=EmbossImage(wand->images,radius,sigma,wand->exception);
02771   if (emboss_image == (Image *) NULL)
02772     return(MagickFalse);
02773   ReplaceImageInList(&wand->images,emboss_image);
02774   return(MagickTrue);
02775 }
02776 
02777 /*
02778 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02779 %                                                                             %
02780 %                                                                             %
02781 %                                                                             %
02782 %   M a g i c k E n c i p h e r I m a g e                                     %
02783 %                                                                             %
02784 %                                                                             %
02785 %                                                                             %
02786 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02787 %
02788 %  MagickEncipherImage() converts plaint pixels to cipher pixels.
02789 %
02790 %  The format of the MagickEncipherImage method is:
02791 %
02792 %      MagickBooleanType MagickEncipherImage(MagickWand *wand,
02793 %        const char *passphrase)
02794 %
02795 %  A description of each parameter follows:
02796 %
02797 %    o wand: the magick wand.
02798 %
02799 %    o passphrase: the passphrase.
02800 %
02801 */
02802 WandExport MagickBooleanType MagickEncipherImage(MagickWand *wand,
02803   const char *passphrase)
02804 {
02805   assert(wand != (MagickWand *) NULL);
02806   assert(wand->signature == WandSignature);
02807   if (wand->debug != MagickFalse)
02808     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02809   if (wand->images == (Image *) NULL)
02810     ThrowWandException(WandError,"ContainsNoImages",wand->name);
02811   return(EncipherImage(wand->images,passphrase,&wand->images->exception));
02812 }
02813 
02814 /*
02815 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02816 %                                                                             %
02817 %                                                                             %
02818 %                                                                             %
02819 %   M a g i c k E n h a n c e I m a g e                                       %
02820 %                                                                             %
02821 %                                                                             %
02822 %                                                                             %
02823 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02824 %
02825 %  MagickEnhanceImage() applies a digital filter that improves the quality of a
02826 %  noisy image.
02827 %
02828 %  The format of the MagickEnhanceImage method is:
02829 %
02830 %      MagickBooleanType MagickEnhanceImage(MagickWand *wand)
02831 %
02832 %  A description of each parameter follows:
02833 %
02834 %    o wand: the magick wand.
02835 %
02836 */
02837 WandExport MagickBooleanType MagickEnhanceImage(MagickWand *wand)
02838 {
02839   Image
02840     *enhance_image;
02841 
02842   assert(wand != (MagickWand *) NULL);
02843   assert(wand->signature == WandSignature);
02844   if (wand->debug != MagickFalse)
02845     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02846   if (wand->images == (Image *) NULL)
02847     ThrowWandException(WandError,"ContainsNoImages",wand->name);
02848   enhance_image=EnhanceImage(wand->images,wand->exception);
02849   if (enhance_image == (Image *) NULL)
02850     return(MagickFalse);
02851   ReplaceImageInList(&wand->images,enhance_image);
02852   return(MagickTrue);
02853 }
02854 
02855 /*
02856 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02857 %                                                                             %
02858 %                                                                             %
02859 %                                                                             %
02860 %   M a g i c k E q u a l i z e I m a g e                                     %
02861 %                                                                             %
02862 %                                                                             %
02863 %                                                                             %
02864 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02865 %
02866 %  MagickEqualizeImage() equalizes the image histogram.
02867 %
02868 %  The format of the MagickEqualizeImage method is:
02869 %
02870 %      MagickBooleanType MagickEqualizeImage(MagickWand *wand)
02871 %      MagickBooleanType MagickEqualizeImageChannel(MagickWand *wand,
02872 %        const ChannelType channel)
02873 %
02874 %  A description of each parameter follows:
02875 %
02876 %    o wand: the magick wand.
02877 %
02878 %    o channel: the image channel(s).
02879 %
02880 */
02881 
02882 WandExport MagickBooleanType MagickEqualizeImage(MagickWand *wand)
02883 {
02884   MagickBooleanType
02885     status;
02886 
02887   status=MagickEqualizeImageChannel(wand,DefaultChannels);
02888   return(status);
02889 }
02890 
02891 WandExport MagickBooleanType MagickEqualizeImageChannel(MagickWand *wand,
02892   const ChannelType channel)
02893 {
02894   MagickBooleanType
02895     status;
02896 
02897   assert(wand != (MagickWand *) NULL);
02898   assert(wand->signature == WandSignature);
02899   if (wand->debug != MagickFalse)
02900     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02901   if (wand->images == (Image *) NULL)
02902     ThrowWandException(WandError,"ContainsNoImages",wand->name);
02903   status=EqualizeImageChannel(wand->images,channel);
02904   if (status == MagickFalse)
02905     InheritException(wand->exception,&wand->images->exception);
02906   return(status);
02907 }
02908 
02909 /*
02910 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02911 %                                                                             %
02912 %                                                                             %
02913 %                                                                             %
02914 %   M a g i c k E v a l u a t e I m a g e                                     %
02915 %                                                                             %
02916 %                                                                             %
02917 %                                                                             %
02918 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02919 %
02920 %  MagickEvaluateImage() applys an arithmetic, relational, or logical
02921 %  expression to an image.  Use these operators to lighten or darken an image,
02922 %  to increase or decrease contrast in an image, or to produce the "negative"
02923 %  of an image.
02924 %
02925 %  The format of the MagickEvaluateImage method is:
02926 %
02927 %      MagickBooleanType MagickEvaluateImage(MagickWand *wand,
02928 %        const MagickEvaluateOperator operator,const double value)
02929 %      MagickBooleanType MagickEvaluateImageChannel(MagickWand *wand,
02930 %        const ChannelType channel,const MagickEvaluateOperator op,
02931 %        const double value)
02932 %
02933 %  A description of each parameter follows:
02934 %
02935 %    o wand: the magick wand.
02936 %
02937 %    o channel: the channel(s).
02938 %
02939 %    o op: A channel operator.
02940 %
02941 %    o value: A value value.
02942 %
02943 */
02944 
02945 WandExport MagickBooleanType MagickEvaluateImage(MagickWand *wand,
02946   const MagickEvaluateOperator op,const double value)
02947 {
02948   MagickBooleanType
02949     status;
02950 
02951   assert(wand != (MagickWand *) NULL);
02952   assert(wand->signature == WandSignature);
02953   if (wand->debug != MagickFalse)
02954     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02955   if (wand->images == (Image *) NULL)
02956     ThrowWandException(WandError,"ContainsNoImages",wand->name);
02957   status=EvaluateImage(wand->images,op,value,&wand->images->exception);
02958   if (status == MagickFalse)
02959     InheritException(wand->exception,&wand->images->exception);
02960   return(status);
02961 }
02962 
02963 WandExport MagickBooleanType MagickEvaluateImageChannel(MagickWand *wand,
02964   const ChannelType channel,const MagickEvaluateOperator op,const double value)
02965 {
02966   MagickBooleanType
02967     status;
02968 
02969   assert(wand != (MagickWand *) NULL);
02970   assert(wand->signature == WandSignature);
02971   if (wand->debug != MagickFalse)
02972     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
02973   if (wand->images == (Image *) NULL)
02974     ThrowWandException(WandError,"ContainsNoImages",wand->name);
02975   status=EvaluateImageChannel(wand->images,channel,op,value,
02976     &wand->images->exception);
02977   return(status);
02978 }
02979 
02980 /*
02981 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02982 %                                                                             %
02983 %                                                                             %
02984 %                                                                             %
02985 %   M a g i c k E x p o r t I m a g e P i x e l s                             %
02986 %                                                                             %
02987 %                                                                             %
02988 %                                                                             %
02989 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
02990 %
02991 %  MagickExportImagePixels() extracts pixel data from an image and returns it
02992 %  to you.  The method returns MagickTrue on success otherwise MagickFalse if
02993 %  an error is encountered.  The data is returned as char, short int, int,
02994 %  long, float, or double in the order specified by map.
02995 %
02996 %  Suppose you want to extract the first scanline of a 640x480 image as
02997 %  character data in red-green-blue order:
02998 %
02999 %      MagickExportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
03000 %
03001 %  The format of the MagickExportImagePixels method is:
03002 %
03003 %      MagickBooleanType MagickExportImagePixels(MagickWand *wand,
03004 %        const long x,const long y,const unsigned long columns,
03005 %        const unsigned long rows,const char *map,const StorageType storage,
03006 %        void *pixels)
03007 %
03008 %  A description of each parameter follows:
03009 %
03010 %    o wand: the magick wand.
03011 %
03012 %    o x, y, columns, rows:  These values define the perimeter
03013 %      of a region of pixels you want to extract.
03014 %
03015 %    o map:  This string reflects the expected ordering of the pixel array.
03016 %      It can be any combination or order of R = red, G = green, B = blue,
03017 %      A = alpha (0 is transparent), O = opacity (0 is opaque), C = cyan,
03018 %      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
03019 %      P = pad.
03020 %
03021 %    o storage: Define the data type of the pixels.  Float and double types are
03022 %      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
03023 %      these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
03024 %      LongPixel, QuantumPixel, or ShortPixel.
03025 %
03026 %    o pixels: This array of values contain the pixel components as defined by
03027 %      map and type.  You must preallocate this array where the expected
03028 %      length varies depending on the values of width, height, map, and type.
03029 %
03030 */
03031 WandExport MagickBooleanType MagickExportImagePixels(MagickWand *wand,
03032   const long x,const long y,const unsigned long columns,
03033   const unsigned long rows,const char *map,const StorageType storage,
03034   void *pixels)
03035 {
03036   MagickBooleanType
03037     status;
03038 
03039   assert(wand != (MagickWand *) NULL);
03040   assert(wand->signature == WandSignature);
03041   if (wand->debug != MagickFalse)
03042     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03043   if (wand->images == (Image *) NULL)
03044     ThrowWandException(WandError,"ContainsNoImages",wand->name);
03045   status=ExportImagePixels(wand->images,x,y,columns,rows,map,
03046     storage,pixels,wand->exception);
03047   if (status == MagickFalse)
03048     InheritException(wand->exception,&wand->images->exception);
03049   return(status);
03050 }
03051 
03052 /*
03053 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03054 %                                                                             %
03055 %                                                                             %
03056 %                                                                             %
03057 %   M a g i c k E x t e n t I m a g e                                         %
03058 %                                                                             %
03059 %                                                                             %
03060 %                                                                             %
03061 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03062 %
03063 %  MagickExtentImage() extends the image as defined by the geometry, gravity,
03064 %  and wand background color.  Set the (x,y) offset of the geometry to move
03065 %  the original wand relative to the extended wand.
03066 %
03067 %  The format of the MagickExtentImage method is:
03068 %
03069 %      MagickBooleanType MagickExtentImage(MagickWand *wand,
03070 %        const unsigned long width,const unsigned long height,const long x,
03071 %        const long y)
03072 %
03073 %  A description of each parameter follows:
03074 %
03075 %    o wand: the magick wand.
03076 %
03077 %    o width: the region width.
03078 %
03079 %    o height: the region height.
03080 %
03081 %    o x: the region x offset.
03082 %
03083 %    o y: the region y offset.
03084 %
03085 */
03086 WandExport MagickBooleanType MagickExtentImage(MagickWand *wand,
03087   const unsigned long width,const unsigned long height,const long x,
03088   const long y)
03089 {
03090   Image
03091     *extent_image;
03092 
03093   RectangleInfo
03094     extent;
03095 
03096   assert(wand != (MagickWand *) NULL);
03097   assert(wand->signature == WandSignature);
03098   if (wand->debug != MagickFalse)
03099     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03100   if (wand->images == (Image *) NULL)
03101     ThrowWandException(WandError,"ContainsNoImages",wand->name);
03102   extent.width=width;
03103   extent.height=height;
03104   extent.x=x;
03105   extent.y=y;
03106   extent_image=ExtentImage(wand->images,&extent,wand->exception);
03107   if (extent_image == (Image *) NULL)
03108     return(MagickFalse);
03109   ReplaceImageInList(&wand->images,extent_image);
03110   return(MagickTrue);
03111 }
03112 
03113 /*
03114 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03115 %                                                                             %
03116 %                                                                             %
03117 %                                                                             %
03118 %   M a g i c k F l i p I m a g e                                             %
03119 %                                                                             %
03120 %                                                                             %
03121 %                                                                             %
03122 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03123 %
03124 %  MagickFlipImage() creates a vertical mirror image by reflecting the pixels
03125 %  around the central x-axis.
03126 %
03127 %  The format of the MagickFlipImage method is:
03128 %
03129 %      MagickBooleanType MagickFlipImage(MagickWand *wand)
03130 %
03131 %  A description of each parameter follows:
03132 %
03133 %    o wand: the magick wand.
03134 %
03135 */
03136 WandExport MagickBooleanType MagickFlipImage(MagickWand *wand)
03137 {
03138   Image
03139     *flip_image;
03140 
03141   assert(wand != (MagickWand *) NULL);
03142   assert(wand->signature == WandSignature);
03143   if (wand->debug != MagickFalse)
03144     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03145   if (wand->images == (Image *) NULL)
03146     ThrowWandException(WandError,"ContainsNoImages",wand->name);
03147   flip_image=FlipImage(wand->images,wand->exception);
03148   if (flip_image == (Image *) NULL)
03149     return(MagickFalse);
03150   ReplaceImageInList(&wand->images,flip_image);
03151   return(MagickTrue);
03152 }
03153 
03154 /*
03155 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03156 %                                                                             %
03157 %                                                                             %
03158 %                                                                             %
03159 %   M a g i c k F l o o d f i l l P a i n t I m a g e                         %
03160 %                                                                             %
03161 %                                                                             %
03162 %                                                                             %
03163 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03164 %
03165 %  MagickFloodfillPaintImage() changes the color value of any pixel that matches
03166 %  target and is an immediate neighbor.  If the method FillToBorderMethod is
03167 %  specified, the color value is changed for any neighbor pixel that does not
03168 %  match the bordercolor member of image.
03169 %
03170 %  The format of the MagickFloodfillPaintImage method is:
03171 %
03172 %      MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
03173 %        const ChannelType channel,const PixelWand *fill,const double fuzz,
03174 %        const PixelWand *bordercolor,const long x,const long y,
03175 %        const MagickBooleanType invert)
03176 %
03177 %  A description of each parameter follows:
03178 %
03179 %    o wand: the magick wand.
03180 %
03181 %    o channel: the channel(s).
03182 %
03183 %    o fill: the floodfill color pixel wand.
03184 %
03185 %    o fuzz: By default target must match a particular pixel color
03186 %      exactly.  However, in many cases two colors may differ by a small amount.
03187 %      The fuzz member of image defines how much tolerance is acceptable to
03188 %      consider two colors as the same.  For example, set fuzz to 10 and the
03189 %      color red at intensities of 100 and 102 respectively are now interpreted
03190 %      as the same color for the purposes of the floodfill.
03191 %
03192 %    o bordercolor: the border color pixel wand.
03193 %
03194 %    o x,y: the starting location of the operation.
03195 %
03196 %    o invert: paint any pixel that does not match the target color.
03197 %
03198 */
03199 WandExport MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
03200   const ChannelType channel,const PixelWand *fill,const double fuzz,
03201   const PixelWand *bordercolor,const long x,const long y,
03202   const MagickBooleanType invert)
03203 {
03204   DrawInfo
03205     *draw_info;
03206 
03207   MagickBooleanType
03208     status;
03209 
03210   MagickPixelPacket
03211     target;
03212 
03213   assert(wand != (MagickWand *) NULL);
03214   assert(wand->signature == WandSignature);
03215   if (wand->debug != MagickFalse)
03216     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03217   if (wand->images == (Image *) NULL)
03218     ThrowWandException(WandError,"ContainsNoImages",wand->name);
03219   draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
03220   PixelGetQuantumColor(fill,&draw_info->fill);
03221   (void) GetOneVirtualMagickPixel(wand->images,x % wand->images->columns,
03222     y % wand->images->rows,&target,wand->exception);
03223   if (bordercolor != (PixelWand *) NULL)
03224     PixelGetMagickColor(bordercolor,&target);
03225   wand->images->fuzz=fuzz;
03226   status=FloodfillPaintImage(wand->images,channel,draw_info,&target,x,y,
03227     invert);
03228   if (status == MagickFalse)
03229     InheritException(wand->exception,&wand->images->exception);
03230   draw_info=DestroyDrawInfo(draw_info);
03231   return(status);
03232 }
03233 
03234 /*
03235 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03236 %                                                                             %
03237 %                                                                             %
03238 %                                                                             %
03239 %   M a g i c k F l o p I m a g e                                             %
03240 %                                                                             %
03241 %                                                                             %
03242 %                                                                             %
03243 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03244 %
03245 %  MagickFlopImage() creates a horizontal mirror image by reflecting the pixels
03246 %  around the central y-axis.
03247 %
03248 %  The format of the MagickFlopImage method is:
03249 %
03250 %      MagickBooleanType MagickFlopImage(MagickWand *wand)
03251 %
03252 %  A description of each parameter follows:
03253 %
03254 %    o wand: the magick wand.
03255 %
03256 */
03257 WandExport MagickBooleanType MagickFlopImage(MagickWand *wand)
03258 {
03259   Image
03260     *flop_image;
03261 
03262   assert(wand != (MagickWand *) NULL);
03263   assert(wand->signature == WandSignature);
03264   if (wand->debug != MagickFalse)
03265     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03266   if (wand->images == (Image *) NULL)
03267     ThrowWandException(WandError,"ContainsNoImages",wand->name);
03268   flop_image=FlopImage(wand->images,wand->exception);
03269   if (flop_image == (Image *) NULL)
03270     return(MagickFalse);
03271   ReplaceImageInList(&wand->images,flop_image);
03272   return(MagickTrue);
03273 }
03274 
03275 /*
03276 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03277 %                                                                             %
03278 %                                                                             %
03279 %                                                                             %
03280 %   M a g i c k F o u r i e r T r a n s f o r m I m a g e                     %
03281 %                                                                             %
03282 %                                                                             %
03283 %                                                                             %
03284 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03285 %
03286 %  MagickForwardFourierTransformImage() implements the discrete Fourier
03287 %  transform (DFT) of the image either as a magnitude / phase or real /
03288 %  imaginary image pair.
03289 %
03290 %  The format of the MagickForwardFourierTransformImage method is:
03291 %
03292 %      MagickBooleanType MagickForwardFourierTransformImage(MagickWand *wand,
03293 %        const MagickBooleanType magnitude)
03294 %
03295 %  A description of each parameter follows:
03296 %
03297 %    o wand: the magick wand.
03298 %
03299 %    o magnitude: if true, return as magnitude / phase pair otherwise a real /
03300 %      imaginary image pair.
03301 %
03302 */
03303 WandExport MagickBooleanType MagickForwardFourierTransformImage(
03304   MagickWand *wand,const MagickBooleanType magnitude)
03305 {
03306   Image
03307     *forward_image;
03308 
03309   assert(wand != (MagickWand *) NULL);
03310   assert(wand->signature == WandSignature);
03311   if (wand->debug != MagickFalse)
03312     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03313   if (wand->images == (Image *) NULL)
03314     ThrowWandException(WandError,"ContainsNoImages",wand->name);
03315   forward_image=ForwardFourierTransformImage(wand->images,magnitude,
03316     wand->exception);
03317   if (forward_image == (Image *) NULL)
03318     return(MagickFalse);
03319   ReplaceImageInList(&wand->images,forward_image);
03320   return(MagickTrue);
03321 }
03322 
03323 /*
03324 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03325 %                                                                             %
03326 %                                                                             %
03327 %                                                                             %
03328 %   M a g i c k F r a m e I m a g e                                           %
03329 %                                                                             %
03330 %                                                                             %
03331 %                                                                             %
03332 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03333 %
03334 %  MagickFrameImage() adds a simulated three-dimensional border around the
03335 %  image.  The width and height specify the border width of the vertical and
03336 %  horizontal sides of the frame.  The inner and outer bevels indicate the
03337 %  width of the inner and outer shadows of the frame.
03338 %
03339 %  The format of the MagickFrameImage method is:
03340 %
03341 %      MagickBooleanType MagickFrameImage(MagickWand *wand,
03342 %        const PixelWand *matte_color,const unsigned long width,
03343 %        const unsigned long height,const long inner_bevel,
03344 %        const long outer_bevel)
03345 %
03346 %  A description of each parameter follows:
03347 %
03348 %    o wand: the magick wand.
03349 %
03350 %    o matte_color: the frame color pixel wand.
03351 %
03352 %    o width: the border width.
03353 %
03354 %    o height: the border height.
03355 %
03356 %    o inner_bevel: the inner bevel width.
03357 %
03358 %    o outer_bevel: the outer bevel width.
03359 %
03360 */
03361 WandExport MagickBooleanType MagickFrameImage(MagickWand *wand,
03362   const PixelWand *matte_color,const unsigned long width,
03363   const unsigned long height,const long inner_bevel,const long outer_bevel)
03364 {
03365   Image
03366     *frame_image;
03367 
03368   FrameInfo
03369     frame_info;
03370 
03371   assert(wand != (MagickWand *) NULL);
03372   assert(wand->signature == WandSignature);
03373   if (wand->debug != MagickFalse)
03374     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03375   if (wand->images == (Image *) NULL)
03376     ThrowWandException(WandError,"ContainsNoImages",wand->name);
03377   (void) ResetMagickMemory(&frame_info,0,sizeof(frame_info));
03378   frame_info.width=wand->images->columns+2*width;
03379   frame_info.height=wand->images->rows+2*height;
03380   frame_info.x=(long) width;
03381   frame_info.y=(long) height;
03382   frame_info.inner_bevel=inner_bevel;
03383   frame_info.outer_bevel=outer_bevel;
03384   PixelGetQuantumColor(matte_color,&wand->images->matte_color);
03385   frame_image=FrameImage(wand->images,&frame_info,wand->exception);
03386   if (frame_image == (Image *) NULL)
03387     return(MagickFalse);
03388   ReplaceImageInList(&wand->images,frame_image);
03389   return(MagickTrue);
03390 }
03391 
03392 /*
03393 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03394 %                                                                             %
03395 %                                                                             %
03396 %                                                                             %
03397 %   M a g i c k F u n c t i o n I m a g e                                     %
03398 %                                                                             %
03399 %                                                                             %
03400 %                                                                             %
03401 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03402 %
03403 %  MagickFunctionImage() applys an arithmetic, relational, or logical
03404 %  expression to an image.  Use these operators to lighten or darken an image,
03405 %  to increase or decrease contrast in an image, or to produce the "negative"
03406 %  of an image.
03407 %
03408 %  The format of the MagickFunctionImage method is:
03409 %
03410 %      MagickBooleanType MagickFunctionImage(MagickWand *wand,
03411 %        const MagickFunction function,const unsigned long number_arguments,
03412 %        const double *arguments)
03413 %      MagickBooleanType MagickFunctionImageChannel(MagickWand *wand,
03414 %        const ChannelType channel,const MagickFunction function,
03415 %        const unsigned long number_arguments,const double *arguments)
03416 %
03417 %  A description of each parameter follows:
03418 %
03419 %    o wand: the magick wand.
03420 %
03421 %    o channel: the channel(s).
03422 %
03423 %    o function: the image function.
03424 %
03425 %    o number_arguments: the number of function arguments.
03426 %
03427 %    o arguments: the function arguments.
03428 %
03429 */
03430 
03431 WandExport MagickBooleanType MagickFunctionImage(MagickWand *wand,
03432   const MagickFunction function,const unsigned long number_arguments,
03433   const double *arguments)
03434 {
03435   MagickBooleanType
03436     status;
03437 
03438   assert(wand != (MagickWand *) NULL);
03439   assert(wand->signature == WandSignature);
03440   if (wand->debug != MagickFalse)
03441     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03442   if (wand->images == (Image *) NULL)
03443     ThrowWandException(WandError,"ContainsNoImages",wand->name);
03444   status=FunctionImage(wand->images,function,number_arguments,arguments,
03445     &wand->images->exception);
03446   if (status == MagickFalse)
03447     InheritException(wand->exception,&wand->images->exception);
03448   return(status);
03449 }
03450 
03451 WandExport MagickBooleanType MagickFunctionImageChannel(MagickWand *wand,
03452   const ChannelType channel,const MagickFunction function,
03453   const unsigned long number_arguments,const double *arguments)
03454 {
03455   MagickBooleanType
03456     status;
03457 
03458   assert(wand != (MagickWand *) NULL);
03459   assert(wand->signature == WandSignature);
03460   if (wand->debug != MagickFalse)
03461     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03462   if (wand->images == (Image *) NULL)
03463     ThrowWandException(WandError,"ContainsNoImages",wand->name);
03464   status=FunctionImageChannel(wand->images,channel,function,number_arguments,
03465     arguments,&wand->images->exception);
03466   return(status);
03467 }
03468 
03469 /*
03470 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03471 %                                                                             %
03472 %                                                                             %
03473 %                                                                             %
03474 %   M a g i c k F x I m a g e                                                 %
03475 %                                                                             %
03476 %                                                                             %
03477 %                                                                             %
03478 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03479 %
03480 %  MagickFxImage() evaluate expression for each pixel in the image.
03481 %
03482 %  The format of the MagickFxImage method is:
03483 %
03484 %      MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
03485 %      MagickWand *MagickFxImageChannel(MagickWand *wand,
03486 %        const ChannelType channel,const char *expression)
03487 %
03488 %  A description of each parameter follows:
03489 %
03490 %    o wand: the magick wand.
03491 %
03492 %    o channel: the image channel(s).
03493 %
03494 %    o expression: the expression.
03495 %
03496 */
03497 
03498 WandExport MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
03499 {
03500   MagickWand
03501     *fx_wand;
03502 
03503   fx_wand=MagickFxImageChannel(wand,DefaultChannels,expression);
03504   return(fx_wand);
03505 }
03506 
03507 WandExport MagickWand *MagickFxImageChannel(MagickWand *wand,
03508   const ChannelType channel,const char *expression)
03509 {
03510   Image
03511     *fx_image;
03512 
03513   assert(wand != (MagickWand *) NULL);
03514   assert(wand->signature == WandSignature);
03515   if (wand->debug != MagickFalse)
03516     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03517   if (wand->images == (Image *) NULL)
03518     return((MagickWand *) NULL);
03519   fx_image=FxImageChannel(wand->images,channel,expression,wand->exception);
03520   if (fx_image == (Image *) NULL)
03521     return((MagickWand *) NULL);
03522   return(CloneMagickWandFromImages(wand,fx_image));
03523 }
03524 
03525 /*
03526 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03527 %                                                                             %
03528 %                                                                             %
03529 %                                                                             %
03530 %   M a g i c k G a m m a I m a g e                                           %
03531 %                                                                             %
03532 %                                                                             %
03533 %                                                                             %
03534 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03535 %
03536 %  MagickGammaImage() gamma-corrects an image.  The same image viewed on
03537 %  different devices will have perceptual differences in the way the image's
03538 %  intensities are represented on the screen.  Specify individual gamma levels
03539 %  for the red, green, and blue channels, or adjust all three with the gamma
03540 %  parameter.  Values typically range from 0.8 to 2.3.
03541 %
03542 %  You can also reduce the influence of a particular channel with a gamma
03543 %  value of 0.
03544 %
03545 %  The format of the MagickGammaImage method is:
03546 %
03547 %      MagickBooleanType MagickGammaImage(MagickWand *wand,const double gamma)
03548 %      MagickBooleanType MagickGammaImageChannel(MagickWand *wand,
03549 %        const ChannelType channel,const double gamma)
03550 %
03551 %  A description of each parameter follows:
03552 %
03553 %    o wand: the magick wand.
03554 %
03555 %    o channel: the channel.
03556 %
03557 %    o level: Define the level of gamma correction.
03558 %
03559 */
03560 
03561 WandExport MagickBooleanType MagickGammaImage(MagickWand *wand,
03562   const double gamma)
03563 {
03564   MagickBooleanType
03565     status;
03566 
03567   status=MagickGammaImageChannel(wand,DefaultChannels,gamma);
03568   return(status);
03569 }
03570 
03571 WandExport MagickBooleanType MagickGammaImageChannel(MagickWand *wand,
03572   const ChannelType channel,const double gamma)
03573 {
03574   MagickBooleanType
03575     status;
03576 
03577   assert(wand != (MagickWand *) NULL);
03578   assert(wand->signature == WandSignature);
03579   if (wand->debug != MagickFalse)
03580     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03581   if (wand->images == (Image *) NULL)
03582     ThrowWandException(WandError,"ContainsNoImages",wand->name);
03583   status=GammaImageChannel(wand->images,channel,gamma);
03584   if (status == MagickFalse)
03585     InheritException(wand->exception,&wand->images->exception);
03586   return(status);
03587 }
03588 
03589 /*
03590 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03591 %                                                                             %
03592 %                                                                             %
03593 %                                                                             %
03594 %   M a g i c k G a u s s i a n B l u r I m a g e                             %
03595 %                                                                             %
03596 %                                                                             %
03597 %                                                                             %
03598 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03599 %
03600 %  MagickGaussianBlurImage() blurs an image.  We convolve the image with a
03601 %  Gaussian operator of the given radius and standard deviation (sigma).
03602 %  For reasonable results, the radius should be larger than sigma.  Use a
03603 %  radius of 0 and MagickGaussianBlurImage() selects a suitable radius for you.
03604 %
03605 %  The format of the MagickGaussianBlurImage method is:
03606 %
03607 %      MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
03608 %        const double radius,const double sigma)
03609 %      MagickBooleanType MagickGaussianBlurImageChannel(MagickWand *wand,
03610 %        const ChannelType channel,const double radius,const double sigma)
03611 %
03612 %  A description of each parameter follows:
03613 %
03614 %    o wand: the magick wand.
03615 %
03616 %    o channel: the image channel(s).
03617 %
03618 %    o radius: the radius of the Gaussian, in pixels, not counting the center
03619 %      pixel.
03620 %
03621 %    o sigma: the standard deviation of the Gaussian, in pixels.
03622 %
03623 */
03624 
03625 WandExport MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
03626   const double radius,const double sigma)
03627 {
03628   MagickBooleanType
03629     status;
03630 
03631   status=MagickGaussianBlurImageChannel(wand,DefaultChannels,radius,sigma);
03632   return(status);
03633 }
03634 
03635 WandExport MagickBooleanType MagickGaussianBlurImageChannel(MagickWand *wand,
03636   const ChannelType channel,const double radius,const double sigma)
03637 {
03638   Image
03639     *blur_image;
03640 
03641   assert(wand != (MagickWand *) NULL);
03642   assert(wand->signature == WandSignature);
03643   if (wand->debug != MagickFalse)
03644     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03645   if (wand->images == (Image *) NULL)
03646     ThrowWandException(WandError,"ContainsNoImages",wand->name);
03647   blur_image=GaussianBlurImageChannel(wand->images,channel,radius,sigma,
03648     wand->exception);
03649   if (blur_image == (Image *) NULL)
03650     return(MagickFalse);
03651   ReplaceImageInList(&wand->images,blur_image);
03652   return(MagickTrue);
03653 }
03654 
03655 /*
03656 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03657 %                                                                             %
03658 %                                                                             %
03659 %                                                                             %
03660 %   M a g i c k G e t I m a g e                                               %
03661 %                                                                             %
03662 %                                                                             %
03663 %                                                                             %
03664 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03665 %
03666 %  MagickGetImage() gets the image at the current image index.
03667 %
03668 %  The format of the MagickGetImage method is:
03669 %
03670 %      MagickWand *MagickGetImage(MagickWand *wand)
03671 %
03672 %  A description of each parameter follows:
03673 %
03674 %    o wand: the magick wand.
03675 %
03676 */
03677 WandExport MagickWand *MagickGetImage(MagickWand *wand)
03678 {
03679   Image
03680     *image;
03681 
03682   assert(wand != (MagickWand *) NULL);
03683   assert(wand->signature == WandSignature);
03684   if (wand->debug != MagickFalse)
03685     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03686   if (wand->images == (Image *) NULL)
03687     {
03688       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
03689         "ContainsNoImages","`%s'",wand->name);
03690       return((MagickWand *) NULL);
03691     }
03692   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
03693   if (image == (Image *) NULL)
03694     return((MagickWand *) NULL);
03695   return(CloneMagickWandFromImages(wand,image));
03696 }
03697 
03698 /*
03699 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03700 %                                                                             %
03701 %                                                                             %
03702 %                                                                             %
03703 %   M a g i c k G e t I m a g e A l p h a C h a n n e l                       %
03704 %                                                                             %
03705 %                                                                             %
03706 %                                                                             %
03707 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03708 %
03709 %  MagickGetImageAlphaChannel() returns MagickFalse if the image alpha channel
03710 %  is not activated.  That is, the image is RGB rather than RGBA or CMYK rather
03711 %  than CMYKA.
03712 %
03713 %  The format of the MagickGetImageAlphaChannel method is:
03714 %
03715 %      unsigned long MagickGetImageAlphaChannel(MagickWand *wand)
03716 %
03717 %  A description of each parameter follows:
03718 %
03719 %    o wand: the magick wand.
03720 %
03721 */
03722 WandExport MagickBooleanType MagickGetImageAlphaChannel(MagickWand *wand)
03723 {
03724   assert(wand != (MagickWand *) NULL);
03725   assert(wand->signature == WandSignature);
03726   if (wand->debug != MagickFalse)
03727     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03728   if (wand->images == (Image *) NULL)
03729     ThrowWandException(WandError,"ContainsNoImages",wand->name);
03730   return(GetImageAlphaChannel(wand->images));
03731 }
03732 
03733 /*
03734 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03735 %                                                                             %
03736 %                                                                             %
03737 %                                                                             %
03738 %   M a g i c k G e t I m a g e C l i p M a s k                               %
03739 %                                                                             %
03740 %                                                                             %
03741 %                                                                             %
03742 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03743 %
03744 %  MagickGetImageClipMask() gets the image clip mask at the current image index.
03745 %
03746 %  The format of the MagickGetImageClipMask method is:
03747 %
03748 %      MagickWand *MagickGetImageClipMask(MagickWand *wand)
03749 %
03750 %  A description of each parameter follows:
03751 %
03752 %    o wand: the magick wand.
03753 %
03754 */
03755 WandExport MagickWand *MagickGetImageClipMask(MagickWand *wand)
03756 {
03757   Image
03758     *image;
03759 
03760   assert(wand != (MagickWand *) NULL);
03761   assert(wand->signature == WandSignature);
03762   if (wand->debug != MagickFalse)
03763     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03764   if (wand->images == (Image *) NULL)
03765     {
03766       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
03767         "ContainsNoImages","`%s'",wand->name);
03768       return((MagickWand *) NULL);
03769     }
03770   image=GetImageClipMask(wand->images,wand->exception);
03771   if (image == (Image *) NULL)
03772     return((MagickWand *) NULL);
03773   return(CloneMagickWandFromImages(wand,image));
03774 }
03775 
03776 /*
03777 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03778 %                                                                             %
03779 %                                                                             %
03780 %                                                                             %
03781 %   M a g i c k G e t I m a g e B a c k g r o u n d C o l o r                 %
03782 %                                                                             %
03783 %                                                                             %
03784 %                                                                             %
03785 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03786 %
03787 %  MagickGetImageBackgroundColor() returns the image background color.
03788 %
03789 %  The format of the MagickGetImageBackgroundColor method is:
03790 %
03791 %      MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
03792 %        PixelWand *background_color)
03793 %
03794 %  A description of each parameter follows:
03795 %
03796 %    o wand: the magick wand.
03797 %
03798 %    o background_color: Return the background color.
03799 %
03800 */
03801 WandExport MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
03802   PixelWand *background_color)
03803 {
03804   assert(wand != (MagickWand *) NULL);
03805   assert(wand->signature == WandSignature);
03806   if (wand->debug != MagickFalse)
03807     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03808   if (wand->images == (Image *) NULL)
03809     ThrowWandException(WandError,"ContainsNoImages",wand->name);
03810   PixelSetQuantumColor(background_color,&wand->images->background_color);
03811   return(MagickTrue);
03812 }
03813 
03814 /*
03815 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03816 %                                                                             %
03817 %                                                                             %
03818 %                                                                             %
03819 %   M a g i c k G e t I m a g e B l o b                                       %
03820 %                                                                             %
03821 %                                                                             %
03822 %                                                                             %
03823 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03824 %
03825 %  MagickGetImageBlob() implements direct to memory image formats.  It
03826 %  returns the image as a blob and its length.   Use MagickSetFormat() to
03827 %  set the format of the returned blob (GIF, JPEG,  PNG, etc.).
03828 %
03829 %  Use MagickRelinquishMemory() to free the blob when you are done with it.
03830 %
03831 %  The format of the MagickGetImageBlob method is:
03832 %
03833 %      unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
03834 %
03835 %  A description of each parameter follows:
03836 %
03837 %    o wand: the magick wand.
03838 %
03839 %    o length: the length of the blob.
03840 %
03841 */
03842 WandExport unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
03843 {
03844   assert(wand != (MagickWand *) NULL);
03845   assert(wand->signature == WandSignature);
03846   if (wand->debug != MagickFalse)
03847     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03848   if (wand->images == (Image *) NULL)
03849     {
03850       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
03851         "ContainsNoImages","`%s'",wand->name);
03852       return((unsigned char *) NULL);
03853     }
03854   return(ImageToBlob(wand->image_info,wand->images,length,wand->exception));
03855 }
03856 
03857 /*
03858 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03859 %                                                                             %
03860 %                                                                             %
03861 %                                                                             %
03862 %   M a g i c k G e t I m a g e s B l o b                                     %
03863 %                                                                             %
03864 %                                                                             %
03865 %                                                                             %
03866 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03867 %
03868 %  MagickGetImageBlob() implements direct to memory image formats.  It
03869 %  returns the image sequence as a blob and its length.  The format of the image
03870 %  determines the format of the returned blob (GIF, JPEG,  PNG, etc.).  To
03871 %  return a different image format, use MagickSetImageFormat().
03872 %
03873 %  Note, some image formats do not permit multiple images to the same image
03874 %  stream (e.g. JPEG).  in this instance, just the first image of the
03875 %  sequence is returned as a blob.
03876 %
03877 %  The format of the MagickGetImagesBlob method is:
03878 %
03879 %      unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
03880 %
03881 %  A description of each parameter follows:
03882 %
03883 %    o wand: the magick wand.
03884 %
03885 %    o length: the length of the blob.
03886 %
03887 */
03888 WandExport unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
03889 {
03890   unsigned char
03891     *blob;
03892 
03893   assert(wand != (MagickWand *) NULL);
03894   assert(wand->signature == WandSignature);
03895   if (wand->debug != MagickFalse)
03896     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03897   if (wand->images == (Image *) NULL)
03898     {
03899       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
03900         "ContainsNoImages","`%s'",wand->name);
03901       return((unsigned char *) NULL);
03902     }
03903   blob=ImagesToBlob(wand->image_info,GetFirstImageInList(wand->images),length,
03904     wand->exception);
03905   return(blob);
03906 }
03907 
03908 /*
03909 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03910 %                                                                             %
03911 %                                                                             %
03912 %                                                                             %
03913 %   M a g i c k G e t I m a g e B l u e P r i m a r y                         %
03914 %                                                                             %
03915 %                                                                             %
03916 %                                                                             %
03917 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03918 %
03919 %  MagickGetImageBluePrimary() returns the chromaticy blue primary point for the
03920 %  image.
03921 %
03922 %  The format of the MagickGetImageBluePrimary method is:
03923 %
03924 %      MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,double *x,
03925 %        double *y)
03926 %
03927 %  A description of each parameter follows:
03928 %
03929 %    o wand: the magick wand.
03930 %
03931 %    o x: the chromaticity blue primary x-point.
03932 %
03933 %    o y: the chromaticity blue primary y-point.
03934 %
03935 */
03936 WandExport MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,
03937   double *x,double *y)
03938 {
03939   assert(wand != (MagickWand *) NULL);
03940   assert(wand->signature == WandSignature);
03941   if (wand->debug != MagickFalse)
03942     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03943   if (wand->images == (Image *) NULL)
03944     ThrowWandException(WandError,"ContainsNoImages",wand->name);
03945   *x=wand->images->chromaticity.blue_primary.x;
03946   *y=wand->images->chromaticity.blue_primary.y;
03947   return(MagickTrue);
03948 }
03949 
03950 /*
03951 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03952 %                                                                             %
03953 %                                                                             %
03954 %                                                                             %
03955 %   M a g i c k G e t I m a g e B o r d e r C o l o r                         %
03956 %                                                                             %
03957 %                                                                             %
03958 %                                                                             %
03959 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03960 %
03961 %  MagickGetImageBorderColor() returns the image border color.
03962 %
03963 %  The format of the MagickGetImageBorderColor method is:
03964 %
03965 %      MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
03966 %        PixelWand *border_color)
03967 %
03968 %  A description of each parameter follows:
03969 %
03970 %    o wand: the magick wand.
03971 %
03972 %    o border_color: Return the border color.
03973 %
03974 */
03975 WandExport MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
03976   PixelWand *border_color)
03977 {
03978   assert(wand != (MagickWand *) NULL);
03979   assert(wand->signature == WandSignature);
03980   if (wand->debug != MagickFalse)
03981     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
03982   if (wand->images == (Image *) NULL)
03983     ThrowWandException(WandError,"ContainsNoImages",wand->name);
03984   PixelSetQuantumColor(border_color,&wand->images->border_color);
03985   return(MagickTrue);
03986 }
03987 
03988 /*
03989 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03990 %                                                                             %
03991 %                                                                             %
03992 %                                                                             %
03993 %   M a g i c k G e t I m a g e C h a n n e l D e p t h                       %
03994 %                                                                             %
03995 %                                                                             %
03996 %                                                                             %
03997 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
03998 %
03999 %  MagickGetImageChannelDepth() gets the depth for one or more image channels.
04000 %
04001 %  The format of the MagickGetImageChannelDepth method is:
04002 %
04003 %      unsigned long MagickGetImageChannelDepth(MagickWand *wand,
04004 %        const ChannelType channel)
04005 %
04006 %  A description of each parameter follows:
04007 %
04008 %    o wand: the magick wand.
04009 %
04010 %    o channel: the image channel(s).
04011 %
04012 */
04013 WandExport unsigned long MagickGetImageChannelDepth(MagickWand *wand,
04014   const ChannelType channel)
04015 {
04016   assert(wand != (MagickWand *) NULL);
04017   assert(wand->signature == WandSignature);
04018   if (wand->debug != MagickFalse)
04019     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
04020   if (wand->images == (Image *) NULL)
04021     ThrowWandException(WandError,"ContainsNoImages",wand->name);
04022   return(GetImageChannelDepth(wand->images,channel,wand->exception));
04023 }
04024 
04025 /*
04026 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
04027 %                                                                             %
04028 %                                                                             %
04029 %                                                                             %
04030 %   M a g i c k G e t I m a g e C h a n n e l D i s t o r t i o n             %
04031 %                                                                             %
04032 %                                                                             %
04033 %                                                                             %
04034 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
04035 %
04036 %  MagickGetImageChannelDistortion() compares one or more image channels of an
04037 %  image to a reconstructed image and returns the specified distortion metric.
04038 %
04039 %  The format of the MagickGetImageChannelDistortion method is:
04040 %
04041 %      MagickBooleanType MagickGetImageChannelDistortion(MagickWand *wand,
04042 %        const MagickWand *reference,const ChannelType channel,
04043 %        const MetricType metric,double *distortion)
04044 %
04045 %  A description of each parameter follows:
04046 %
04047 %    o wand: the magick wand.
04048 %
04049 %    o reference: the reference wand.
04050 %
04051 %    o channel: the channel.
04052 %
04053 %    o metric: the metric.
04054 %
04055 %    o distortion: the computed distortion between the images.
04056 %
04057 */
04058 WandExport MagickBooleanType MagickGetImageChannelDistortion(MagickWand *wand,
04059   const MagickWand *reference,const ChannelType channel,const MetricType metric,
04060   double *distortion)
04061 {
04062   MagickBooleanType
04063     status;
04064 
04065   assert(wand != (MagickWand *) NULL);
04066   assert(wand->signature == WandSignature);
04067   if (wand->debug != MagickFalse)
04068     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
04069   assert(reference != (MagickWand *) NULL);
04070   assert(reference->signature == WandSignature);
04071   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
04072     ThrowWandException(WandError,"ContainsNoImages",wand->name);
04073   status=GetImageChannelDistortion(wand->images,reference->images,channel,
04074     metric,distortion,&wand->images->exception);
04075   return(status);
04076 }
04077 
04078 /*
04079 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
04080 %                                                                             %
04081 %                                                                             %
04082 %                                                                             %
04083 %   M a g i c k G e t I m a g e C h a n n e l D i s t o r t i o n s           %
04084 %                                                                             %
04085 %                                                                             %
04086 %                                                                             %
04087 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
04088 %
04089 %  MagickGetImageChannelDistortions() compares one or more image channels of an
04090 %  image to a reconstructed image and returns the specified distortion metrics.
04091 %
04092 %  Use MagickRelinquishMemory() to free the metrics when you are done with them.
04093 %
04094 %  The format of the MagickGetImageChannelDistortion method is:
04095 %
04096 %      double *MagickGetImageChannelDistortion(MagickWand *wand,
04097 %        const MagickWand *reference,const MetricType metric)
04098 %
04099 %  A description of each parameter follows:
04100 %
04101 %    o wand: the magick wand.
04102 %
04103 %    o reference: the reference wand.
04104 %
04105 %    o metric: the metric.
04106 %
04107 */
04108 WandExport double *MagickGetImageChannelDistortions(MagickWand *wand,
04109   const MagickWand *reference,const MetricType metric)
04110 {
04111   double
04112     *channel_distortion;
04113 
04114   assert(wand != (MagickWand *) NULL);
04115   assert(wand->signature == WandSignature);
04116   if (wand->debug != MagickFalse)
04117     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
04118   assert(reference != (MagickWand *) NULL);
04119   assert(reference->signature == WandSignature);
04120   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
04121     {
04122       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
04123         "ContainsNoImages","`%s'",wand->name);
04124       return((double *) NULL);
04125     }
04126   channel_distortion=GetImageChannelDistortions(wand->images,reference->images,
04127     metric,&wand->images->exception);
04128   return(channel_distortion);
04129 }
04130 
04131 /*
04132 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
04133 %                                                                             %
04134 %                                                                             %
04135 %                                                                             %
04136 %   M a g i c k G e t I m a g e C h a n n e l M e a n                         %
04137 %                                                                             %
04138 %                                                                             %
04139 %                                                                             %
04140 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
04141 %
04142 %  MagickGetImageChannelMean() gets the mean and standard deviation of one or
04143 %  more image channels.
04144 %
04145 %  The format of the MagickGetImageChannelMean method is:
04146 %
04147 %      MagickBooleanType MagickGetImageChannelMean(MagickWand *wand,
04148 %        const ChannelType channel,double *mean,double *standard_deviation)
04149 %
04150 %  A description of each parameter follows:
04151 %
04152 %    o wand: the magick wand.
04153 %
04154 %    o channel: the image channel(s).
04155 %
04156 %    o mean:  The mean pixel value for the specified channel(s).
04157 %
04158 %    o standard_deviation:  The standard deviation for the specified channel(s).
04159 %
04160 */
04161 WandExport MagickBooleanType MagickGetImageChannelMean(MagickWand *wand,
04162   const ChannelType channel,double *mean,double *standard_deviation)
04163 {
04164   MagickBooleanType
04165     status;
04166 
04167   assert(wand != (MagickWand *) NULL);
04168   assert(wand->signature == WandSignature);
04169   if (wand->debug != MagickFalse)
04170     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
04171   if (wand->images == (Image *) NULL)
04172     ThrowWandException(WandError,"ContainsNoImages",wand->name);
04173   status=GetImageChannelMean(wand->images,channel,mean,standard_deviation,
04174     wand->exception);
04175   return(status);
04176 }
04177 
04178 /*
04179 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
04180 %                                                                             %
04181 %                                                                             %
04182 %                                                                             %
04183 %   M a g i c k G e t I m a g e C h a n n e l K u r t o s i s                 %
04184 %                                                                             %
04185 %                                                                             %
04186 %                                                                             %
04187 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
04188 %
04189 %  MagickGetImageChannelKurtosis() gets the kurtosis and skewness of one or
04190 %  more image channels.
04191 %
04192 %  The format of the MagickGetImageChannelKurtosis method is:
04193 %
04194 %      MagickBooleanType MagickGetImageChannelKurtosis(MagickWand *wand,
04195 %        const ChannelType channel,double *kurtosis,double *skewness)
04196 %
04197 %  A description of each parameter follows:
04198 %
04199 %    o wand: the magick wand.
04200 %
04201 %    o channel: the image channel(s).
04202 %
04203 %    o kurtosis:  The kurtosis for the specified channel(s).
04204 %
04205 %    o skewness:  The skewness for the specified channel(s).
04206 %
04207 */
04208 WandExport MagickBooleanType MagickGetImageChannelKurtosis(MagickWand *wand,
04209   const ChannelType channel,double *kurtosis,double *skewness)
04210 {
04211   MagickBooleanType
04212     status;
04213 
04214   assert(wand != (MagickWand *) NULL);
04215   assert(wand->signature == WandSignature);
04216   if (wand->debug != MagickFalse)
04217     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
04218   if (wand->images == (Image *) NULL)
04219     ThrowWandException(WandError,"ContainsNoImages",wand->name);
04220   status=GetImageChannelKurtosis(wand->images,channel,kurtosis,skewness,
04221     wand->exception);
04222   return(status);
04223 }
04224 
04225 /*
04226 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
04227 %                                                                             %
04228 %                                                                             %
04229 %                                                                             %
04230 %   M a g i c k G e t I m a g e C h a n n e l R a n g e                       %
04231 %                                                                             %
04232 %                                                                             %
04233 %                                                                             %
04234 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
04235 %
04236 %  MagickGetImageChannelRange() gets the range for one or more image channels.
04237 %
04238 %  The format of the MagickGetImageChannelRange method is:
04239 %
04240 %      MagickBooleanType MagickGetImageChannelRange(MagickWand *wand,
04241 %        const ChannelType channel,double *minima,double *maxima)
04242 %
04243 %  A description of each parameter follows:
04244 %
04245 %    o wand: the magick wand.
04246 %
04247 %    o channel: the image channel(s).
04248 %
04249 %    o minima:  The minimum pixel value for the specified channel(s).
04250 %
04251 %    o maxima:  The maximum pixel value for the specified channel(s).
04252 %
04253 */
04254 WandExport MagickBooleanType MagickGetImageChannelRange(MagickWand *wand,
04255   const ChannelType channel,double *minima,double *maxima)
04256 {
04257   MagickBooleanType
04258     status;
04259 
04260   assert(wand != (MagickWand *) NULL);
04261   assert(wand->signature == WandSignature);
04262   if (wand->debug != MagickFalse)
04263     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
04264   if (wand->images == (Image *) NULL)
04265     ThrowWandException(WandError,"ContainsNoImages",wand->name);
04266   status=GetImageChannelRange(wand->images,channel,minima,maxima,
04267     wand->exception);
04268   return(status);
04269 }
04270 
04271 /*
04272 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
04273 %                                                                             %
04274 %                                                                             %
04275 %                                                                             %
04276 %   M a g i c k G e t I m a g e C h a n n e l S t a t i s t i c s             %
04277 %                                                                             %
04278 %                                                                             %
04279 %                                                                             %
04280 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
04281 %
04282 %  MagickGetImageChannelStatistics() returns statistics for each channel in the
04283 %  image.  The statistics include the channel depth, its minima and
04284 %  maxima, the mean, the standard deviation, the kurtosis and the skewness.
04285 %  You can access the red channel mean, for example, like this:
04286 %
04287 %      channel_statistics=MagickGetImageChannelStatistics(image,excepton);
04288 %      red_mean=channel_statistics[RedChannel].mean;
04289 %
04290 %  Use MagickRelinquishMemory() to free the statistics buffer.
04291 %
04292 %  The format of the MagickGetImageChannelStatistics method is:
04293 %
04294 %      ChannelStatistics *MagickGetImageChannelStatistics(MagickWand *wand)
04295 %
04296 %  A description of each parameter follows:
04297 %
04298 %    o wand: the magick wand.
04299 %
04300 */
04301 WandExport ChannelStatistics *MagickGetImageChannelStatistics(MagickWand *wand)
04302 {
04303   assert(wand != (MagickWand *) NULL);
04304   assert(wand->signature == WandSignature);
04305   if (wand->debug != MagickFalse)
04306     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
04307   if (wand->images == (Image *) NULL)
04308     {
04309       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
04310         "ContainsNoImages","`%s'",wand->name);
04311       return((ChannelStatistics *) NULL);
04312     }
04313   return(GetImageChannelStatistics(wand->images,wand->exception));
04314 }
04315 
04316 /*
04317 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
04318 %                                                                             %
04319 %                                                                             %
04320 %                                                                             %
04321 %   M a g i c k G e t I m a g e C o l o r m a p C o l o r                     %
04322 %                                                                             %
04323 %                                                                             %
04324 %                                                                             %
04325 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
04326 %
04327 %  MagickGetImageColormapColor() returns the color of the specified colormap
04328 %  index.
04329 %
04330 %  The format of the MagickGetImageColormapColor method is:
04331 %
04332 %      MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
04333 %        const unsigned long index,PixelWand *color)
04334 %
04335 %  A description of each parameter follows:
04336 %
04337 %    o wand: the magick wand.
04338 %
04339 %    o index: the offset into the image colormap.
04340 %
04341 %    o color: Return the colormap color in this wand.
04342 %
04343 */
04344 WandExport MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
04345   const unsigned long index,PixelWand *color)
04346 {
04347   assert(wand != (MagickWand *) NULL);
04348   assert(wand->signature == WandSignature);
04349   if (wand->debug != MagickFalse)
04350     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
04351   if (wand->images == (Image *) NULL)
04352     ThrowWandException(WandError,"ContainsNoImages",wand->name);
04353   if ((wand->images->colormap == (PixelPacket *) NULL) ||
04354       (index >= wand->images->colors))
04355     {
04356       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
04357         "InvalidColormapIndex","`%s'",wand->name);
04358       return(MagickFalse);
04359     }
04360   PixelSetQuantumColor(color,wand->images->colormap+index);
04361   return(MagickTrue);
04362 }
04363 
04364 /*
04365 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
04366 %                                                                             %
04367 %                                                                             %
04368 %                                                                             %
04369 %   M a g i c k G e t I m a g e C o l o r s                                   %
04370 %                                                                             %
04371 %                                                                             %
04372 %                                                                             %
04373 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
04374 %
04375 %  MagickGetImageColors() gets the number of unique colors in the image.
04376 %
04377 %  The format of the MagickGetImageColors method is:
04378 %
04379 %      unsigned long MagickGetImageColors(MagickWand *wand)
04380 %
04381 %  A description of each parameter follows:
04382 %
04383 %    o wand: the magick wand.
04384 %
04385 */
04386 WandExport unsigned long MagickGetImageColors(MagickWand *wand)
04387 {
04388   assert(wand != (MagickWand *) NULL);
04389   assert(wand->signature == WandSignature);
04390   if (wand->debug != MagickFalse)
04391     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
04392   if (wand->images == (Image *) NULL)
04393     {
04394       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
04395         "ContainsNoImages","`%s'",wand->name);
04396       return(0);
04397     }
04398   return(GetNumberColors(wand->images,(FILE *) NULL,wand->exception));
04399 }
04400 
04401 /*
04402 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
04403 %                                                                             %
04404 %                                                                             %
04405 %                                                                             %
04406 %   M a g i c k G e t I m a g e C o l o r s p a c e                           %
04407 %                                                                             %
04408 %                                                                             %
04409 %                                                                             %
04410 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
04411 %
04412 %  MagickGetImageColorspace() gets the image colorspace.
04413 %
04414 %  The format of the MagickGetImageColorspace method is:
04415 %
04416 %      ColorspaceType MagickGetImageColorspace(MagickWand *wand)
04417 %
04418 %  A description of each parameter follows:
04419 %
04420 %    o wand: the magick wand.
04421 %
04422 */
04423 WandExport ColorspaceType MagickGetImageColorspace(MagickWand *wand)
04424 {
04425   assert(wand != (MagickWand *) NULL);
04426   assert(wand->signature == WandSignature);
04427   if (wand->debug != MagickFalse)
04428     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
04429   if (wand->images == (Image *) NULL)
04430     {
04431       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
04432         "ContainsNoImages","`%s'",wand->name);
04433       return(UndefinedColorspace);
04434     }
04435   return(wand->images->colorspace);
04436 }
04437 
04438 /*
04439 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
04440 %                                                                             %
04441 %                                                                             %
04442 %                                                                             %
04443 %   M a g i c k G e t I m a g e C o m p o s e                                 %
04444 %                                                                             %
04445 %                                                                             %
04446 %                                                                             %
04447 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
04448 %
04449 %  MagickGetImageCompose() returns the composite operator associated with the
04450 %  image.
04451 %
04452 %  The format of the MagickGetImageCompose method is:
04453 %
04454 %      CompositeOperator MagickGetImageCompose(MagickWand *wand)
04455 %
04456 %  A description of each parameter follows:
04457 %
04458 %    o wand: the magick wand.
04459 %
04460 */
04461 WandExport CompositeOperator MagickGetImageCompose(MagickWand *wand)
04462 {
04463   assert(wand != (MagickWand *) NULL);
04464   assert(wand->signature == WandSignature);
04465   if (wand->debug != MagickFalse)
04466     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
04467   if (wand->images == (Image *) NULL)
04468     {
04469       (void) ThrowMagickException(wand->