52#include "MagickWand/studio.h"
53#include "MagickWand/MagickWand.h"
54#include "MagickWand/magick-wand-private.h"
55#include "MagickWand/mogrify-private.h"
56#include "MagickCore/blob-private.h"
57#include "MagickCore/color-private.h"
58#include "MagickCore/composite-private.h"
59#include "MagickCore/geometry-private.h"
60#include "MagickCore/image-private.h"
61#include "MagickCore/monitor-private.h"
62#include "MagickCore/profile-private.h"
63#include "MagickCore/string-private.h"
64#include "MagickCore/thread-private.h"
65#include "MagickCore/timer-private.h"
66#include "MagickCore/utility-private.h"
72 MogrifyAlphaColor[] =
"#bdbdbd",
73 MogrifyBackgroundColor[] =
"#ffffff",
74 MogrifyBorderColor[] =
"#dfdfdf";
79#define UndefinedCompressionQuality 0UL
140static inline Image *GetImageCache(
const ImageInfo *image_info,
const char *path,
141 ExceptionInfo *exception)
144 key[MagickPathExtent];
159 (void) FormatLocaleString(key,MagickPathExtent,
"cache:%s",path);
160 sans_exception=AcquireExceptionInfo();
161 image=(Image *) GetImageRegistry(ImageRegistryType,key,sans_exception);
162 sans_exception=DestroyExceptionInfo(sans_exception);
163 if (image != (Image *) NULL)
165 read_info=CloneImageInfo(image_info);
166 (void) CopyMagickString(read_info->filename,path,MagickPathExtent);
167 image=ReadImage(read_info,exception);
168 read_info=DestroyImageInfo(read_info);
169 if (image != (Image *) NULL)
170 (void) SetImageRegistry(ImageRegistryType,key,image,exception);
174static inline MagickBooleanType IsPathWritable(
const char *path)
176 if (IsPathAccessible(path) == MagickFalse)
178 if (access_utf8(path,W_OK) != 0)
183static MagickBooleanType MonitorProgress(
const char *text,
184 const MagickOffsetType offset,
const MagickSizeType extent,
185 void *wand_unused(client_data))
188 message[MagickPathExtent],
189 tag[MagickPathExtent];
197 magick_unreferenced(client_data);
199 if ((extent <= 1) || (offset < 0) || (offset >= (MagickOffsetType) extent))
201 if ((offset != (MagickOffsetType) (extent-1)) && ((offset % 50) != 0))
203 (void) CopyMagickString(tag,text == (
const char *) NULL ?
"null" : text,
206 if (p != (
char *) NULL)
208 (void) FormatLocaleString(message,MagickPathExtent,
"Monitor/%s",tag);
209 locale_message=GetLocaleMessage(message);
210 if (locale_message == message)
212 if (p == (
char *) NULL)
213 (void) FormatLocaleFile(stderr,
"%s: %ld of %lu, %02ld%% complete\r",
214 locale_message,(
long) offset,(
unsigned long) extent,(
long)
215 (100.0*offset*PerceptibleReciprocal(extent-1.0)));
217 (
void) FormatLocaleFile(stderr,
"%s[%s]: %ld of %lu, %02ld%% complete\r",
218 locale_message,p+1,(
long) offset,(
unsigned long) extent,(
long)
219 (100.0*offset*PerceptibleReciprocal(extent-1.0)));
220 if (offset == (MagickOffsetType) (extent-1))
221 (void) FormatLocaleFile(stderr,
"\n");
222 (void) fflush(stderr);
226static Image *SparseColorOption(
const Image *image,
227 const SparseColorMethod method,
const char *arguments,
228 const MagickBooleanType color_from_image,ExceptionInfo *exception)
231 token[MagickPathExtent];
262 assert(image != (Image *) NULL);
263 assert(image->signature == MagickCoreSignature);
264 assert(exception != (ExceptionInfo *) NULL);
265 assert(exception->signature == MagickCoreSignature);
266 if (IsEventLogging() != MagickFalse)
267 (void) LogMagickEvent(TraceEvent,GetMagickModule(),
"%s",image->filename);
272 if ((GetPixelRedTraits(image) & UpdatePixelTrait) != 0)
274 if ((GetPixelGreenTraits(image) & UpdatePixelTrait) != 0)
276 if ((GetPixelBlueTraits(image) & UpdatePixelTrait) != 0)
278 if (((GetPixelBlackTraits(image) & UpdatePixelTrait) != 0) &&
279 (image->colorspace == CMYKColorspace))
281 if (((GetPixelAlphaTraits(image) & UpdatePixelTrait) != 0) &&
282 (image->alpha_trait != UndefinedPixelTrait))
292 (void) GetNextToken(p,&p,MagickPathExtent,token);
293 if (*token ==
',')
continue;
294 if ( isalpha((
int) ((
unsigned char) *token)) || (*token ==
'#')) {
295 if ( color_from_image ) {
296 (void) ThrowMagickException(exception,GetMagickModule(),
297 OptionError,
"InvalidArgument",
"'%s': %s",
"sparse-color",
298 "Color arg given, when colors are coming from image");
299 return( (Image *) NULL);
308 if ( color_from_image ) {
310 error = ( x % 2 != 0 ) ? MagickTrue : MagickFalse;
311 number_arguments=(x/2)*(2+number_colors);
315 error = ( x % (2+number_colors) != 0 ) ? MagickTrue : MagickFalse;
319 (void) ThrowMagickException(exception,GetMagickModule(),
320 OptionError,
"InvalidArgument",
"'%s': %s",
"sparse-color",
321 "Invalid number of Arguments");
322 return( (Image *) NULL);
326 sparse_arguments=(
double *) AcquireQuantumMemory(number_arguments,
327 sizeof(*sparse_arguments));
328 if (sparse_arguments == (
double *) NULL) {
329 (void) ThrowMagickException(exception,GetMagickModule(),ResourceLimitError,
330 " MemoryAllocationFailed\n""%s",
"SparseColorOption");
331 return( (Image *) NULL);
333 (void) memset(sparse_arguments,0,number_arguments*
334 sizeof(*sparse_arguments));
337 while ((*p !=
'\0') && (x < number_arguments))
341 while (*token ==
',')
342 (void) GetNextToken(p,&p,MagickPathExtent,token);
343 if (*token ==
'\0')
break;
344 if (isalpha((
int) ((
unsigned char) *token)) || (*token ==
'#'))
346 (void) ThrowMagickException(exception,GetMagickModule(),
347 OptionError,
"InvalidArgument",
"'%s': %s",
"sparse-color",
348 "Color found, instead of X-coord");
352 sparse_arguments[x++]=StringToDouble(token,(
char **) NULL);
355 while (*token ==
',')
356 (void) GetNextToken(p,&p,MagickPathExtent,token);
359 if (isalpha((
int) ((
unsigned char) *token)) || (*token ==
'#'))
361 (void) ThrowMagickException(exception,GetMagickModule(),
362 OptionError,
"InvalidArgument",
"'%s': %s",
"sparse-color",
363 "Color found, instead of Y-coord");
367 sparse_arguments[x++]=StringToDouble(token,(
char **) NULL);
370 if ( (color_from_image ) {
379 while (*token ==
',')
380 (void) GetNextToken(p,&p,MagickPathExtent,token);
383 if (isalpha((
int) ((
unsigned char) *token)) || (*token ==
'#'))
386 (void) QueryColorCompliance(token,AllCompliance,&color,exception);
387 if ((GetPixelRedTraits(image) & UpdatePixelTrait) != 0)
388 sparse_arguments[x++] = QuantumScale*color.red;
389 if ((GetPixelGreenTraits(image) & UpdatePixelTrait) != 0)
390 sparse_arguments[x++] = QuantumScale*color.green;
391 if ((GetPixelBlueTraits(image) & UpdatePixelTrait) != 0)
392 sparse_arguments[x++] = QuantumScale*color.blue;
393 if (((GetPixelBlackTraits(image) & UpdatePixelTrait) != 0) &&
394 (image->colorspace == CMYKColorspace))
395 sparse_arguments[x++] = QuantumScale*color.black;
396 if (((GetPixelAlphaTraits(image) & UpdatePixelTrait) != 0) &&
397 (image->alpha_trait != UndefinedPixelTrait))
398 sparse_arguments[x++] = QuantumScale*color.alpha;
403 if ((GetPixelRedTraits(image) & UpdatePixelTrait) != 0)
405 while (*token ==
',')
406 (void) GetNextToken(p,&p,MagickPathExtent,token);
407 if ((*token ==
'\0') || isalpha((
int) ((
unsigned char) *token)) ||
410 sparse_arguments[x++]=StringToDouble(token,(
char **) NULL);
413 if ((GetPixelGreenTraits(image) & UpdatePixelTrait) != 0)
415 while (*token ==
',')
416 (void) GetNextToken(p,&p,MagickPathExtent,token);
417 if ((*token ==
'\0') || isalpha((
int) ((
unsigned char) *token)) ||
420 sparse_arguments[x++]=StringToDouble(token,(
char **) NULL);
423 if ((GetPixelBlueTraits(image) & UpdatePixelTrait) != 0)
425 while (*token ==
',')
426 (void) GetNextToken(p,&p,MagickPathExtent,token);
427 if ((*token ==
'\0') || isalpha((
int) ((
unsigned char) *token)) ||
430 sparse_arguments[x++]=StringToDouble(token,(
char **) NULL);
433 if (((GetPixelBlackTraits(image) & UpdatePixelTrait) != 0) &&
434 (image->colorspace == CMYKColorspace))
436 while (*token ==
',')
437 (void) GetNextToken(p,&p,MagickPathExtent,token);
438 if ((*token ==
'\0') || isalpha((
int) ((
unsigned char) *token)) ||
441 sparse_arguments[x++]=StringToDouble(token,(
char **) NULL);
444 if (((GetPixelAlphaTraits(image) & UpdatePixelTrait) != 0) &&
445 (image->alpha_trait != UndefinedPixelTrait))
447 while (*token ==
',')
448 (void) GetNextToken(p,&p,MagickPathExtent,token);
449 if ((*token ==
'\0') || isalpha((
int) ((
unsigned char) *token)) ||
452 sparse_arguments[x++]=StringToDouble(token,(
char **) NULL);
458 if ((number_arguments != x) && (!error))
460 (void) ThrowMagickException(exception,GetMagickModule(),OptionError,
461 " InvalidArgument",
"'%s': %s",
"sparse-color",
"Argument Parsing Error");
462 sparse_arguments=(
double *) RelinquishMagickMemory(sparse_arguments);
463 return((Image *) NULL);
466 return((Image *) NULL);
470 sparse_image=SparseColorImage(image,method,number_arguments,sparse_arguments,
472 sparse_arguments=(
double *) RelinquishMagickMemory(sparse_arguments);
473 return( sparse_image );
476WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,
const int argc,
477 const char **argv,Image **image,ExceptionInfo *exception)
507 PixelInterpolateMethod
523 assert(image_info != (
const ImageInfo *) NULL);
524 assert(image_info->signature == MagickCoreSignature);
525 assert(image != (Image **) NULL);
526 assert((*image)->signature == MagickCoreSignature);
527 if (IsEventLogging() != MagickFalse)
528 (void) LogMagickEvent(TraceEvent,GetMagickModule(),
"%s",(*image)->filename);
531 mogrify_info=CloneImageInfo(image_info);
532 draw_info=CloneDrawInfo(mogrify_info,(DrawInfo *) NULL);
533 quantize_info=AcquireQuantizeInfo(mogrify_info);
534 SetGeometryInfo(&geometry_info);
535 GetPixelInfo(*image,&fill);
536 fill=(*image)->background_color;
538 compose=(*image)->compose;
539 interpolate_method=UndefinedInterpolatePixel;
540 format=GetImageOption(mogrify_info,
"format");
541 SetGeometry(*image,®ion_geometry);
545 for (i=0; i < (ssize_t) argc; i++)
554 if (IsCommandOption(option) == MagickFalse)
556 count=MagickMax(ParseCommandOption(MagickCommandOptions,MagickFalse,option),
558 if ((i+count) >= (ssize_t) argc)
560 status=MogrifyImageInfo(mogrify_info,(
int) count+1,argv+i,exception);
561 mogrify_image=(Image *) NULL;
566 if (LocaleCompare(
"adaptive-blur",option+1) == 0)
571 (void) SyncImageSettings(mogrify_info,*image,exception);
572 flags=ParseGeometry(argv[i+1],&geometry_info);
573 if ((flags & SigmaValue) == 0)
574 geometry_info.sigma=1.0;
575 mogrify_image=AdaptiveBlurImage(*image,geometry_info.rho,
576 geometry_info.sigma,exception);
579 if (LocaleCompare(
"adaptive-resize",option+1) == 0)
584 (void) SyncImageSettings(mogrify_info,*image,exception);
585 (void) ParseRegionGeometry(*image,argv[i+1],&geometry,exception);
586 mogrify_image=AdaptiveResizeImage(*image,geometry.width,
587 geometry.height,exception);
590 if (LocaleCompare(
"adaptive-sharpen",option+1) == 0)
595 (void) SyncImageSettings(mogrify_info,*image,exception);
596 flags=ParseGeometry(argv[i+1],&geometry_info);
597 if ((flags & SigmaValue) == 0)
598 geometry_info.sigma=1.0;
599 mogrify_image=AdaptiveSharpenImage(*image,geometry_info.rho,
600 geometry_info.sigma,exception);
603 if (LocaleCompare(
"affine",option+1) == 0)
610 GetAffineMatrix(&draw_info->affine);
613 (void) ParseAffineGeometry(argv[i+1],&draw_info->affine,exception);
616 if (LocaleCompare(
"alpha",option+1) == 0)
621 (void) SyncImageSettings(mogrify_info,*image,exception);
622 alpha_type=(AlphaChannelOption) ParseCommandOption(
623 MagickAlphaChannelOptions,MagickFalse,argv[i+1]);
624 (void) SetImageAlphaChannel(*image,alpha_type,exception);
627 if (LocaleCompare(
"annotate",option+1) == 0)
631 geometry_str[MagickPathExtent];
636 (void) SyncImageSettings(mogrify_info,*image,exception);
637 SetGeometryInfo(&geometry_info);
638 flags=ParseGeometry(argv[i+1],&geometry_info);
639 if ((flags & SigmaValue) == 0)
640 geometry_info.sigma=geometry_info.rho;
641 text=InterpretImageProperties(mogrify_info,*image,argv[i+2],
643 if (text == (
char *) NULL)
645 (void) CloneString(&draw_info->text,text);
646 text=DestroyString(text);
647 (void) FormatLocaleString(geometry_str,MagickPathExtent,
"%+f%+f",
648 geometry_info.xi,geometry_info.psi);
649 (void) CloneString(&draw_info->geometry,geometry_str);
650 draw_info->affine.sx=cos(DegreesToRadians(
651 fmod(geometry_info.rho,360.0)));
652 draw_info->affine.rx=sin(DegreesToRadians(
653 fmod(geometry_info.rho,360.0)));
654 draw_info->affine.ry=(-sin(DegreesToRadians(
655 fmod(geometry_info.sigma,360.0))));
656 draw_info->affine.sy=cos(DegreesToRadians(
657 fmod(geometry_info.sigma,360.0)));
658 (void) AnnotateImage(*image,draw_info,exception);
661 if (LocaleCompare(
"antialias",option+1) == 0)
663 draw_info->stroke_antialias=(*option ==
'-') ? MagickTrue :
665 draw_info->text_antialias=(*option ==
'-') ? MagickTrue :
669 if (LocaleCompare(
"attenuate",option+1) == 0)
676 attenuate=StringToDouble(argv[i+1],(
char **) NULL);
679 if (LocaleCompare(
"auto-gamma",option+1) == 0)
684 (void) SyncImageSettings(mogrify_info,*image,exception);
685 (void) AutoGammaImage(*image,exception);
688 if (LocaleCompare(
"auto-level",option+1) == 0)
693 (void) SyncImageSettings(mogrify_info,*image,exception);
694 (void) AutoLevelImage(*image,exception);
697 if (LocaleCompare(
"auto-orient",option+1) == 0)
699 (void) SyncImageSettings(mogrify_info,*image,exception);
700 mogrify_image=AutoOrientImage(*image,(*image)->orientation,
704 if (LocaleCompare(
"auto-threshold",option+1) == 0)
709 (void) SyncImageSettings(mogrify_info,*image,exception);
710 method=(AutoThresholdMethod) ParseCommandOption(
711 MagickAutoThresholdOptions,MagickFalse,argv[i+1]);
712 (void) AutoThresholdImage(*image,method,exception);
719 if (LocaleCompare(
"bilateral-blur",option+1) == 0)
724 (void) SyncImageSettings(mogrify_info,*image,exception);
725 flags=ParseGeometry(argv[i+1],&geometry_info);
726 if ((flags & SigmaValue) == 0)
727 geometry_info.sigma=geometry_info.rho;
728 if ((flags & XiValue) == 0)
729 geometry_info.xi=1.0*sqrt(geometry_info.rho*geometry_info.rho+
730 geometry_info.sigma*geometry_info.sigma);
731 if ((flags & PsiValue) == 0)
732 geometry_info.psi=0.25*sqrt(geometry_info.rho*geometry_info.rho+
733 geometry_info.sigma*geometry_info.sigma);
734 mogrify_image=BilateralBlurImage(*image,(
size_t) geometry_info.rho,
735 (
size_t) geometry_info.sigma,geometry_info.xi,geometry_info.psi,
739 if (LocaleCompare(
"black-threshold",option+1) == 0)
744 (void) SyncImageSettings(mogrify_info,*image,exception);
745 (void) BlackThresholdImage(*image,argv[i+1],exception);
748 if (LocaleCompare(
"blue-shift",option+1) == 0)
753 (void) SyncImageSettings(mogrify_info,*image,exception);
754 geometry_info.rho=1.5;
756 flags=ParseGeometry(argv[i+1],&geometry_info);
757 mogrify_image=BlueShiftImage(*image,geometry_info.rho,exception);
760 if (LocaleCompare(
"blur",option+1) == 0)
765 (void) SyncImageSettings(mogrify_info,*image,exception);
766 flags=ParseGeometry(argv[i+1],&geometry_info);
767 if ((flags & SigmaValue) == 0)
768 geometry_info.sigma=1.0;
769 if ((flags & XiValue) == 0)
770 geometry_info.xi=0.0;
771 mogrify_image=BlurImage(*image,geometry_info.rho,
772 geometry_info.sigma,exception);
775 if (LocaleCompare(
"border",option+1) == 0)
780 (void) SyncImageSettings(mogrify_info,*image,exception);
781 flags=ParsePageGeometry(*image,argv[i+1],&geometry,exception);
782 mogrify_image=BorderImage(*image,&geometry,compose,exception);
785 if (LocaleCompare(
"bordercolor",option+1) == 0)
789 (void) QueryColorCompliance(MogrifyBorderColor,AllCompliance,
790 &draw_info->border_color,exception);
793 (void) QueryColorCompliance(argv[i+1],AllCompliance,
794 &draw_info->border_color,exception);
797 if (LocaleCompare(
"box",option+1) == 0)
799 (void) QueryColorCompliance(argv[i+1],AllCompliance,
800 &draw_info->undercolor,exception);
803 if (LocaleCompare(
"brightness-contrast",option+1) == 0)
812 (void) SyncImageSettings(mogrify_info,*image,exception);
813 flags=ParseGeometry(argv[i+1],&geometry_info);
814 brightness=geometry_info.rho;
816 if ((flags & SigmaValue) != 0)
817 contrast=geometry_info.sigma;
818 (void) BrightnessContrastImage(*image,brightness,contrast,
826 if (LocaleCompare(
"canny",option+1) == 0)
831 (void) SyncImageSettings(mogrify_info,*image,exception);
832 flags=ParseGeometry(argv[i+1],&geometry_info);
833 if ((flags & SigmaValue) == 0)
834 geometry_info.sigma=1.0;
835 if ((flags & XiValue) == 0)
836 geometry_info.xi=0.10;
837 if ((flags & PsiValue) == 0)
838 geometry_info.psi=0.30;
839 if ((flags & PercentValue) != 0)
841 geometry_info.xi/=100.0;
842 geometry_info.psi/=100.0;
844 mogrify_image=CannyEdgeImage(*image,geometry_info.rho,
845 geometry_info.sigma,geometry_info.xi,geometry_info.psi,exception);
848 if (LocaleCompare(
"cdl",option+1) == 0)
851 *color_correction_collection;
856 (void) SyncImageSettings(mogrify_info,*image,exception);
857 color_correction_collection=FileToString(argv[i+1],~0UL,exception);
858 if (color_correction_collection == (
char *) NULL)
860 (void) ColorDecisionListImage(*image,color_correction_collection,
864 if (LocaleCompare(
"channel",option+1) == 0)
869 (void) SyncImageSettings(mogrify_info,*image,exception);
872 (void) SetPixelChannelMask(*image,DefaultChannels);
875 channel=(ChannelType) ParseChannelOption(argv[i+1]);
876 (void) SetPixelChannelMask(*image,channel);
879 if (LocaleCompare(
"charcoal",option+1) == 0)
884 (void) SyncImageSettings(mogrify_info,*image,exception);
885 flags=ParseGeometry(argv[i+1],&geometry_info);
886 if ((flags & SigmaValue) == 0)
887 geometry_info.sigma=1.0;
888 if ((flags & XiValue) == 0)
889 geometry_info.xi=1.0;
890 mogrify_image=CharcoalImage(*image,geometry_info.rho,
891 geometry_info.sigma,exception);
894 if (LocaleCompare(
"chop",option+1) == 0)
899 (void) SyncImageSettings(mogrify_info,*image,exception);
900 (void) ParseGravityGeometry(*image,argv[i+1],&geometry,exception);
901 mogrify_image=ChopImage(*image,&geometry,exception);
904 if (LocaleCompare(
"clahe",option+1) == 0)
909 (void) SyncImageSettings(mogrify_info,*image,exception);
910 flags=ParseRegionGeometry(*image,argv[i+1],&geometry,exception);
911 flags=ParseGeometry(argv[i+1],&geometry_info);
912 (void) CLAHEImage(*image,geometry.width,geometry.height,
913 (
size_t) geometry.x,geometry_info.psi,exception);
916 if (LocaleCompare(
"clip",option+1) == 0)
918 (void) SyncImageSettings(mogrify_info,*image,exception);
921 (void) SetImageMask(*image,WritePixelMask,(
const Image *) NULL,
925 (void) ClipImage(*image,exception);
928 if (LocaleCompare(
"clip-mask",option+1) == 0)
933 (void) SyncImageSettings(mogrify_info,*image,exception);
939 (void) SetImageMask(*image,WritePixelMask,(
const Image *) NULL,
946 clip_mask=GetImageCache(mogrify_info,argv[i+1],exception);
947 if (clip_mask == (Image *) NULL)
949 (void) SetImageMask(*image,WritePixelMask,clip_mask,exception);
950 clip_mask=DestroyImage(clip_mask);
953 if (LocaleCompare(
"clip-path",option+1) == 0)
955 (void) SyncImageSettings(mogrify_info,*image,exception);
956 (void) ClipImagePath(*image,argv[i+1],*option ==
'-' ? MagickTrue :
957 MagickFalse,exception);
960 if (LocaleCompare(
"colorize",option+1) == 0)
965 (void) SyncImageSettings(mogrify_info,*image,exception);
966 mogrify_image=ColorizeImage(*image,argv[i+1],&fill,exception);
969 if (LocaleCompare(
"color-matrix",option+1) == 0)
974 (void) SyncImageSettings(mogrify_info,*image,exception);
975 kernel=AcquireKernelInfo(argv[i+1],exception);
976 if (kernel == (KernelInfo *) NULL)
979 mogrify_image=ColorMatrixImage(*image,kernel,exception);
980 kernel=DestroyKernelInfo(kernel);
983 if (LocaleCompare(
"colors",option+1) == 0)
988 (void) SyncImageSettings(mogrify_info,*image,exception);
989 quantize_info->number_colors=StringToUnsignedLong(argv[i+1]);
990 if (quantize_info->number_colors == 0)
992 if (((*image)->storage_class == DirectClass) ||
993 (*image)->colors > quantize_info->number_colors)
994 (void) QuantizeImage(quantize_info,*image,exception);
996 (
void) CompressImageColormap(*image,exception);
999 if (LocaleCompare(
"colorspace",option+1) == 0)
1004 (void) SyncImageSettings(mogrify_info,*image,exception);
1007 (void) TransformImageColorspace(*image,sRGBColorspace,
1011 colorspace=(ColorspaceType) ParseCommandOption(
1012 MagickColorspaceOptions,MagickFalse,argv[i+1]);
1013 (void) TransformImageColorspace(*image,colorspace,exception);
1016 if (LocaleCompare(
"color-threshold",option+1) == 0)
1025 (void) SyncImageSettings(mogrify_info,*image,exception);
1027 (void) GetColorRange(
"white-black",&start,&stop,exception);
1029 (
void) GetColorRange(argv[i+1],&start,&stop,exception);
1030 (void) ColorThresholdImage(*image,&start,&stop,exception);
1033 if (LocaleCompare(
"compose",option+1) == 0)
1035 (void) SyncImageSettings(mogrify_info,*image,exception);
1036 compose=(CompositeOperator) ParseCommandOption(MagickComposeOptions,
1037 MagickFalse,argv[i+1]);
1040 if (LocaleCompare(
"connected-components",option+1) == 0)
1042 (void) SyncImageSettings(mogrify_info,*image,exception);
1043 mogrify_image=ConnectedComponentsImage(*image,(
size_t)
1044 StringToInteger(argv[i+1]),(CCObjectInfo **) NULL,exception);
1047 if (LocaleCompare(
"contrast",option+1) == 0)
1049 (void) SyncImageSettings(mogrify_info,*image,exception);
1050 (void) ContrastImage(*image,(*option ==
'-') ? MagickTrue :
1051 MagickFalse,exception);
1054 if (LocaleCompare(
"contrast-stretch",option+1) == 0)
1063 (void) SyncImageSettings(mogrify_info,*image,exception);
1064 flags=ParseGeometry(argv[i+1],&geometry_info);
1065 black_point=geometry_info.rho;
1066 white_point=(flags & SigmaValue) != 0 ? geometry_info.sigma :
1068 if ((flags & PercentValue) != 0)
1070 black_point*=(double) (*image)->columns*(*image)->rows/100.0;
1071 white_point*=(double) (*image)->columns*(*image)->rows/100.0;
1073 white_point=(double) (*image)->columns*(*image)->rows-
1075 (void) ContrastStretchImage(*image,black_point,white_point,
1079 if (LocaleCompare(
"convolve",option+1) == 0)
1093 (void) SyncImageSettings(mogrify_info,*image,exception);
1094 kernel_info=AcquireKernelInfo(argv[i+1],exception);
1095 if (kernel_info == (KernelInfo *) NULL)
1097 extent=kernel_info->width*kernel_info->height;
1099 for (j=0; j < (ssize_t) extent; j++)
1100 gamma+=kernel_info->values[j];
1101 gamma=1.0/(fabs((
double) gamma) <= MagickEpsilon ? 1.0 : gamma);
1102 for (j=0; j < (ssize_t) extent; j++)
1103 kernel_info->values[j]*=gamma;
1104 mogrify_image=MorphologyImage(*image,CorrelateMorphology,1,
1105 kernel_info,exception);
1106 kernel_info=DestroyKernelInfo(kernel_info);
1109 if (LocaleCompare(
"crop",option+1) == 0)
1114 (void) SyncImageSettings(mogrify_info,*image,exception);
1115 mogrify_image=CropImageToTiles(*image,argv[i+1],exception);
1118 if (LocaleCompare(
"cycle",option+1) == 0)
1123 (void) SyncImageSettings(mogrify_info,*image,exception);
1124 (void) CycleColormapImage(*image,(ssize_t) StringToLong(argv[i+1]),
1132 if (LocaleCompare(
"decipher",option+1) == 0)
1140 (void) SyncImageSettings(mogrify_info,*image,exception);
1141 passkey=FileToStringInfo(argv[i+1],~0UL,exception);
1142 if (passkey != (StringInfo *) NULL)
1144 (void) PasskeyDecipherImage(*image,passkey,exception);
1145 passkey=DestroyStringInfo(passkey);
1149 if (LocaleCompare(
"density",option+1) == 0)
1154 (void) CloneString(&draw_info->density,argv[i+1]);
1157 if (LocaleCompare(
"depth",option+1) == 0)
1159 (void) SyncImageSettings(mogrify_info,*image,exception);
1162 (void) SetImageDepth(*image,MAGICKCORE_QUANTUM_DEPTH,exception);
1165 (void) SetImageDepth(*image,StringToUnsignedLong(argv[i+1]),
1169 if (LocaleCompare(
"deskew",option+1) == 0)
1177 (void) SyncImageSettings(mogrify_info,*image,exception);
1179 threshold=40.0*(double) QuantumRange/100.0;
1181 threshold=StringToDoubleInterval(argv[i+1],(
double) QuantumRange+
1183 mogrify_image=DeskewImage(*image,threshold,exception);
1186 if (LocaleCompare(
"despeckle",option+1) == 0)
1191 (void) SyncImageSettings(mogrify_info,*image,exception);
1192 mogrify_image=DespeckleImage(*image,exception);
1195 if (LocaleCompare(
"display",option+1) == 0)
1197 (void) CloneString(&draw_info->server_name,argv[i+1]);
1200 if (LocaleCompare(
"distort",option+1) == 0)
1204 token[MagickPathExtent];
1224 (void) SyncImageSettings(mogrify_info,*image,exception);
1225 method=(DistortMethod) ParseCommandOption(MagickDistortOptions,
1226 MagickFalse,argv[i+1]);
1227 if (method == ResizeDistortion)
1236 (void) ParseRegionGeometry(*image,argv[i+2],&geometry,
1238 resize_args[0]=(double) geometry.width;
1239 resize_args[1]=(double) geometry.height;
1240 mogrify_image=DistortImage(*image,method,(
size_t)2,
1241 resize_args,MagickTrue,exception);
1244 args=InterpretImageProperties(mogrify_info,*image,argv[i+2],
1246 if (args == (
char *) NULL)
1249 for (x=0; *p !=
'\0'; x++)
1251 (void) GetNextToken(p,&p,MagickPathExtent,token);
1253 (void) GetNextToken(p,&p,MagickPathExtent,token);
1255 number_arguments=(size_t) x;
1256 arguments=(
double *) AcquireQuantumMemory(number_arguments,
1257 sizeof(*arguments));
1258 if (arguments == (
double *) NULL)
1259 ThrowWandFatalException(ResourceLimitFatalError,
1260 "MemoryAllocationFailed",(*image)->filename);
1261 (void) memset(arguments,0,number_arguments*
1262 sizeof(*arguments));
1264 for (x=0; (x < (ssize_t) number_arguments) && (*p !=
'\0'); x++)
1266 (void) GetNextToken(p,&p,MagickPathExtent,token);
1268 (void) GetNextToken(p,&p,MagickPathExtent,token);
1269 arguments[x]=StringToDouble(token,(
char **) NULL);
1271 args=DestroyString(args);
1272 mogrify_image=DistortImage(*image,method,number_arguments,arguments,
1273 (*option ==
'+') ? MagickTrue : MagickFalse,exception);
1274 arguments=(
double *) RelinquishMagickMemory(arguments);
1277 if (LocaleCompare(
"dither",option+1) == 0)
1281 quantize_info->dither_method=NoDitherMethod;
1284 quantize_info->dither_method=(DitherMethod) ParseCommandOption(
1285 MagickDitherOptions,MagickFalse,argv[i+1]);
1288 if (LocaleCompare(
"draw",option+1) == 0)
1293 (void) SyncImageSettings(mogrify_info,*image,exception);
1294 (void) CloneString(&draw_info->primitive,argv[i+1]);
1295 (void) DrawImage(*image,draw_info,exception);
1302 if (LocaleCompare(
"edge",option+1) == 0)
1307 (void) SyncImageSettings(mogrify_info,*image,exception);
1308 flags=ParseGeometry(argv[i+1],&geometry_info);
1309 mogrify_image=EdgeImage(*image,geometry_info.rho,exception);
1312 if (LocaleCompare(
"emboss",option+1) == 0)
1317 (void) SyncImageSettings(mogrify_info,*image,exception);
1318 flags=ParseGeometry(argv[i+1],&geometry_info);
1319 if ((flags & SigmaValue) == 0)
1320 geometry_info.sigma=1.0;
1321 mogrify_image=EmbossImage(*image,geometry_info.rho,
1322 geometry_info.sigma,exception);
1325 if (LocaleCompare(
"encipher",option+1) == 0)
1333 (void) SyncImageSettings(mogrify_info,*image,exception);
1334 passkey=FileToStringInfo(argv[i+1],~0UL,exception);
1335 if (passkey != (StringInfo *) NULL)
1337 (void) PasskeyEncipherImage(*image,passkey,exception);
1338 passkey=DestroyStringInfo(passkey);
1342 if (LocaleCompare(
"encoding",option+1) == 0)
1344 (void) CloneString(&draw_info->encoding,argv[i+1]);
1347 if (LocaleCompare(
"enhance",option+1) == 0)
1352 (void) SyncImageSettings(mogrify_info,*image,exception);
1353 mogrify_image=EnhanceImage(*image,exception);
1356 if (LocaleCompare(
"equalize",option+1) == 0)
1361 (void) SyncImageSettings(mogrify_info,*image,exception);
1362 (void) EqualizeImage(*image,exception);
1365 if (LocaleCompare(
"evaluate",option+1) == 0)
1370 MagickEvaluateOperator
1373 (void) SyncImageSettings(mogrify_info,*image,exception);
1374 op=(MagickEvaluateOperator) ParseCommandOption(
1375 MagickEvaluateOptions,MagickFalse,argv[i+1]);
1376 constant=StringToDoubleInterval(argv[i+2],(
double) QuantumRange+
1378 (void) EvaluateImage(*image,op,constant,exception);
1381 if (LocaleCompare(
"extent",option+1) == 0)
1386 (void) SyncImageSettings(mogrify_info,*image,exception);
1387 flags=ParseGravityGeometry(*image,argv[i+1],&geometry,exception);
1388 if (geometry.width == 0)
1389 geometry.width=(*image)->columns;
1390 if (geometry.height == 0)
1391 geometry.height=(*image)->rows;
1392 mogrify_image=ExtentImage(*image,&geometry,exception);
1399 if (LocaleCompare(
"family",option+1) == 0)
1403 if (draw_info->family != (
char *) NULL)
1404 draw_info->family=DestroyString(draw_info->family);
1407 (void) SetImageOption(image_info,option+1,argv[i+1]);
1408 (void) CloneString(&draw_info->family,argv[i+1]);
1411 if (LocaleCompare(
"features",option+1) == 0)
1415 (void) DeleteImageArtifact(*image,
"identify:features");
1418 (void) SetImageArtifact(*image,
"identify:features",argv[i+1]);
1419 (void) SetImageArtifact(*image,
"verbose",
"true");
1422 if (LocaleCompare(
"fill",option+1) == 0)
1430 GetPixelInfo(*image,&fill);
1433 (void) QueryColorCompliance(
"none",AllCompliance,&fill,
1435 draw_info->fill=fill;
1436 if (draw_info->fill_pattern != (Image *) NULL)
1437 draw_info->fill_pattern=DestroyImage(draw_info->fill_pattern);
1440 sans=AcquireExceptionInfo();
1441 status=QueryColorCompliance(argv[i+1],AllCompliance,&color,sans);
1442 sans=DestroyExceptionInfo(sans);
1443 if (status == MagickFalse)
1444 draw_info->fill_pattern=GetImageCache(mogrify_info,argv[i+1],
1447 draw_info->fill=fill=color;
1450 if (LocaleCompare(
"flip",option+1) == 0)
1455 (void) SyncImageSettings(mogrify_info,*image,exception);
1456 mogrify_image=FlipImage(*image,exception);
1459 if (LocaleCompare(
"floodfill",option+1) == 0)
1467 (void) SyncImageSettings(mogrify_info,*image,exception);
1468 (void) ParsePageGeometry(*image,argv[i+1],&geometry,exception);
1469 (void) QueryColorCompliance(argv[i+2],AllCompliance,&target,
1471 (void) FloodfillPaintImage(*image,draw_info,&target,geometry.x,
1472 geometry.y,*option ==
'-' ? MagickFalse : MagickTrue,exception);
1475 if (LocaleCompare(
"flop",option+1) == 0)
1480 (void) SyncImageSettings(mogrify_info,*image,exception);
1481 mogrify_image=FlopImage(*image,exception);
1484 if (LocaleCompare(
"font",option+1) == 0)
1488 if (draw_info->font != (
char *) NULL)
1489 draw_info->font=DestroyString(draw_info->font);
1492 (void) CloneString(&draw_info->font,argv[i+1]);
1495 if (LocaleCompare(
"format",option+1) == 0)
1500 if (LocaleCompare(
"frame",option+1) == 0)
1508 (void) SyncImageSettings(mogrify_info,*image,exception);
1509 flags=ParsePageGeometry(*image,argv[i+1],&geometry,exception);
1510 frame_info.width=geometry.width;
1511 frame_info.height=geometry.height;
1512 frame_info.outer_bevel=geometry.x;
1513 frame_info.inner_bevel=geometry.y;
1514 frame_info.x=(ssize_t) frame_info.width;
1515 frame_info.y=(ssize_t) frame_info.height;
1516 frame_info.width=(*image)->columns+2*frame_info.width;
1517 frame_info.height=(*image)->rows+2*frame_info.height;
1518 mogrify_image=FrameImage(*image,&frame_info,compose,exception);
1521 if (LocaleCompare(
"function",option+1) == 0)
1525 token[MagickPathExtent];
1545 (void) SyncImageSettings(mogrify_info,*image,exception);
1546 function=(MagickFunction) ParseCommandOption(MagickFunctionOptions,
1547 MagickFalse,argv[i+1]);
1548 arguments=InterpretImageProperties(mogrify_info,*image,argv[i+2],
1550 if (arguments == (
char *) NULL)
1552 p=(
char *) arguments;
1553 for (x=0; *p !=
'\0'; x++)
1555 (void) GetNextToken(p,&p,MagickPathExtent,token);
1557 (void) GetNextToken(p,&p,MagickPathExtent,token);
1559 number_parameters=(size_t) x;
1560 parameters=(
double *) AcquireQuantumMemory(number_parameters,
1561 sizeof(*parameters));
1562 if (parameters == (
double *) NULL)
1563 ThrowWandFatalException(ResourceLimitFatalError,
1564 "MemoryAllocationFailed",(*image)->filename);
1565 (void) memset(parameters,0,number_parameters*
1566 sizeof(*parameters));
1567 p=(
char *) arguments;
1568 for (x=0; (x < (ssize_t) number_parameters) && (*p !=
'\0'); x++)
1570 (void) GetNextToken(p,&p,MagickPathExtent,token);
1572 (void) GetNextToken(p,&p,MagickPathExtent,token);
1573 parameters[x]=StringToDouble(token,(
char **) NULL);
1575 arguments=DestroyString(arguments);
1576 (void) FunctionImage(*image,function,number_parameters,parameters,
1578 parameters=(
double *) RelinquishMagickMemory(parameters);
1585 if (LocaleCompare(
"gamma",option+1) == 0)
1590 (void) SyncImageSettings(mogrify_info,*image,exception);
1592 (*image)->gamma=StringToDouble(argv[i+1],(
char **) NULL);
1594 (
void) GammaImage(*image,StringToDouble(argv[i+1],(
char **) NULL),
1598 if ((LocaleCompare(
"gaussian-blur",option+1) == 0) ||
1599 (LocaleCompare(
"gaussian",option+1) == 0))
1604 (void) SyncImageSettings(mogrify_info,*image,exception);
1605 flags=ParseGeometry(argv[i+1],&geometry_info);
1606 if ((flags & SigmaValue) == 0)
1607 geometry_info.sigma=1.0;
1608 mogrify_image=GaussianBlurImage(*image,geometry_info.rho,
1609 geometry_info.sigma,exception);
1612 if (LocaleCompare(
"geometry",option+1) == 0)
1617 (void) SyncImageSettings(mogrify_info,*image,exception);
1620 if ((*image)->geometry != (
char *) NULL)
1621 (*image)->geometry=DestroyString((*image)->geometry);
1624 flags=ParseRegionGeometry(*image,argv[i+1],&geometry,exception);
1625 if (((flags & XValue) != 0) || ((flags & YValue) != 0))
1626 (void) CloneString(&(*image)->geometry,argv[i+1]);
1628 mogrify_image=ResizeImage(*image,geometry.width,geometry.height,
1629 (*image)->filter,exception);
1632 if (LocaleCompare(
"gravity",option+1) == 0)
1636 draw_info->gravity=UndefinedGravity;
1639 draw_info->gravity=(GravityType) ParseCommandOption(
1640 MagickGravityOptions,MagickFalse,argv[i+1]);
1643 if (LocaleCompare(
"grayscale",option+1) == 0)
1645 PixelIntensityMethod
1648 (void) SyncImageSettings(mogrify_info,*image,exception);
1649 method=(PixelIntensityMethod) ParseCommandOption(
1650 MagickPixelIntensityOptions,MagickFalse,argv[i+1]);
1651 (void) GrayscaleImage(*image,method,exception);
1658 if (LocaleCompare(
"highlight-color",option+1) == 0)
1660 (void) SetImageArtifact(*image,
"compare:highlight-color",argv[i+1]);
1663 if (LocaleCompare(
"hough-lines",option+1) == 0)
1668 (void) SyncImageSettings(mogrify_info,*image,exception);
1669 flags=ParseGeometry(argv[i+1],&geometry_info);
1670 if ((flags & SigmaValue) == 0)
1671 geometry_info.sigma=geometry_info.rho;
1672 if ((flags & XiValue) == 0)
1673 geometry_info.xi=40;
1674 mogrify_image=HoughLineImage(*image,(
size_t) geometry_info.rho,
1675 (
size_t) geometry_info.sigma,(
size_t) geometry_info.xi,exception);
1682 if (LocaleCompare(
"identify",option+1) == 0)
1687 (void) SyncImageSettings(mogrify_info,*image,exception);
1688 if (format == (
char *) NULL)
1690 (void) IdentifyImage(*image,stdout,mogrify_info->verbose,
1694 text=InterpretImageProperties(mogrify_info,*image,format,exception);
1695 if (text == (
char *) NULL)
1697 (void) fputs(text,stdout);
1698 text=DestroyString(text);
1701 if (LocaleCompare(
"illuminant",option+1) == 0)
1703 (void) SetImageArtifact(*image,
"color:illuminant",argv[i+1]);
1706 if (LocaleCompare(
"implode",option+1) == 0)
1711 (void) SyncImageSettings(mogrify_info,*image,exception);
1712 (void) ParseGeometry(argv[i+1],&geometry_info);
1713 mogrify_image=ImplodeImage(*image,geometry_info.rho,
1714 interpolate_method,exception);
1717 if (LocaleCompare(
"integral",option+1) == 0)
1719 (void) SyncImageSettings(mogrify_info,*image,exception);
1720 mogrify_image=IntegralImage(*image,exception);
1723 if (LocaleCompare(
"interline-spacing",option+1) == 0)
1726 (void) ParseGeometry(
"0",&geometry_info);
1728 (
void) ParseGeometry(argv[i+1],&geometry_info);
1729 draw_info->interline_spacing=geometry_info.rho;
1732 if (LocaleCompare(
"interpolate",option+1) == 0)
1734 interpolate_method=(PixelInterpolateMethod) ParseCommandOption(
1735 MagickInterpolateOptions,MagickFalse,argv[i+1]);
1738 if (LocaleCompare(
"interword-spacing",option+1) == 0)
1741 (void) ParseGeometry(
"0",&geometry_info);
1743 (
void) ParseGeometry(argv[i+1],&geometry_info);
1744 draw_info->interword_spacing=geometry_info.rho;
1747 if (LocaleCompare(
"interpolative-resize",option+1) == 0)
1752 (void) SyncImageSettings(mogrify_info,*image,exception);
1753 (void) ParseRegionGeometry(*image,argv[i+1],&geometry,exception);
1754 mogrify_image=InterpolativeResizeImage(*image,geometry.width,
1755 geometry.height,interpolate_method,exception);
1762 if (LocaleCompare(
"kerning",option+1) == 0)
1765 (void) ParseGeometry(
"0",&geometry_info);
1767 (
void) ParseGeometry(argv[i+1],&geometry_info);
1768 draw_info->kerning=geometry_info.rho;
1771 if (LocaleCompare(
"kmeans",option+1) == 0)
1776 (void) SyncImageSettings(mogrify_info,*image,exception);
1777 flags=ParseGeometry(argv[i+1],&geometry_info);
1778 if ((flags & SigmaValue) == 0)
1779 geometry_info.sigma=300.0;
1780 if ((flags & XiValue) == 0)
1781 geometry_info.xi=0.0001;
1782 (void) KmeansImage(*image,(
size_t) geometry_info.rho,
1783 (
size_t) geometry_info.sigma,geometry_info.xi,exception);
1786 if (LocaleCompare(
"kuwahara",option+1) == 0)
1791 (void) SyncImageSettings(mogrify_info,*image,exception);
1792 flags=ParseGeometry(argv[i+1],&geometry_info);
1793 if ((flags & SigmaValue) == 0)
1794 geometry_info.sigma=geometry_info.rho-0.5;
1795 mogrify_image=KuwaharaImage(*image,geometry_info.rho,
1796 geometry_info.sigma,exception);
1803 if (LocaleCompare(
"lat",option+1) == 0)
1808 (void) SyncImageSettings(mogrify_info,*image,exception);
1809 flags=ParseGeometry(argv[i+1],&geometry_info);
1810 if ((flags & PercentValue) != 0)
1811 geometry_info.xi=(double) QuantumRange*geometry_info.xi/100.0;
1812 mogrify_image=AdaptiveThresholdImage(*image,(
size_t)
1813 geometry_info.rho,(
size_t) geometry_info.sigma,(
double)
1814 geometry_info.xi,exception);
1817 if (LocaleCompare(
"level",option+1) == 0)
1827 (void) SyncImageSettings(mogrify_info,*image,exception);
1828 flags=ParseGeometry(argv[i+1],&geometry_info);
1829 black_point=geometry_info.rho;
1830 white_point=(double) QuantumRange;
1831 if ((flags & SigmaValue) != 0)
1832 white_point=geometry_info.sigma;
1834 if ((flags & XiValue) != 0)
1835 gamma=geometry_info.xi;
1836 if ((flags & PercentValue) != 0)
1838 black_point*=(double) QuantumRange/100.0;
1839 white_point*=(double) QuantumRange/100.0;
1841 if ((flags & SigmaValue) == 0)
1842 white_point=(double) QuantumRange-black_point;
1843 if ((*option ==
'+') || ((flags & AspectValue) != 0))
1844 (void) LevelizeImage(*image,black_point,white_point,gamma,
1847 (
void) LevelImage(*image,black_point,white_point,gamma,exception);
1850 if (LocaleCompare(
"level-colors",option+1) == 0)
1853 token[MagickPathExtent];
1862 p=(
const char *) argv[i+1];
1863 (void) GetNextToken(p,&p,MagickPathExtent,token);
1864 if ((isalpha((
int) ((
unsigned char) *token)) != 0) || ((*token ==
'#') != 0))
1865 (void) QueryColorCompliance(token,AllCompliance,&black_point,
1868 (
void) QueryColorCompliance(
"#000000",AllCompliance,&black_point,
1870 if (isalpha((
int) ((
unsigned char) *token)) || (*token ==
'#'))
1871 (void) GetNextToken(p,&p,MagickPathExtent,token);
1873 white_point=black_point;
1876 if ((isalpha((
int) ((
unsigned char) *token)) == 0) && ((*token ==
'#') == 0))
1877 (void) GetNextToken(p,&p,MagickPathExtent,token);
1878 if ((isalpha((
int) ((
unsigned char) *token)) != 0) || ((*token ==
'#') != 0))
1879 (void) QueryColorCompliance(token,AllCompliance,&white_point,
1882 (
void) QueryColorCompliance(
"#ffffff",AllCompliance,
1883 &white_point,exception);
1885 (void) LevelImageColors(*image,&black_point,&white_point,
1886 *option ==
'+' ? MagickTrue : MagickFalse,exception);
1889 if (LocaleCompare(
"linear-stretch",option+1) == 0)
1895 (void) SyncImageSettings(mogrify_info,*image,exception);
1896 flags=ParseGeometry(argv[i+1],&geometry_info);
1897 black_point=geometry_info.rho;
1898 white_point=(double) (*image)->columns*(*image)->rows;
1899 if ((flags & SigmaValue) != 0)
1900 white_point=geometry_info.sigma;
1901 if ((flags & PercentValue) != 0)
1903 black_point*=(double) (*image)->columns*(*image)->rows/100.0;
1904 white_point*=(double) (*image)->columns*(*image)->rows/100.0;
1906 if ((flags & SigmaValue) == 0)
1907 white_point=(double) (*image)->columns*(*image)->rows-
1909 (void) LinearStretchImage(*image,black_point,white_point,exception);
1912 if (LocaleCompare(
"liquid-rescale",option+1) == 0)
1917 (void) SyncImageSettings(mogrify_info,*image,exception);
1918 flags=ParseRegionGeometry(*image,argv[i+1],&geometry,exception);
1919 if ((flags & XValue) == 0)
1921 if ((flags & YValue) == 0)
1923 mogrify_image=LiquidRescaleImage(*image,geometry.width,
1924 geometry.height,1.0*geometry.x,1.0*geometry.y,exception);
1927 if (LocaleCompare(
"local-contrast",option+1) == 0)
1929 (void) SyncImageSettings(mogrify_info,*image,exception);
1930 flags=ParseGeometry(argv[i+1],&geometry_info);
1931 if ((flags & RhoValue) == 0)
1932 geometry_info.rho=10;
1933 if ((flags & SigmaValue) == 0)
1934 geometry_info.sigma=12.5;
1935 mogrify_image=LocalContrastImage(*image,geometry_info.rho,
1936 geometry_info.sigma,exception);
1939 if (LocaleCompare(
"lowlight-color",option+1) == 0)
1941 (void) SetImageArtifact(*image,
"compare:lowlight-color",argv[i+1]);
1948 if (LocaleCompare(
"magnify",option+1) == 0)
1953 (void) SyncImageSettings(mogrify_info,*image,exception);
1954 mogrify_image=MagnifyImage(*image,exception);
1957 if (LocaleCompare(
"map",option+1) == 0)
1965 (void) SyncImageSettings(mogrify_info,*image,exception);
1968 remap_image=GetImageCache(mogrify_info,argv[i+1],exception);
1969 if (remap_image == (Image *) NULL)
1971 (void) RemapImage(quantize_info,*image,remap_image,exception);
1972 remap_image=DestroyImage(remap_image);
1975 if (LocaleCompare(
"mask",option+1) == 0)
1980 (void) SyncImageSettings(mogrify_info,*image,exception);
1986 (void) SetImageMask(*image,WritePixelMask,(
const Image *) NULL,
1993 mask=GetImageCache(mogrify_info,argv[i+1],exception);
1994 if (mask == (Image *) NULL)
1996 (void) SetImageMask(*image,WritePixelMask,mask,exception);
1997 mask=DestroyImage(mask);
2000 if (LocaleCompare(
"matte",option+1) == 0)
2002 (void) SetImageAlphaChannel(*image,(*option ==
'-') ?
2003 SetAlphaChannel : DeactivateAlphaChannel,exception);
2006 if (LocaleCompare(
"mean-shift",option+1) == 0)
2011 (void) SyncImageSettings(mogrify_info,*image,exception);
2012 flags=ParseGeometry(argv[i+1],&geometry_info);
2013 if ((flags & SigmaValue) == 0)
2014 geometry_info.sigma=geometry_info.rho;
2015 if ((flags & XiValue) == 0)
2016 geometry_info.xi=0.10*(double) QuantumRange;
2017 if ((flags & PercentValue) != 0)
2018 geometry_info.xi=(double) QuantumRange*geometry_info.xi/100.0;
2019 mogrify_image=MeanShiftImage(*image,(
size_t) geometry_info.rho,
2020 (
size_t) geometry_info.sigma,geometry_info.xi,exception);
2023 if (LocaleCompare(
"median",option+1) == 0)
2028 (void) SyncImageSettings(mogrify_info,*image,exception);
2029 flags=ParseGeometry(argv[i+1],&geometry_info);
2030 if ((flags & SigmaValue) == 0)
2031 geometry_info.sigma=geometry_info.rho;
2032 mogrify_image=StatisticImage(*image,MedianStatistic,(
size_t)
2033 geometry_info.rho,(
size_t) geometry_info.sigma,exception);
2036 if (LocaleCompare(
"mode",option+1) == 0)
2041 (void) SyncImageSettings(mogrify_info,*image,exception);
2042 flags=ParseGeometry(argv[i+1],&geometry_info);
2043 if ((flags & SigmaValue) == 0)
2044 geometry_info.sigma=geometry_info.rho;
2045 mogrify_image=StatisticImage(*image,ModeStatistic,(
size_t)
2046 geometry_info.rho,(
size_t) geometry_info.sigma,exception);
2049 if (LocaleCompare(
"modulate",option+1) == 0)
2051 (void) SyncImageSettings(mogrify_info,*image,exception);
2052 (void) ModulateImage(*image,argv[i+1],exception);
2055 if (LocaleCompare(
"moments",option+1) == 0)
2059 (void) DeleteImageArtifact(*image,
"identify:moments");
2062 (void) SetImageArtifact(*image,
"identify:moments",argv[i+1]);
2063 (void) SetImageArtifact(*image,
"verbose",
"true");
2066 if (LocaleCompare(
"monitor",option+1) == 0)
2070 (void) SetImageProgressMonitor(*image,
2071 (MagickProgressMonitor) NULL,(
void *) NULL);
2074 (void) SetImageProgressMonitor(*image,MonitorProgress,
2078 if (LocaleCompare(
"monochrome",option+1) == 0)
2080 (void) SyncImageSettings(mogrify_info,*image,exception);
2081 (void) SetImageType(*image,BilevelType,exception);
2084 if (LocaleCompare(
"morphology",option+1) == 0)
2087 token[MagickPathExtent];
2104 (void) SyncImageSettings(mogrify_info,*image,exception);
2106 (void) GetNextToken(p,&p,MagickPathExtent,token);
2107 method=(MorphologyMethod) ParseCommandOption(
2108 MagickMorphologyOptions,MagickFalse,token);
2110 (void) GetNextToken(p,&p,MagickPathExtent,token);
2111 if ((*p ==
':') || (*p ==
','))
2112 (void) GetNextToken(p,&p,MagickPathExtent,token);
2114 iterations=(ssize_t) StringToLong(p);
2115 kernel=AcquireKernelInfo(argv[i+2],exception);
2116 if (kernel == (KernelInfo *) NULL)
2118 (void) ThrowMagickException(exception,GetMagickModule(),
2119 OptionError,
"UnabletoParseKernel",
"morphology");
2123 mogrify_image=MorphologyImage(*image,method,iterations,kernel,
2125 kernel=DestroyKernelInfo(kernel);
2128 if (LocaleCompare(
"motion-blur",option+1) == 0)
2133 (void) SyncImageSettings(mogrify_info,*image,exception);
2134 flags=ParseGeometry(argv[i+1],&geometry_info);
2135 if ((flags & SigmaValue) == 0)
2136 geometry_info.sigma=1.0;
2137 mogrify_image=MotionBlurImage(*image,geometry_info.rho,
2138 geometry_info.sigma,geometry_info.xi,exception);
2145 if (LocaleCompare(
"negate",option+1) == 0)
2147 (void) SyncImageSettings(mogrify_info,*image,exception);
2148 (void) NegateImage(*image,*option ==
'+' ? MagickTrue :
2149 MagickFalse,exception);
2152 if (LocaleCompare(
"noise",option+1) == 0)
2154 (void) SyncImageSettings(mogrify_info,*image,exception);
2157 flags=ParseGeometry(argv[i+1],&geometry_info);
2158 if ((flags & SigmaValue) == 0)
2159 geometry_info.sigma=geometry_info.rho;
2160 mogrify_image=StatisticImage(*image,NonpeakStatistic,(
size_t)
2161 geometry_info.rho,(
size_t) geometry_info.sigma,exception);
2168 noise=(NoiseType) ParseCommandOption(MagickNoiseOptions,
2169 MagickFalse,argv[i+1]);
2170 mogrify_image=AddNoiseImage(*image,noise,attenuate,exception);
2174 if (LocaleCompare(
"normalize",option+1) == 0)
2176 (void) SyncImageSettings(mogrify_info,*image,exception);
2177 (void) NormalizeImage(*image,exception);
2184 if (LocaleCompare(
"opaque",option+1) == 0)
2189 (void) SyncImageSettings(mogrify_info,*image,exception);
2190 (void) QueryColorCompliance(argv[i+1],AllCompliance,&target,
2192 (void) OpaquePaintImage(*image,&target,&fill,*option ==
'-' ?
2193 MagickFalse : MagickTrue,exception);
2196 if (LocaleCompare(
"ordered-dither",option+1) == 0)
2198 (void) SyncImageSettings(mogrify_info,*image,exception);
2199 (void) OrderedDitherImage(*image,argv[i+1],exception);
2206 if (LocaleCompare(
"paint",option+1) == 0)
2208 (void) SyncImageSettings(mogrify_info,*image,exception);
2209 (void) ParseGeometry(argv[i+1],&geometry_info);
2210 mogrify_image=OilPaintImage(*image,geometry_info.rho,
2211 geometry_info.sigma,exception);
2214 if (LocaleCompare(
"perceptible",option+1) == 0)
2219 (void) SyncImageSettings(mogrify_info,*image,exception);
2220 (void) PerceptibleImage(*image,StringToDouble(argv[i+1],
2221 (
char **) NULL),exception);
2224 if (LocaleCompare(
"pointsize",option+1) == 0)
2227 (void) ParseGeometry(
"12",&geometry_info);
2229 (
void) ParseGeometry(argv[i+1],&geometry_info);
2230 draw_info->pointsize=geometry_info.rho;
2233 if (LocaleCompare(
"polaroid",option+1) == 0)
2247 (void) SyncImageSettings(mogrify_info,*image,exception);
2248 random_info=AcquireRandomInfo();
2249 angle=22.5*(GetPseudoRandomValue(random_info)-0.5);
2250 random_info=DestroyRandomInfo(random_info);
2253 SetGeometryInfo(&geometry_info);
2254 flags=ParseGeometry(argv[i+1],&geometry_info);
2255 angle=geometry_info.rho;
2257 caption=GetImageProperty(*image,
"caption",exception);
2258 mogrify_image=PolaroidImage(*image,draw_info,caption,angle,
2259 interpolate_method,exception);
2262 if (LocaleCompare(
"posterize",option+1) == 0)
2267 (void) SyncImageSettings(mogrify_info,*image,exception);
2268 (void) PosterizeImage(*image,StringToUnsignedLong(argv[i+1]),
2269 quantize_info->dither_method,exception);
2272 if (LocaleCompare(
"preview",option+1) == 0)
2280 (void) SyncImageSettings(mogrify_info,*image,exception);
2282 preview_type=UndefinedPreview;
2284 preview_type=(PreviewType) ParseCommandOption(
2285 MagickPreviewOptions,MagickFalse,argv[i+1]);
2286 mogrify_image=PreviewImage(*image,preview_type,exception);
2289 if (LocaleCompare(
"profile",option+1) == 0)
2306 (void) SyncImageSettings(mogrify_info,*image,exception);
2312 (void) ProfileImage(*image,argv[i+1],(
const unsigned char *)
2319 profile_info=CloneImageInfo(mogrify_info);
2320 profile=GetImageProfile(*image,
"iptc");
2321 if (profile != (StringInfo *) NULL)
2322 profile_info->profile=(
void *) CloneStringInfo(profile);
2323 sans_exception=AcquireExceptionInfo();
2324 profile_image=GetImageCache(profile_info,argv[i+1],sans_exception);
2325 sans_exception=DestroyExceptionInfo(sans_exception);
2326 profile_info=DestroyImageInfo(profile_info);
2327 if (profile_image == (Image *) NULL)
2332 profile_info=CloneImageInfo(mogrify_info);
2333 (void) CopyMagickString(profile_info->filename,argv[i+1],
2335 file_data=FileToStringInfo(profile_info->filename,~0UL,
2337 if (file_data != (StringInfo *) NULL)
2339 (void) SetImageInfo(profile_info,0,exception);
2340 (void) ProfileImage(*image,profile_info->magick,
2341 GetStringInfoDatum(file_data),
2342 GetStringInfoLength(file_data),exception);
2343 file_data=DestroyStringInfo(file_data);
2345 profile_info=DestroyImageInfo(profile_info);
2348 ResetImageProfileIterator(profile_image);
2349 name=GetNextImageProfile(profile_image);
2350 while (name != (
const char *) NULL)
2352 profile=GetImageProfile(profile_image,name);
2353 if (profile != (StringInfo *) NULL)
2354 (void) ProfileImage(*image,name,GetStringInfoDatum(profile),
2355 (
size_t) GetStringInfoLength(profile),exception);
2356 name=GetNextImageProfile(profile_image);
2358 profile_image=DestroyImage(profile_image);
2365 if (LocaleCompare(
"quantize",option+1) == 0)
2369 quantize_info->colorspace=UndefinedColorspace;
2372 quantize_info->colorspace=(ColorspaceType) ParseCommandOption(
2373 MagickColorspaceOptions,MagickFalse,argv[i+1]);
2380 if (LocaleCompare(
"rotational-blur",option+1) == 0)
2385 (void) SyncImageSettings(mogrify_info,*image,exception);
2386 flags=ParseGeometry(argv[i+1],&geometry_info);
2387 mogrify_image=RotationalBlurImage(*image,geometry_info.rho,
2391 if (LocaleCompare(
"raise",option+1) == 0)
2396 flags=ParsePageGeometry(*image,argv[i+1],&geometry,exception);
2397 (void) RaiseImage(*image,&geometry,*option ==
'-' ? MagickTrue :
2398 MagickFalse,exception);
2401 if (LocaleCompare(
"random-threshold",option+1) == 0)
2410 (void) SyncImageSettings(mogrify_info,*image,exception);
2412 max_threshold=(double) QuantumRange;
2413 flags=ParseGeometry(argv[i+1],&geometry_info);
2414 min_threshold=geometry_info.rho;
2415 max_threshold=geometry_info.sigma;
2416 if ((flags & SigmaValue) == 0)
2417 max_threshold=min_threshold;
2418 if (strchr(argv[i+1],
'%') != (
char *) NULL)
2420 max_threshold*=0.01*(double) QuantumRange;
2421 min_threshold*=0.01*(double) QuantumRange;
2423 (void) RandomThresholdImage(*image,min_threshold,max_threshold,
2427 if (LocaleCompare(
"range-threshold",option+1) == 0)
2432 (void) SyncImageSettings(mogrify_info,*image,exception);
2433 flags=ParseGeometry(argv[i+1],&geometry_info);
2434 if ((flags & SigmaValue) == 0)
2435 geometry_info.sigma=geometry_info.rho;
2436 if ((flags & XiValue) == 0)
2437 geometry_info.xi=geometry_info.sigma;
2438 if ((flags & PsiValue) == 0)
2439 geometry_info.psi=geometry_info.xi;
2440 if (strchr(argv[i+1],
'%') != (
char *) NULL)
2442 geometry_info.rho*=0.01*(double) QuantumRange;
2443 geometry_info.sigma*=0.01*(double) QuantumRange;
2444 geometry_info.xi*=0.01*(double) QuantumRange;
2445 geometry_info.psi*=0.01*(double) QuantumRange;
2447 (void) RangeThresholdImage(*image,geometry_info.rho,
2448 geometry_info.sigma,geometry_info.xi,geometry_info.psi,exception);
2451 if (LocaleCompare(
"read-mask",option+1) == 0)
2456 (void) SyncImageSettings(mogrify_info,*image,exception);
2462 (void) SetImageMask(*image,ReadPixelMask,(
const Image *) NULL,
2469 mask=GetImageCache(mogrify_info,argv[i+1],exception);
2470 if (mask == (Image *) NULL)
2472 (void) SetImageMask(*image,ReadPixelMask,mask,exception);
2473 mask=DestroyImage(mask);
2476 if (LocaleCompare(
"region",option+1) == 0)
2481 (void) SyncImageSettings(mogrify_info,*image,exception);
2484 (void) SetImageRegionMask(*image,WritePixelMask,
2485 (
const RectangleInfo *) NULL,exception);
2488 (void) ParseGravityGeometry(*image,argv[i+1],&geometry,exception);
2489 (void) SetImageRegionMask(*image,WritePixelMask,&geometry,
2493 if (LocaleCompare(
"render",option+1) == 0)
2495 (void) SyncImageSettings(mogrify_info,*image,exception);
2496 draw_info->render=(*option ==
'+') ? MagickTrue : MagickFalse;
2499 if (LocaleCompare(
"remap",option+1) == 0)
2507 (void) SyncImageSettings(mogrify_info,*image,exception);
2510 remap_image=GetImageCache(mogrify_info,argv[i+1],exception);
2511 if (remap_image == (Image *) NULL)
2513 (void) RemapImage(quantize_info,*image,remap_image,exception);
2514 remap_image=DestroyImage(remap_image);
2517 if (LocaleCompare(
"repage",option+1) == 0)
2521 (void) ParseAbsoluteGeometry(
"0x0+0+0",&(*image)->page);
2524 (void) ResetImagePage(*image,argv[i+1]);
2527 if (LocaleCompare(
"resample",option+1) == 0)
2532 (void) SyncImageSettings(mogrify_info,*image,exception);
2533 flags=ParseGeometry(argv[i+1],&geometry_info);
2534 if ((flags & SigmaValue) == 0)
2535 geometry_info.sigma=geometry_info.rho;
2536 mogrify_image=ResampleImage(*image,geometry_info.rho,
2537 geometry_info.sigma,(*image)->filter,exception);
2540 if (LocaleCompare(
"reshape",option+1) == 0)
2545 (void) SyncImageSettings(mogrify_info,*image,exception);
2546 (void) ParseRegionGeometry(*image,argv[i+1],&geometry,exception);
2547 (void) ReshapePixelCache(*image,geometry.width,geometry.height,
2551 if (LocaleCompare(
"resize",option+1) == 0)
2556 (void) SyncImageSettings(mogrify_info,*image,exception);
2557 (void) ParseRegionGeometry(*image,argv[i+1],&geometry,exception);
2558 mogrify_image=ResizeImage(*image,geometry.width,geometry.height,
2559 (*image)->filter,exception);
2562 if (LocaleCompare(
"roll",option+1) == 0)
2567 (void) SyncImageSettings(mogrify_info,*image,exception);
2568 flags=ParsePageGeometry(*image,argv[i+1],&geometry,exception);
2569 if ((flags & PercentValue) != 0)
2571 geometry.x*=(double) (*image)->columns/100.0;
2572 geometry.y*=(double) (*image)->rows/100.0;
2574 mogrify_image=RollImage(*image,geometry.x,geometry.y,exception);
2577 if (LocaleCompare(
"rotate",option+1) == 0)
2585 (void) SyncImageSettings(mogrify_info,*image,exception);
2586 if (strchr(argv[i+1],
'>') != (
char *) NULL)
2587 if ((*image)->columns <= (*image)->rows)
2589 if (strchr(argv[i+1],
'<') != (
char *) NULL)
2590 if ((*image)->columns >= (*image)->rows)
2595 rotation=ConstantString(argv[i+1]);
2596 (void) SubstituteString(&rotation,
">",
"");
2597 (void) SubstituteString(&rotation,
"<",
"");
2598 (void) ParseGeometry(rotation,&geometry_info);
2599 rotation=DestroyString(rotation);
2600 mogrify_image=RotateImage(*image,geometry_info.rho,exception);
2607 if (LocaleCompare(
"sample",option+1) == 0)
2612 (void) SyncImageSettings(mogrify_info,*image,exception);
2613 (void) ParseRegionGeometry(*image,argv[i+1],&geometry,exception);
2614 mogrify_image=SampleImage(*image,geometry.width,geometry.height,
2618 if (LocaleCompare(
"scale",option+1) == 0)
2623 (void) SyncImageSettings(mogrify_info,*image,exception);
2624 (void) ParseRegionGeometry(*image,argv[i+1],&geometry,exception);
2625 mogrify_image=ScaleImage(*image,geometry.width,geometry.height,
2629 if (LocaleCompare(
"selective-blur",option+1) == 0)
2634 (void) SyncImageSettings(mogrify_info,*image,exception);
2635 flags=ParseGeometry(argv[i+1],&geometry_info);
2636 if ((flags & PercentValue) != 0)
2637 geometry_info.xi=(double) QuantumRange*geometry_info.xi/100.0;
2638 mogrify_image=SelectiveBlurImage(*image,geometry_info.rho,
2639 geometry_info.sigma,geometry_info.xi,exception);
2642 if (LocaleCompare(
"separate",option+1) == 0)
2647 (void) SyncImageSettings(mogrify_info,*image,exception);
2648 mogrify_image=SeparateImages(*image,exception);
2651 if (LocaleCompare(
"sepia-tone",option+1) == 0)
2659 (void) SyncImageSettings(mogrify_info,*image,exception);
2660 threshold=StringToDoubleInterval(argv[i+1],(
double) QuantumRange+
2662 mogrify_image=SepiaToneImage(*image,threshold,exception);
2665 if (LocaleCompare(
"segment",option+1) == 0)
2670 (void) SyncImageSettings(mogrify_info,*image,exception);
2671 flags=ParseGeometry(argv[i+1],&geometry_info);
2672 if ((flags & SigmaValue) == 0)
2673 geometry_info.sigma=1.0;
2674 (void) SegmentImage(*image,(*image)->colorspace,
2675 mogrify_info->verbose,geometry_info.rho,geometry_info.sigma,
2679 if (LocaleCompare(
"set",option+1) == 0)
2689 if (LocaleNCompare(argv[i+1],
"registry:",9) == 0)
2690 (void) DeleteImageRegistry(argv[i+1]+9);
2692 if (LocaleNCompare(argv[i+1],
"option:",7) == 0)
2694 (void) DeleteImageOption(mogrify_info,argv[i+1]+7);
2695 (void) DeleteImageArtifact(*image,argv[i+1]+7);
2698 (
void) DeleteImageProperty(*image,argv[i+1]);
2701 value=InterpretImageProperties(mogrify_info,*image,argv[i+2],
2703 if (value == (
char *) NULL)
2705 if (LocaleNCompare(argv[i+1],
"registry:",9) == 0)
2706 (void) SetImageRegistry(StringRegistryType,argv[i+1]+9,value,
2709 if (LocaleNCompare(argv[i+1],
"option:",7) == 0)
2711 (void) SetImageOption(image_info,argv[i+1]+7,value);
2712 (void) SetImageOption(mogrify_info,argv[i+1]+7,value);
2713 (void) SetImageArtifact(*image,argv[i+1]+7,value);
2716 if (LocaleCompare(argv[i+1],
"profile") == 0)
2719 *profile = (StringInfo *) NULL;
2721 (void) CopyMagickString(image_info->filename,value,
2723 (void) SetImageInfo(image_info,1,exception);
2724 if (LocaleCompare(image_info->filename,
"-") != 0)
2725 profile=FileToStringInfo(image_info->filename,~0UL,
2727 if (profile != (StringInfo *) NULL)
2729 SetStringInfoName(profile,image_info->magick);
2730 status=SetImageProfilePrivate(*image,profile,exception);
2734 (
void) SetImageProperty(*image,argv[i+1],value,exception);
2735 value=DestroyString(value);
2738 if (LocaleCompare(
"shade",option+1) == 0)
2743 (void) SyncImageSettings(mogrify_info,*image,exception);
2744 flags=ParseGeometry(argv[i+1],&geometry_info);
2745 if ((flags & SigmaValue) == 0)
2746 geometry_info.sigma=1.0;
2747 mogrify_image=ShadeImage(*image,(*option ==
'-') ? MagickTrue :
2748 MagickFalse,geometry_info.rho,geometry_info.sigma,exception);
2751 if (LocaleCompare(
"shadow",option+1) == 0)
2756 (void) SyncImageSettings(mogrify_info,*image,exception);
2757 flags=ParseGeometry(argv[i+1],&geometry_info);
2758 if ((flags & SigmaValue) == 0)
2759 geometry_info.sigma=1.0;
2760 if ((flags & XiValue) == 0)
2761 geometry_info.xi=4.0;
2762 if ((flags & PsiValue) == 0)
2763 geometry_info.psi=4.0;
2764 mogrify_image=ShadowImage(*image,geometry_info.rho,
2765 geometry_info.sigma,(ssize_t) ceil(geometry_info.xi-0.5),
2766 (ssize_t) ceil(geometry_info.psi-0.5),exception);
2769 if (LocaleCompare(
"sharpen",option+1) == 0)
2774 (void) SyncImageSettings(mogrify_info,*image,exception);
2775 flags=ParseGeometry(argv[i+1],&geometry_info);
2776 if ((flags & SigmaValue) == 0)
2777 geometry_info.sigma=1.0;
2778 if ((flags & XiValue) == 0)
2779 geometry_info.xi=0.0;
2780 mogrify_image=SharpenImage(*image,geometry_info.rho,
2781 geometry_info.sigma,exception);
2784 if (LocaleCompare(
"shave",option+1) == 0)
2789 (void) SyncImageSettings(mogrify_info,*image,exception);
2790 flags=ParsePageGeometry(*image,argv[i+1],&geometry,exception);
2791 mogrify_image=ShaveImage(*image,&geometry,exception);
2794 if (LocaleCompare(
"shear",option+1) == 0)
2799 (void) SyncImageSettings(mogrify_info,*image,exception);
2800 flags=ParseGeometry(argv[i+1],&geometry_info);
2801 if ((flags & SigmaValue) == 0)
2802 geometry_info.sigma=geometry_info.rho;
2803 mogrify_image=ShearImage(*image,geometry_info.rho,
2804 geometry_info.sigma,exception);
2807 if (LocaleCompare(
"sigmoidal-contrast",option+1) == 0)
2812 (void) SyncImageSettings(mogrify_info,*image,exception);
2813 flags=ParseGeometry(argv[i+1],&geometry_info);
2814 if ((flags & SigmaValue) == 0)
2815 geometry_info.sigma=(double) QuantumRange/2.0;
2816 if ((flags & PercentValue) != 0)
2817 geometry_info.sigma=(double) QuantumRange*geometry_info.sigma/
2819 (void) SigmoidalContrastImage(*image,(*option ==
'-') ?
2820 MagickTrue : MagickFalse,geometry_info.rho,geometry_info.sigma,
2824 if (LocaleCompare(
"sketch",option+1) == 0)
2829 (void) SyncImageSettings(mogrify_info,*image,exception);
2830 flags=ParseGeometry(argv[i+1],&geometry_info);
2831 if ((flags & SigmaValue) == 0)
2832 geometry_info.sigma=1.0;
2833 mogrify_image=SketchImage(*image,geometry_info.rho,
2834 geometry_info.sigma,geometry_info.xi,exception);
2837 if (LocaleCompare(
"solarize",option+1) == 0)
2842 (void) SyncImageSettings(mogrify_info,*image,exception);
2843 threshold=StringToDoubleInterval(argv[i+1],(
double) QuantumRange+
2845 (void) SolarizeImage(*image,threshold,exception);
2848 if (LocaleCompare(
"sort-pixels",option+1) == 0)
2853 (void) SyncImageSettings(mogrify_info,*image,exception);
2854 (void) SortImagePixels(*image,exception);
2857 if (LocaleCompare(
"sparse-color",option+1) == 0)
2868 (void) SyncImageSettings(mogrify_info,*image,exception);
2869 method=(SparseColorMethod) ParseCommandOption(
2870 MagickSparseColorOptions,MagickFalse,argv[i+1]);
2871 arguments=InterpretImageProperties(mogrify_info,*image,argv[i+2],
2873 if (arguments == (
char *) NULL)
2875 mogrify_image=SparseColorOption(*image,method,arguments,
2876 option[0] ==
'+' ? MagickTrue : MagickFalse,exception);
2877 arguments=DestroyString(arguments);
2880 if (LocaleCompare(
"splice",option+1) == 0)
2885 (void) SyncImageSettings(mogrify_info,*image,exception);
2886 (void) ParseGravityGeometry(*image,argv[i+1],&geometry,exception);
2887 mogrify_image=SpliceImage(*image,&geometry,exception);
2890 if (LocaleCompare(
"spread",option+1) == 0)
2895 (void) SyncImageSettings(mogrify_info,*image,exception);
2896 (void) ParseGeometry(argv[i+1],&geometry_info);
2897 mogrify_image=SpreadImage(*image,interpolate_method,
2898 geometry_info.rho,exception);
2901 if (LocaleCompare(
"statistic",option+1) == 0)
2906 (void) SyncImageSettings(mogrify_info,*image,exception);
2907 type=(StatisticType) ParseCommandOption(MagickStatisticOptions,
2908 MagickFalse,argv[i+1]);
2909 (void) ParseGeometry(argv[i+2],&geometry_info);
2910 mogrify_image=StatisticImage(*image,type,(
size_t) geometry_info.rho,
2911 (
size_t) geometry_info.sigma,exception);
2914 if (LocaleCompare(
"stretch",option+1) == 0)
2918 draw_info->stretch=UndefinedStretch;
2921 draw_info->stretch=(StretchType) ParseCommandOption(
2922 MagickStretchOptions,MagickFalse,argv[i+1]);
2925 if (LocaleCompare(
"strip",option+1) == 0)
2930 (void) SyncImageSettings(mogrify_info,*image,exception);
2931 (void) StripImage(*image,exception);
2934 if (LocaleCompare(
"stroke",option+1) == 0)
2944 (void) QueryColorCompliance(
"none",AllCompliance,
2945 &draw_info->stroke,exception);
2946 if (draw_info->stroke_pattern != (Image *) NULL)
2947 draw_info->stroke_pattern=DestroyImage(
2948 draw_info->stroke_pattern);
2951 sans=AcquireExceptionInfo();
2952 status=QueryColorCompliance(argv[i+1],AllCompliance,&color,sans);
2953 sans=DestroyExceptionInfo(sans);
2954 if (status == MagickFalse)
2955 draw_info->stroke_pattern=GetImageCache(mogrify_info,argv[i+1],
2958 draw_info->stroke=color;
2961 if (LocaleCompare(
"strokewidth",option+1) == 0)
2963 draw_info->stroke_width=StringToDouble(argv[i+1],(
char **) NULL);
2966 if (LocaleCompare(
"style",option+1) == 0)
2970 draw_info->style=UndefinedStyle;
2973 draw_info->style=(StyleType) ParseCommandOption(MagickStyleOptions,
2974 MagickFalse,argv[i+1]);
2977 if (LocaleCompare(
"swirl",option+1) == 0)
2982 (void) SyncImageSettings(mogrify_info,*image,exception);
2983 (void) ParseGeometry(argv[i+1],&geometry_info);
2984 mogrify_image=SwirlImage(*image,geometry_info.rho,
2985 interpolate_method,exception);
2992 if (LocaleCompare(
"threshold",option+1) == 0)
3000 (void) SyncImageSettings(mogrify_info,*image,exception);
3002 threshold=(double) QuantumRange/2;
3004 threshold=StringToDoubleInterval(argv[i+1],(
double) QuantumRange+
3006 (void) BilevelImage(*image,threshold,exception);
3009 if (LocaleCompare(
"thumbnail",option+1) == 0)
3014 (void) SyncImageSettings(mogrify_info,*image,exception);
3015 (void) ParseRegionGeometry(*image,argv[i+1],&geometry,exception);
3016 mogrify_image=ThumbnailImage(*image,geometry.width,geometry.height,
3020 if (LocaleCompare(
"tile",option+1) == 0)
3024 if (draw_info->fill_pattern != (Image *) NULL)
3025 draw_info->fill_pattern=DestroyImage(draw_info->fill_pattern);
3028 draw_info->fill_pattern=GetImageCache(mogrify_info,argv[i+1],
3032 if (LocaleCompare(
"tint",option+1) == 0)
3037 (void) SyncImageSettings(mogrify_info,*image,exception);
3038 mogrify_image=TintImage(*image,argv[i+1],&fill,exception);
3041 if (LocaleCompare(
"transform",option+1) == 0)
3046 (void) SyncImageSettings(mogrify_info,*image,exception);
3047 mogrify_image=AffineTransformImage(*image,&draw_info->affine,
3051 if (LocaleCompare(
"transparent",option+1) == 0)
3056 (void) SyncImageSettings(mogrify_info,*image,exception);
3057 (void) QueryColorCompliance(argv[i+1],AllCompliance,&target,
3059 (void) TransparentPaintImage(*image,&target,(Quantum)
3060 TransparentAlpha,*option ==
'-' ? MagickFalse : MagickTrue,
3064 if (LocaleCompare(
"transpose",option+1) == 0)
3069 (void) SyncImageSettings(mogrify_info,*image,exception);
3070 mogrify_image=TransposeImage(*image,exception);
3073 if (LocaleCompare(
"transverse",option+1) == 0)
3078 (void) SyncImageSettings(mogrify_info,*image,exception);
3079 mogrify_image=TransverseImage(*image,exception);
3082 if (LocaleCompare(
"treedepth",option+1) == 0)
3084 quantize_info->tree_depth=StringToUnsignedLong(argv[i+1]);
3087 if (LocaleCompare(
"trim",option+1) == 0)
3092 (void) SyncImageSettings(mogrify_info,*image,exception);
3093 mogrify_image=TrimImage(*image,exception);
3096 if (LocaleCompare(
"type",option+1) == 0)
3101 (void) SyncImageSettings(mogrify_info,*image,exception);
3105 type=(ImageType) ParseCommandOption(MagickTypeOptions,MagickFalse,
3107 (*image)->type=UndefinedType;
3108 (void) SetImageType(*image,type,exception);
3115 if (LocaleCompare(
"undercolor",option+1) == 0)
3117 (void) QueryColorCompliance(argv[i+1],AllCompliance,
3118 &draw_info->undercolor,exception);
3121 if (LocaleCompare(
"unique",option+1) == 0)
3125 (void) DeleteImageArtifact(*image,
"identify:unique-colors");
3128 (void) SetImageArtifact(*image,
"identify:unique-colors",
"true");
3129 (void) SetImageArtifact(*image,
"verbose",
"true");
3132 if (LocaleCompare(
"unique-colors",option+1) == 0)
3137 (void) SyncImageSettings(mogrify_info,*image,exception);
3138 mogrify_image=UniqueImageColors(*image,exception);
3141 if (LocaleCompare(
"unsharp",option+1) == 0)
3146 (void) SyncImageSettings(mogrify_info,*image,exception);
3147 flags=ParseGeometry(argv[i+1],&geometry_info);
3148 if ((flags & SigmaValue) == 0)
3149 geometry_info.sigma=1.0;
3150 if ((flags & XiValue) == 0)
3151 geometry_info.xi=1.0;
3152 if ((flags & PsiValue) == 0)
3153 geometry_info.psi=0.05;
3154 mogrify_image=UnsharpMaskImage(*image,geometry_info.rho,
3155 geometry_info.sigma,geometry_info.xi,geometry_info.psi,
3163 if (LocaleCompare(
"verbose",option+1) == 0)
3165 (void) SetImageArtifact(*image,option+1,
3166 *option ==
'+' ?
"false" :
"true");
3169 if (LocaleCompare(
"vignette",option+1) == 0)
3174 (void) SyncImageSettings(mogrify_info,*image,exception);
3175 flags=ParseGeometry(argv[i+1],&geometry_info);
3176 if ((flags & SigmaValue) == 0)
3177 geometry_info.sigma=1.0;
3178 if ((flags & XiValue) == 0)
3179 geometry_info.xi=0.1*(*image)->columns;
3180 if ((flags & PsiValue) == 0)
3181 geometry_info.psi=0.1*(*image)->rows;
3182 if ((flags & PercentValue) != 0)
3184 geometry_info.xi*=(double) (*image)->columns/100.0;
3185 geometry_info.psi*=(double) (*image)->rows/100.0;
3187 mogrify_image=VignetteImage(*image,geometry_info.rho,
3188 geometry_info.sigma,(ssize_t) ceil(geometry_info.xi-0.5),
3189 (ssize_t) ceil(geometry_info.psi-0.5),exception);
3192 if (LocaleCompare(
"virtual-pixel",option+1) == 0)
3196 (void) SetImageVirtualPixelMethod(*image,
3197 UndefinedVirtualPixelMethod,exception);
3200 (void) SetImageVirtualPixelMethod(*image,(VirtualPixelMethod)
3201 ParseCommandOption(MagickVirtualPixelOptions,MagickFalse,
3202 argv[i+1]),exception);
3209 if (LocaleCompare(
"wave",option+1) == 0)
3214 (void) SyncImageSettings(mogrify_info,*image,exception);
3215 flags=ParseGeometry(argv[i+1],&geometry_info);
3216 if ((flags & SigmaValue) == 0)
3217 geometry_info.sigma=1.0;
3218 mogrify_image=WaveImage(*image,geometry_info.rho,
3219 geometry_info.sigma,interpolate_method,exception);
3222 if (LocaleCompare(
"wavelet-denoise",option+1) == 0)
3227 (void) SyncImageSettings(mogrify_info,*image,exception);
3228 flags=ParseGeometry(argv[i+1],&geometry_info);
3229 if ((flags & PercentValue) != 0)
3231 geometry_info.rho=(double) QuantumRange*geometry_info.rho/100.0;
3232 geometry_info.sigma=(double) QuantumRange*geometry_info.sigma/
3235 if ((flags & SigmaValue) == 0)
3236 geometry_info.sigma=0.0;
3237 mogrify_image=WaveletDenoiseImage(*image,geometry_info.rho,
3238 geometry_info.sigma,exception);
3241 if (LocaleCompare(
"weight",option+1) == 0)
3246 weight=ParseCommandOption(MagickWeightOptions,MagickFalse,
3249 weight=(ssize_t) StringToUnsignedLong(argv[i+1]);
3250 draw_info->weight=(size_t) weight;
3253 if (LocaleCompare(
"white-balance",option+1) == 0)
3258 (void) SyncImageSettings(mogrify_info,*image,exception);
3259 (void) WhiteBalanceImage(*image,exception);
3262 if (LocaleCompare(
"white-threshold",option+1) == 0)
3267 (void) SyncImageSettings(mogrify_info,*image,exception);
3268 (void) WhiteThresholdImage(*image,argv[i+1],exception);
3271 if (LocaleCompare(
"write-mask",option+1) == 0)
3276 (void) SyncImageSettings(mogrify_info,*image,exception);
3282 (void) SetImageMask(*image,WritePixelMask,(
const Image *) NULL,
3289 mask=GetImageCache(mogrify_info,argv[i+1],exception);
3290 if (mask == (Image *) NULL)
3292 (void) SetImageMask(*image,WritePixelMask,mask,exception);
3293 mask=DestroyImage(mask);
3296 if (LocaleCompare(
"word-break",option+1) == 0)
3298 (void) SetImageOption(image_info,option+1,argv[i+1]);
3309 if (mogrify_image != (Image *) NULL)
3310 ReplaceImageInListReturnLast(image,mogrify_image);
3316 quantize_info=DestroyQuantizeInfo(quantize_info);
3317 draw_info=DestroyDrawInfo(draw_info);
3318 mogrify_info=DestroyImageInfo(mogrify_info);
3319 status=(MagickStatusType) (exception->severity < ErrorException ? 1 : 0);
3320 return(status == 0 ? MagickFalse : MagickTrue);
3357static MagickBooleanType MogrifyUsage(
void)
3360 channel_operators[] =
3361 " -channel-fx expression\n"
3362 " exchange, extract, or transfer one or more image channels\n"
3363 " -separate separate an image channel into a grayscale image",
3365 " -debug events display copious debugging information\n"
3366 " -distribute-cache port\n"
3367 " distributed pixel cache spanning one or more servers\n"
3368 " -help print program options\n"
3369 " -list type print a list of supported option arguments\n"
3370 " -log format format of debugging information\n"
3371 " -version print version information",
3373 " -adaptive-blur geometry\n"
3374 " adaptively blur pixels; decrease effect near edges\n"
3375 " -adaptive-resize geometry\n"
3376 " adaptively resize image using 'mesh' interpolation\n"
3377 " -adaptive-sharpen geometry\n"
3378 " adaptively sharpen pixels; increase effect near edges\n"
3379 " -alpha option on, activate, off, deactivate, set, opaque, copy\n"
3380 " transparent, extract, background, or shape\n"
3381 " -annotate geometry text\n"
3382 " annotate the image with text\n"
3383 " -auto-gamma automagically adjust gamma level of image\n"
3384 " -auto-level automagically adjust color levels of image\n"
3385 " -auto-orient automagically orient (rotate) image\n"
3386 " -auto-threshold method\n"
3387 " automatically perform image thresholding\n"
3388 " -bench iterations measure performance\n"
3389 " -bilateral-blur geometry\n"
3390 " non-linear, edge-preserving, and noise-reducing smoothing filter\n"
3391 " -black-threshold value\n"
3392 " force all pixels below the threshold into black\n"
3393 " -blue-shift simulate a scene at nighttime in the moonlight\n"
3394 " -blur geometry reduce image noise and reduce detail levels\n"
3395 " -border geometry surround image with a border of color\n"
3396 " -bordercolor color border color\n"
3397 " -brightness-contrast geometry\n"
3398 " improve brightness / contrast of the image\n"
3399 " -canny geometry detect edges in the image\n"
3400 " -cdl filename color correct with a color decision list\n"
3401 " -channel mask set the image channel mask\n"
3402 " -charcoal geometry simulate a charcoal drawing\n"
3403 " -chop geometry remove pixels from the image interior\n"
3404 " -clahe geometry contrast limited adaptive histogram equalization\n"
3405 " -clamp keep pixel values in range (0-QuantumRange)\n"
3406 " -clip clip along the first path from the 8BIM profile\n"
3407 " -clip-mask filename associate a clip mask with the image\n"
3408 " -clip-path id clip along a named path from the 8BIM profile\n"
3409 " -colorize value colorize the image with the fill color\n"
3410 " -color-matrix matrix apply color correction to the image\n"
3411 " -colors value preferred number of colors in the image\n"
3412 " -color-threshold start_color-stop_color\n"
3413 " force all pixels in the color range to white otherwise black\n"
3414 " -connected-components connectivity\n"
3415 " connected-components uniquely labeled\n"
3416 " -contrast enhance or reduce the image contrast\n"
3417 " -contrast-stretch geometry\n"
3418 " improve contrast by 'stretching' the intensity range\n"
3419 " -convolve coefficients\n"
3420 " apply a convolution kernel to the image\n"
3421 " -cycle amount cycle the image colormap\n"
3422 " -decipher filename convert cipher pixels to plain pixels\n"
3423 " -deskew threshold straighten an image\n"
3424 " -despeckle reduce the speckles within an image\n"
3425 " -distort method args\n"
3426 " distort images according to given method ad args\n"
3427 " -draw string annotate the image with a graphic primitive\n"
3428 " -edge radius apply a filter to detect edges in the image\n"
3429 " -encipher filename convert plain pixels to cipher pixels\n"
3430 " -emboss radius emboss an image\n"
3431 " -enhance apply a digital filter to enhance a noisy image\n"
3432 " -equalize perform histogram equalization to an image\n"
3433 " -evaluate operator value\n"
3434 " evaluate an arithmetic, relational, or logical expression\n"
3435 " -extent geometry set the image size\n"
3436 " -extract geometry extract area from image\n"
3437 " -fft implements the discrete Fourier transform (DFT)\n"
3438 " -flip flip image vertically\n"
3439 " -floodfill geometry color\n"
3440 " floodfill the image with color\n"
3441 " -flop flop image horizontally\n"
3442 " -frame geometry surround image with an ornamental border\n"
3443 " -function name parameters\n"
3444 " apply function over image values\n"
3445 " -gamma value level of gamma correction\n"
3446 " -gaussian-blur geometry\n"
3447 " reduce image noise and reduce detail levels\n"
3448 " -geometry geometry preferred size or location of the image\n"
3449 " -grayscale method convert image to grayscale\n"
3450 " -hough-lines geometry\n"
3451 " identify lines in the image\n"
3452 " -identify identify the format and characteristics of the image\n"
3453 " -ift implements the inverse discrete Fourier transform (DFT)\n"
3454 " -implode amount implode image pixels about the center\n"
3455 " -integral calculate the sum of values (pixel values) in the image\n"
3456 " -interpolative-resize geometry\n"
3457 " resize image using interpolation\n"
3458 " -kmeans geometry K means color reduction\n"
3459 " -kuwahara geometry edge preserving noise reduction filter\n"
3460 " -lat geometry local adaptive thresholding\n"
3461 " -level value adjust the level of image contrast\n"
3462 " -level-colors color,color\n"
3463 " level image with the given colors\n"
3464 " -linear-stretch geometry\n"
3465 " improve contrast by 'stretching with saturation'\n"
3466 " -liquid-rescale geometry\n"
3467 " rescale image with seam-carving\n"
3468 " -local-contrast geometry\n"
3469 " enhance local contrast\n"
3470 " -magnify double the size of the image with pixel art scaling\n"
3471 " -mean-shift geometry delineate arbitrarily shaped clusters in the image\n"
3472 " -median geometry apply a median filter to the image\n"
3473 " -mode geometry make each pixel the 'predominant color' of the\n"
3475 " -modulate value vary the brightness, saturation, and hue\n"
3476 " -monochrome transform image to black and white\n"
3477 " -morphology method kernel\n"
3478 " apply a morphology method to the image\n"
3479 " -motion-blur geometry\n"
3480 " simulate motion blur\n"
3481 " -negate replace every pixel with its complementary color \n"
3482 " -noise geometry add or reduce noise in an image\n"
3483 " -normalize transform image to span the full range of colors\n"
3484 " -opaque color change this color to the fill color\n"
3485 " -ordered-dither NxN\n"
3486 " add a noise pattern to the image with specific\n"
3488 " -paint radius simulate an oil painting\n"
3489 " -perceptible epsilon\n"
3490 " pixel value less than |epsilon| become epsilon or\n"
3492 " -polaroid angle simulate a Polaroid picture\n"
3493 " -posterize levels reduce the image to a limited number of color levels\n"
3494 " -profile filename add, delete, or apply an image profile\n"
3495 " -quantize colorspace reduce colors in this colorspace\n"
3496 " -raise value lighten/darken image edges to create a 3-D effect\n"
3497 " -random-threshold low,high\n"
3498 " random threshold the image\n"
3499 " -range-threshold values\n"
3500 " perform either hard or soft thresholding within some range of values in an image\n"
3501 " -region geometry apply options to a portion of the image\n"
3502 " -render render vector graphics\n"
3503 " -repage geometry size and location of an image canvas\n"
3504 " -resample geometry change the resolution of an image\n"
3505 " -reshape geometry reshape the image\n"
3506 " -resize geometry resize the image\n"
3507 " -roll geometry roll an image vertically or horizontally\n"
3508 " -rotate degrees apply Paeth rotation to the image\n"
3509 " -rotational-blur angle\n"
3510 " rotational blur the image\n"
3511 " -sample geometry scale image with pixel sampling\n"
3512 " -scale geometry scale the image\n"
3513 " -segment values segment an image\n"
3514 " -selective-blur geometry\n"
3515 " selectively blur pixels within a contrast threshold\n"
3516 " -sepia-tone threshold\n"
3517 " simulate a sepia-toned photo\n"
3518 " -set property value set an image property\n"
3519 " -shade degrees shade the image using a distant light source\n"
3520 " -shadow geometry simulate an image shadow\n"
3521 " -sharpen geometry sharpen the image\n"
3522 " -shave geometry shave pixels from the image edges\n"
3523 " -shear geometry slide one edge of the image along the X or Y axis\n"
3524 " -sigmoidal-contrast geometry\n"
3525 " increase the contrast without saturating highlights or\n"
3527 " -sketch geometry simulate a pencil sketch\n"
3528 " -solarize threshold negate all pixels above the threshold level\n"
3529 " -sort-pixels sort each scanline in ascending order of intensity\n"
3530 " -sparse-color method args\n"
3531 " fill in a image based on a few color points\n"
3532 " -splice geometry splice the background color into the image\n"
3533 " -spread radius displace image pixels by a random amount\n"
3534 " -statistic type radius\n"
3535 " replace each pixel with corresponding statistic from the neighborhood\n"
3536 " -strip strip image of all profiles and comments\n"
3537 " -swirl degrees swirl image pixels about the center\n"
3538 " -threshold value threshold the image\n"
3539 " -thumbnail geometry create a thumbnail of the image\n"
3540 " -tile filename tile image when filling a graphic primitive\n"
3541 " -tint value tint the image with the fill color\n"
3542 " -transform affine transform image\n"
3543 " -transparent color make this color transparent within the image\n"
3544 " -transpose flip image vertically and rotate 90 degrees\n"
3545 " -transverse flop image horizontally and rotate 270 degrees\n"
3546 " -trim trim image edges\n"
3547 " -type type image type\n"
3548 " -unique-colors discard all but one of any pixel color\n"
3549 " -unsharp geometry sharpen the image\n"
3550 " -vignette geometry soften the edges of the image in vignette style\n"
3551 " -wave geometry alter an image along a sine wave\n"
3552 " -wavelet-denoise threshold\n"
3553 " removes noise from the image using a wavelet transform\n"
3554 " -white-balance automagically adjust white balance of image\n"
3555 " -white-threshold value\n"
3556 " force all pixels above the threshold into white",
3557 sequence_operators[] =
3558 " -affinity filename transform image colors to match this set of colors\n"
3559 " -append append an image sequence\n"
3560 " -clut apply a color lookup table to the image\n"
3561 " -coalesce merge a sequence of images\n"
3562 " -combine combine a sequence of images\n"
3563 " -compare mathematically and visually annotate the difference between an image and its reconstruction\n"
3564 " -complex operator perform complex mathematics on an image sequence\n"
3565 " -composite composite image\n"
3566 " -copy geometry offset\n"
3567 " copy pixels from one area of an image to another\n"
3568 " -crop geometry cut out a rectangular region of the image\n"
3569 " -deconstruct break down an image sequence into constituent parts\n"
3570 " -evaluate-sequence operator\n"
3571 " evaluate an arithmetic, relational, or logical expression\n"
3572 " -flatten flatten a sequence of images\n"
3573 " -fx expression apply mathematical expression to an image channel(s)\n"
3574 " -hald-clut apply a Hald color lookup table to the image\n"
3575 " -layers method optimize, merge, or compare image layers\n"
3576 " -morph value morph an image sequence\n"
3577 " -mosaic create a mosaic from an image sequence\n"
3578 " -poly terms build a polynomial from the image sequence and the corresponding\n"
3579 " terms (coefficients and degree pairs).\n"
3580 " -print string interpret string and print to console\n"
3581 " -process arguments process the image with a custom image filter\n"
3582 " -smush geometry smush an image sequence together\n"
3583 " -write filename write images to this file",
3585 " -adjoin join images into a single multi-image file\n"
3586 " -affine matrix affine transform matrix\n"
3587 " -alpha option activate, deactivate, reset, or set the alpha channel\n"
3588 " -antialias remove pixel-aliasing\n"
3589 " -authenticate password\n"
3590 " decipher image with this password\n"
3591 " -attenuate value lessen (or intensify) when adding noise to an image\n"
3592 " -background color background color\n"
3593 " -bias value add bias when convolving an image\n"
3594 " -black-point-compensation\n"
3595 " use black point compensation\n"
3596 " -blue-primary point chromaticity blue primary point\n"
3597 " -bordercolor color border color\n"
3598 " -caption string assign a caption to an image\n"
3599 " -colorspace type alternate image colorspace\n"
3600 " -comment string annotate image with comment\n"
3601 " -compose operator set image composite operator\n"
3602 " -compress type type of pixel compression when writing the image\n"
3603 " -define format:option=value\n"
3604 " define one or more image format options\n"
3605 " -delay value display the next image after pausing\n"
3606 " -density geometry horizontal and vertical density of the image\n"
3607 " -depth value image depth\n"
3608 " -direction type render text right-to-left or left-to-right\n"
3609 " -display server get image or font from this X server\n"
3610 " -dispose method layer disposal method\n"
3611 " -dither method apply error diffusion to image\n"
3612 " -encoding type text encoding type\n"
3613 " -endian type endianness (MSB or LSB) of the image\n"
3614 " -family name render text with this font family\n"
3615 " -features distance analyze image features (e.g. contrast, correlation)\n"
3616 " -fill color color to use when filling a graphic primitive\n"
3617 " -filter type use this filter when resizing an image\n"
3618 " -font name render text with this font\n"
3619 " -format \"string\" output formatted image characteristics\n"
3620 " -fuzz distance colors within this distance are considered equal\n"
3621 " -gravity type horizontal and vertical text placement\n"
3622 " -green-primary point chromaticity green primary point\n"
3623 " -illuminant type reference illuminant\n"
3624 " -intensity method method to generate an intensity value from a pixel\n"
3625 " -intent type type of rendering intent when managing the image color\n"
3626 " -interlace type type of image interlacing scheme\n"
3627 " -interline-spacing value\n"
3628 " set the space between two text lines\n"
3629 " -interpolate method pixel color interpolation method\n"
3630 " -interword-spacing value\n"
3631 " set the space between two words\n"
3632 " -kerning value set the space between two letters\n"
3633 " -label string assign a label to an image\n"
3634 " -limit type value pixel cache resource limit\n"
3635 " -loop iterations add Netscape loop extension to your GIF animation\n"
3636 " -matte store matte channel if the image has one\n"
3637 " -mattecolor color frame color\n"
3638 " -monitor monitor progress\n"
3639 " -orient type image orientation\n"
3640 " -page geometry size and location of an image canvas (setting)\n"
3641 " -path path write images to this path on disk\n"
3642 " -ping efficiently determine image attributes\n"
3643 " -pointsize value font point size\n"
3644 " -precision value maximum number of significant digits to print\n"
3645 " -preview type image preview type\n"
3646 " -quality value JPEG/MIFF/PNG compression level\n"
3647 " -quiet suppress all warning messages\n"
3648 " -read-mask filename associate a read mask with the image\n"
3649 " -red-primary point chromaticity red primary point\n"
3650 " -regard-warnings pay attention to warning messages\n"
3651 " -remap filename transform image colors to match this set of colors\n"
3652 " -respect-parentheses settings remain in effect until parenthesis boundary\n"
3653 " -sampling-factor geometry\n"
3654 " horizontal and vertical sampling factor\n"
3655 " -scene value image scene number\n"
3656 " -seed value seed a new sequence of pseudo-random numbers\n"
3657 " -size geometry width and height of image\n"
3658 " -stretch type render text with this font stretch\n"
3659 " -stroke color graphic primitive stroke color\n"
3660 " -strokewidth value graphic primitive stroke width\n"
3661 " -style type render text with this font style\n"
3662 " -synchronize synchronize image to storage device\n"
3663 " -taint declare the image as modified\n"
3664 " -texture filename name of texture to tile onto the image background\n"
3665 " -tile-offset geometry\n"
3667 " -treedepth value color tree depth\n"
3668 " -transparent-color color\n"
3669 " transparent color\n"
3670 " -undercolor color annotation bounding box color\n"
3671 " -units type the units of image resolution\n"
3672 " -verbose print detailed information about the image\n"
3673 " -view FlashPix viewing transforms\n"
3674 " -virtual-pixel method\n"
3675 " virtual pixel access method\n"
3676 " -weight type render text with this font weight\n"
3677 " -white-point point chromaticity white point\n"
3678 " -word-break type sets whether line breaks appear wherever the text would otherwise overflow"
3679 " -write-mask filename associate a write mask with the image",
3681 " -delete indexes delete the image from the image sequence\n"
3682 " -duplicate count,indexes\n"
3683 " duplicate an image one or more times\n"
3684 " -insert index insert last image into the image sequence\n"
3685 " -reverse reverse image sequence\n"
3686 " -swap indexes swap two images in the image sequence";
3688 ListMagickVersion(stdout);
3689 (void) printf(
"Usage: %s [options ...] file [ [options ...] file ...]\n",
3691 (void) fprintf(stdout,
"\nImage Settings:\n");
3692 (void) fputs(settings,stdout);
3693 (void) fprintf(stdout,
"\nImage Operators:\n");
3694 (void) fputs(operators,stdout);
3695 (void) fprintf(stdout,
"\nImage Channel Operators:\n");
3696 (void) fputs(channel_operators,stdout);
3697 (void) fprintf(stdout,
"\nImage Sequence Operators:\n");
3698 (void) fputs(sequence_operators,stdout);
3699 (void) fprintf(stdout,
"\nImage Stack Operators:\n");
3700 (void) fputs(stack_operators,stdout);
3701 (void) fprintf(stdout,
"\nMiscellaneous Options:\n");
3702 (void) fputs(miscellaneous,stdout);
3703 (void) fprintf(stdout,
3704 "\nBy default, the image format of 'file' is determined by its magic\n");
3705 (void) fprintf(stdout,
3706 "number. To specify a particular image format, precede the filename\n");
3707 (void) fprintf(stdout,
3708 "with an image format name and a colon (i.e. ps:image) or specify the\n");
3709 (void) fprintf(stdout,
3710 "image type as the filename suffix (i.e. image.ps). Specify 'file' as\n");
3711 (void) fprintf(stdout,
"'-' for standard input or output.\n");
3715WandExport MagickBooleanType MogrifyImageCommand(ImageInfo *image_info,
3716 int argc,
char **argv,
char **wand_unused(metadata),ExceptionInfo *exception)
3718#define DestroyMogrify() \
3720 if (format != (char *) NULL) \
3721 format=DestroyString(format); \
3722 if (path != (char *) NULL) \
3723 path=DestroyString(path); \
3724 DestroyImageStack(); \
3725 for (i=0; i < (ssize_t) argc; i++) \
3726 argv[i]=DestroyString(argv[i]); \
3727 argv=(char **) RelinquishMagickMemory(argv); \
3729#define ThrowMogrifyException(asperity,tag,option) \
3731 (void) ThrowMagickException(exception,GetMagickModule(),asperity,tag,"`%s'", \
3734 return(MagickFalse); \
3736#define ThrowMogrifyInvalidArgumentException(option,argument) \
3738 (void) ThrowMagickException(exception,GetMagickModule(),OptionError, \
3739 "InvalidArgument","'%s': %s",argument,option); \
3741 return(MagickFalse); \
3753 image_stack[MaxImageStackDepth+1];
3761 respect_parentheses;
3773 wand_unreferenced(metadata);
3778 assert(image_info != (ImageInfo *) NULL);
3779 assert(image_info->signature == MagickCoreSignature);
3780 if (IsEventLogging() != MagickFalse)
3781 (void) LogMagickEvent(TraceEvent,GetMagickModule(),
"...");
3782 assert(exception != (ExceptionInfo *) NULL);
3786 if ((LocaleCompare(
"version",option+1) == 0) ||
3787 (LocaleCompare(
"-version",option+1) == 0))
3789 ListMagickVersion(stdout);
3795 (void) ThrowMagickException(exception,GetMagickModule(),OptionError,
3796 "MissingArgument",
"%s",
"");
3797 (void) MogrifyUsage();
3798 return(MagickFalse);
3800 format=(
char *) NULL;
3802 global_colormap=MagickFalse;
3806 option=(
char *) NULL;
3808 respect_parentheses=MagickFalse;
3813 ReadCommandlLine(argc,&argv);
3814 status=ExpandFilenames(&argc,&argv);
3815 if (status == MagickFalse)
3816 ThrowMogrifyException(ResourceLimitError,
"MemoryAllocationFailed",
3817 GetExceptionMessage(errno));
3818 for (i=1; i < (ssize_t) argc; i++)
3821 if (LocaleCompare(option,
"(") == 0)
3823 FireImageStack(MagickFalse,MagickTrue,pend);
3824 if (k == MaxImageStackDepth)
3825 ThrowMogrifyException(OptionError,
"ParenthesisNestedTooDeeply",
3830 if (LocaleCompare(option,
")") == 0)
3832 FireImageStack(MagickFalse,MagickTrue,MagickTrue);
3834 ThrowMogrifyException(OptionError,
"UnableToParseExpression",option);
3838 if (IsCommandOption(option) == MagickFalse)
3841 backup_filename[MagickPathExtent],
3843 magic[MagickPathExtent];
3854 FireImageStack(MagickFalse,MagickFalse,pend);
3856 if ((LocaleCompare(filename,
"--") == 0) && (i < (ssize_t) (argc-1)))
3858 images=ReadImages(image_info,filename,exception);
3859 status&=(MagickStatusType) (images != (Image *) NULL) &&
3860 (exception->severity < ErrorException);
3861 if (images == (Image *) NULL)
3863 properties=(*GetBlobProperties(images));
3864 if (format != (
char *) NULL)
3865 GetPathComponent(images->magick_filename,
3866 BasePathSansCompressExtension,images->filename);
3867 if (path != (
char *) NULL)
3869 GetPathComponent(option,TailPath,filename);
3870 (void) FormatLocaleString(images->filename,MagickPathExtent,
3871 "%s%c%s",path,*DirectorySeparator,filename);
3873 if (format != (
char *) NULL)
3874 AppendImageFormat(format,images->filename);
3875 AppendImageStack(images);
3876 FinalizeImageSettings(image_info,image,MagickFalse);
3877 if (image == (Image *) NULL)
3879 if (global_colormap != MagickFalse)
3884 quantize_info=AcquireQuantizeInfo(image_info);
3885 (void) RemapImages(quantize_info,images,(Image *) NULL,exception);
3886 quantize_info=DestroyQuantizeInfo(quantize_info);
3888 *backup_filename=
'\0';
3890 GetPathComponent(filename,MagickPath,magic);
3894 name[MagickPathExtent];
3896 if (format != (
char *) NULL)
3897 (void) CopyMagickString(magic,format,MagickPathExtent);
3898 (void) FormatLocaleString(name,MagickPathExtent,
"%s:%s",magic,
3900 (void) CopyMagickString(image->filename,name,MagickPathExtent);
3902 if ((LocaleCompare(image->filename,
"-") != 0) &&
3903 (IsPathWritable(image->filename) != MagickFalse))
3908 (void) CopyMagickString(backup_filename,image->filename,
3910 for (j=0; j < 6; j++)
3912 (void) ConcatenateMagickString(backup_filename,
"~",
3914 if (IsPathAccessible(backup_filename) == MagickFalse)
3917 if ((IsPathAccessible(backup_filename) != MagickFalse) ||
3918 (rename_utf8(image->filename,backup_filename) != 0))
3919 *backup_filename=
'\0';
3924 image_info->synchronize=MagickTrue;
3925 status&=(MagickStatusType) WriteImages(image_info,image,image->filename,
3927 if (status != MagickFalse)
3933 preserve_timestamp=IsStringTrue(GetImageOption(image_info,
3934 "preserve-timestamp"));
3935 if (preserve_timestamp != MagickFalse)
3936 (void) set_file_timestamp(image->filename,&properties);
3938 if (*backup_filename !=
'\0')
3939 (void) remove_utf8(backup_filename);
3942 if (*backup_filename !=
'\0')
3943 (void) rename_utf8(backup_filename,image->filename);
3944 RemoveAllImageStack();
3947 pend=image != (Image *) NULL ? MagickTrue : MagickFalse;
3948 switch (*(option+1))
3952 if (LocaleCompare(
"adaptive-blur",option+1) == 0)
3955 if (i == (ssize_t) argc)
3956 ThrowMogrifyException(OptionError,
"MissingArgument",option);
3957 if (IsGeometry(argv[i]) == MagickFalse)
3958 ThrowMogrifyInvalidArgumentException(option,argv[i]);
3961 if (LocaleCompare(
"adaptive-resize",option+1) == 0)
3964 if (i == (ssize_t) argc)
3965 ThrowMogrifyException(OptionError,
"MissingArgument",option);
3966 if (IsGeometry(argv[i]) == MagickFalse)
3967 ThrowMogrifyInvalidArgumentException(option,argv[i]);
3970 if (LocaleCompare(
"adaptive-sharpen",option+1) == 0)
3973 if (i == (ssize_t) argc)
3974 ThrowMogrifyException(OptionError,
"MissingArgument",option);
3975 if (IsGeometry(argv[i]) == MagickFalse)
3976 ThrowMogrifyInvalidArgumentException(option,argv[i]);
3979 if (LocaleCompare(
"affine",option+1) == 0)
3984 if (i == (ssize_t) argc)
3985 ThrowMogrifyException(OptionError,
"MissingArgument",option);
3988 if (LocaleCompare(
"alpha",option+1) == 0)
3996 if (i == (ssize_t) argc)
3997 ThrowMogrifyException(OptionError,
"MissingArgument",option);
3998 type=ParseCommandOption(MagickAlphaChannelOptions,MagickFalse,
4001 ThrowMogrifyException(OptionError,
4002 "UnrecognizedAlphaChannelOption",argv[i]);
4005 if (LocaleCompare(
"annotate",option+1) == 0)
4010 if (i == (ssize_t) argc)
4011 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4012 if (IsGeometry(argv[i]) == MagickFalse)
4013 ThrowMogrifyInvalidArgumentException(option,argv[i]);
4014 if (i == (ssize_t) argc)
4015 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4019 if (LocaleCompare(
"antialias",option+1) == 0)
4021 if (LocaleCompare(
"append",option+1) == 0)
4023 if (LocaleCompare(
"attenuate",option+1) == 0)
4028 if (i == (ssize_t) argc)
4029 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4030 if (IsGeometry(argv[i]) == MagickFalse)
4031 ThrowMogrifyInvalidArgumentException(option,argv[i]);
4034 if (LocaleCompare(
"authenticate",option+1) == 0)
4039 if (i == (ssize_t) argc)
4040 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4043 if (LocaleCompare(
"auto-gamma",option+1) == 0)
4045 if (LocaleCompare(
"auto-level",option+1) == 0)
4047 if (LocaleCompare(
"auto-orient",option+1) == 0)
4049 if (LocaleCompare(
"auto-threshold",option+1) == 0)
4057 if (i == (ssize_t) argc)
4058 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4059 method=ParseCommandOption(MagickAutoThresholdOptions,MagickFalse,
4062 ThrowMogrifyException(OptionError,
"UnrecognizedThresholdMethod",
4066 if (LocaleCompare(
"average",option+1) == 0)
4068 ThrowMogrifyException(OptionError,
"UnrecognizedOption",option)
4072 if (LocaleCompare(
"background",option+1) == 0)
4077 if (i == (ssize_t) argc)
4078 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4081 if (LocaleCompare(
"bias",option+1) == 0)
4086 if (i == (ssize_t) argc)
4087 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4088 if (IsGeometry(argv[i]) == MagickFalse)
4089 ThrowMogrifyInvalidArgumentException(option,argv[i]);
4092 if (LocaleCompare(
"bilateral-blur",option+1) == 0)
4097 if (i == (ssize_t) argc)
4098 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4099 if (IsGeometry(argv[i]) == MagickFalse)
4100 ThrowMogrifyInvalidArgumentException(option,argv[i]);
4103 if (LocaleCompare(
"black-point-compensation",option+1) == 0)
4105 if (LocaleCompare(
"black-threshold",option+1) == 0)
4110 if (i == (ssize_t) argc)
4111 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4112 if (IsGeometry(argv[i]) == MagickFalse)
4113 ThrowMogrifyInvalidArgumentException(option,argv[i]);
4116 if (LocaleCompare(
"blue-primary",option+1) == 0)
4121 if (i == (ssize_t) argc)
4122 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4123 if (IsGeometry(argv[i]) == MagickFalse)
4124 ThrowMogrifyInvalidArgumentException(option,argv[i]);
4127 if (LocaleCompare(
"blue-shift",option+1) == 0)
4130 if (i == (ssize_t) argc)
4131 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4132 if (IsGeometry(argv[i]) == MagickFalse)
4133 ThrowMogrifyInvalidArgumentException(option,argv[i]);
4136 if (LocaleCompare(
"blur",option+1) == 0)
4139 if (i == (ssize_t) argc)
4140 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4141 if (IsGeometry(argv[i]) == MagickFalse)
4142 ThrowMogrifyInvalidArgumentException(option,argv[i]);
4145 if (LocaleCompare(
"border",option+1) == 0)
4150 if (i == (ssize_t) argc)
4151 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4152 if (IsGeometry(argv[i]) == MagickFalse)
4153 ThrowMogrifyInvalidArgumentException(option,argv[i]);
4156 if (LocaleCompare(
"bordercolor",option+1) == 0)
4161 if (i == (ssize_t) argc)
4162 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4165 if (LocaleCompare(
"box",option+1) == 0)
4170 if (i == (ssize_t) argc)
4171 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4174 if (LocaleCompare(
"brightness-contrast",option+1) == 0)
4177 if (i == (ssize_t) argc)
4178 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4179 if (IsGeometry(argv[i]) == MagickFalse)
4180 ThrowMogrifyInvalidArgumentException(option,argv[i]);
4183 ThrowMogrifyException(OptionError,
"UnrecognizedOption",option)
4187 if (LocaleCompare(
"cache",option+1) == 0)
4192 if (i == (ssize_t) argc)
4193 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4194 if (IsGeometry(argv[i]) == MagickFalse)
4195 ThrowMogrifyInvalidArgumentException(option,argv[i]);
4198 if (LocaleCompare(
"canny",option+1) == 0)
4203 if (i == (ssize_t) argc)
4204 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4205 if (IsGeometry(argv[i]) == MagickFalse)
4206 ThrowMogrifyInvalidArgumentException(option,argv[i]);
4209 if (LocaleCompare(
"caption",option+1) == 0)
4214 if (i == (ssize_t) argc)
4215 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4218 if (LocaleCompare(
"channel",option+1) == 0)
4226 if (i == (ssize_t) argc)
4227 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4228 channel=ParseChannelOption(argv[i]);
4230 ThrowMogrifyException(OptionError,
"UnrecognizedChannelType",
4234 if (LocaleCompare(
"channel-fx",option+1) == 0)
4242 if (i == (ssize_t) argc)
4243 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4244 channel=ParsePixelChannelOption(argv[i]);
4246 ThrowMogrifyException(OptionError,
"UnrecognizedChannelType",
4250 if (LocaleCompare(
"cdl",option+1) == 0)
4255 if (i == (ssize_t) argc)
4256 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4259 if (LocaleCompare(
"charcoal",option+1) == 0)
4264 if (i == (ssize_t) argc)
4265 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4266 if (IsGeometry(argv[i]) == MagickFalse)
4267 ThrowMogrifyInvalidArgumentException(option,argv[i]);
4270 if (LocaleCompare(
"chop",option+1) == 0)
4275 if (i == (ssize_t) argc)
4276 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4277 if (IsGeometry(argv[i]) == MagickFalse)
4278 ThrowMogrifyInvalidArgumentException(option,argv[i]);
4281 if (LocaleCompare(
"clahe",option+1) == 0)
4286 if (i == (ssize_t) argc)
4287 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4288 if (IsGeometry(argv[i]) == MagickFalse)
4289 ThrowMogrifyInvalidArgumentException(option,argv[i]);
4292 if (LocaleCompare(
"clamp",option+1) == 0)
4294 if (LocaleCompare(
"clip",option+1) == 0)
4296 if (LocaleCompare(
"clip-mask",option+1) == 0)
4301 if (i == (ssize_t) argc)
4302 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4305 if (LocaleCompare(
"clut",option+1) == 0)
4307 if (LocaleCompare(
"coalesce",option+1) == 0)
4309 if (LocaleCompare(
"colorize",option+1) == 0)
4314 if (i == (ssize_t) argc)
4315 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4316 if (IsGeometry(argv[i]) == MagickFalse)
4317 ThrowMogrifyInvalidArgumentException(option,argv[i]);
4320 if (LocaleCompare(
"color-matrix",option+1) == 0)
4328 if (i == (ssize_t) argc)
4329 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4330 kernel_info=AcquireKernelInfo(argv[i],exception);
4331 if (kernel_info == (KernelInfo *) NULL)
4332 ThrowMogrifyInvalidArgumentException(option,argv[i]);
4333 kernel_info=DestroyKernelInfo(kernel_info);
4336 if (LocaleCompare(
"colors",option+1) == 0)
4341 if (i == (ssize_t) argc)
4342 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4343 if (IsGeometry(argv[i]) == MagickFalse)
4344 ThrowMogrifyInvalidArgumentException(option,argv[i]);
4347 if (LocaleCompare(
"colorspace",option+1) == 0)
4355 if (i == (ssize_t) argc)
4356 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4357 colorspace=ParseCommandOption(MagickColorspaceOptions,MagickFalse,
4360 ThrowMogrifyException(OptionError,
"UnrecognizedColorspace",
4364 if (LocaleCompare(
"color-threshold",option+1) == 0)
4369 if (i == (ssize_t) argc)
4370 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4373 if (LocaleCompare(
"combine",option+1) == 0)
4381 if (i == (ssize_t) argc)
4382 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4383 colorspace=ParseCommandOption(MagickColorspaceOptions,MagickFalse,
4386 ThrowMogrifyException(OptionError,
"UnrecognizedColorspace",
4390 if (LocaleCompare(
"comment",option+1) == 0)
4395 if (i == (ssize_t) argc)
4396 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4399 if (LocaleCompare(
"compare",option+1) == 0)
4401 if (LocaleCompare(
"compose",option+1) == 0)
4409 if (i == (ssize_t) argc)
4410 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4411 compose=ParseCommandOption(MagickComposeOptions,MagickFalse,
4414 ThrowMogrifyException(OptionError,
"UnrecognizedComposeOperator",
4418 if (LocaleCompare(
"composite",option+1) == 0)
4420 if (LocaleCompare(
"compress",option+1) == 0)
4428 if (i == (ssize_t) argc)
4429 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4430 compress=ParseCommandOption(MagickCompressOptions,MagickFalse,
4433 ThrowMogrifyException(OptionError,
"UnrecognizedImageCompression",
4437 if (LocaleCompare(
"concurrent",option+1) == 0)
4439 if (LocaleCompare(
"connected-components",option+1) == 0)
4442 if (i == (ssize_t) argc)
4443 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4444 if (IsGeometry(argv[i]) == MagickFalse)
4445 ThrowMogrifyInvalidArgumentException(option,argv[i]);
4448 if (LocaleCompare(
"contrast",option+1) == 0)
4450 if (LocaleCompare(
"contrast-stretch",option+1) == 0)
4453 if (i == (ssize_t) argc)
4454 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4455 if (IsGeometry(argv[i]) == MagickFalse)
4456 ThrowMogrifyInvalidArgumentException(option,argv[i]);
4459 if (LocaleCompare(
"convolve",option+1) == 0)
4467 if (i == (ssize_t) argc)
4468 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4469 kernel_info=AcquireKernelInfo(argv[i],exception);
4470 if (kernel_info == (KernelInfo *) NULL)
4471 ThrowMogrifyInvalidArgumentException(option,argv[i]);
4472 kernel_info=DestroyKernelInfo(kernel_info);
4475 if (LocaleCompare(
"copy",option+1) == 0)
4480 if (i == (ssize_t) argc)
4481 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4482 if (IsGeometry(argv[i]) == MagickFalse)
4483 ThrowMogrifyInvalidArgumentException(option,argv[i]);
4485 if (i == (ssize_t) argc)
4486 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4487 if (IsGeometry(argv[i]) == MagickFalse)
4488 ThrowMogrifyInvalidArgumentException(option,argv[i]);
4491 if (LocaleCompare(
"crop",option+1) == 0)
4496 if (i == (ssize_t) argc)
4497 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4498 if (IsGeometry(argv[i]) == MagickFalse)
4499 ThrowMogrifyInvalidArgumentException(option,argv[i]);
4502 if (LocaleCompare(
"cycle",option+1) == 0)
4507 if (i == (ssize_t) argc)
4508 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4509 if (IsGeometry(argv[i]) == MagickFalse)
4510 ThrowMogrifyInvalidArgumentException(option,argv[i]);
4513 ThrowMogrifyException(OptionError,
"UnrecognizedOption",option)
4517 if (LocaleCompare(
"decipher",option+1) == 0)
4522 if (i == (ssize_t) argc)
4523 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4526 if (LocaleCompare(
"deconstruct",option+1) == 0)
4528 if (LocaleCompare(
"debug",option+1) == 0)
4536 if (i == (ssize_t) argc)
4537 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4538 event=ParseCommandOption(MagickLogEventOptions,MagickFalse,argv[i]);
4540 ThrowMogrifyException(OptionError,
"UnrecognizedEventType",
4542 (void) SetLogEventMask(argv[i]);
4545 if (LocaleCompare(
"define",option+1) == 0)
4548 if (i == (ssize_t) argc)
4549 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4555 define=GetImageOption(image_info,argv[i]);
4556 if (define == (
const char *) NULL)
4557 ThrowMogrifyException(OptionError,
"NoSuchOption",argv[i]);
4562 if (LocaleCompare(
"delay",option+1) == 0)
4567 if (i == (ssize_t) argc)
4568 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4569 if (IsGeometry(argv[i]) == MagickFalse)
4570 ThrowMogrifyInvalidArgumentException(option,argv[i]);
4573 if (LocaleCompare(
"delete",option+1) == 0)
4578 if (i == (ssize_t) argc)
4579 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4580 if (LocaleNCompare(argv[i],
"registry:",9) == 0)
4582 (void) DeleteImageRegistry(argv[i]+9);
4585 if (IsGeometry(argv[i]) == MagickFalse)
4586 ThrowMogrifyInvalidArgumentException(option,argv[i]);
4589 if (LocaleCompare(
"density",option+1) == 0)
4594 if (i == (ssize_t) argc)
4595 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4596 if (IsGeometry(argv[i]) == MagickFalse)
4597 ThrowMogrifyInvalidArgumentException(option,argv[i]);
4600 if (LocaleCompare(
"depth",option+1) == 0)
4605 if (i == (ssize_t) argc)
4606 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4607 if (IsGeometry(argv[i]) == MagickFalse)
4608 ThrowMogrifyInvalidArgumentException(option,argv[i]);
4611 if (LocaleCompare(
"deskew",option+1) == 0)
4616 if (i == (ssize_t) argc)
4617 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4618 if (IsGeometry(argv[i]) == MagickFalse)
4619 ThrowMogrifyInvalidArgumentException(option,argv[i]);
4622 if (LocaleCompare(
"despeckle",option+1) == 0)
4624 if (LocaleCompare(
"dft",option+1) == 0)
4626 if (LocaleCompare(
"direction",option+1) == 0)
4634 if (i == (ssize_t) argc)
4635 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4636 direction=ParseCommandOption(MagickDirectionOptions,MagickFalse,
4639 ThrowMogrifyException(OptionError,
"UnrecognizedDirectionType",
4643 if (LocaleCompare(
"display",option+1) == 0)
4648 if (i == (ssize_t) argc)
4649 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4652 if (LocaleCompare(
"dispose",option+1) == 0)
4660 if (i == (ssize_t) argc)
4661 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4662 dispose=ParseCommandOption(MagickDisposeOptions,MagickFalse,
4665 ThrowMogrifyException(OptionError,
"UnrecognizedDisposeMethod",
4669 if (LocaleCompare(
"distort",option+1) == 0)
4675 if (i == (ssize_t) argc)
4676 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4677 op=ParseCommandOption(MagickDistortOptions,MagickFalse,argv[i]);
4679 ThrowMogrifyException(OptionError,
"UnrecognizedDistortMethod",
4682 if (i == (ssize_t) argc)
4683 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4686 if (LocaleCompare(
"dither",option+1) == 0)
4694 if (i == (ssize_t) argc)
4695 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4696 method=ParseCommandOption(MagickDitherOptions,MagickFalse,argv[i]);
4698 ThrowMogrifyException(OptionError,
"UnrecognizedDitherMethod",
4702 if (LocaleCompare(
"draw",option+1) == 0)
4707 if (i == (ssize_t) argc)
4708 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4711 if (LocaleCompare(
"duplicate",option+1) == 0)
4716 if (i == (ssize_t) argc)
4717 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4718 if (IsGeometry(argv[i]) == MagickFalse)
4719 ThrowMogrifyInvalidArgumentException(option,argv[i]);
4722 if (LocaleCompare(
"duration",option+1) == 0)
4727 if (i == (ssize_t) argc)
4728 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4729 if (IsGeometry(argv[i]) == MagickFalse)
4730 ThrowMogrifyInvalidArgumentException(option,argv[i]);
4733 ThrowMogrifyException(OptionError,
"UnrecognizedOption",option)
4737 if (LocaleCompare(
"edge",option+1) == 0)
4742 if (i == (ssize_t) argc)
4743 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4744 if (IsGeometry(argv[i]) == MagickFalse)
4745 ThrowMogrifyInvalidArgumentException(option,argv[i]);
4748 if (LocaleCompare(
"emboss",option+1) == 0)
4753 if (i == (ssize_t) argc)
4754 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4755 if (IsGeometry(argv[i]) == MagickFalse)
4756 ThrowMogrifyInvalidArgumentException(option,argv[i]);
4759 if (LocaleCompare(
"encipher",option+1) == 0)
4764 if (i == (ssize_t) argc)
4765 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4768 if (LocaleCompare(
"encoding",option+1) == 0)
4773 if (i == (ssize_t) argc)
4774 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4777 if (LocaleCompare(
"endian",option+1) == 0)
4785 if (i == (ssize_t) argc)
4786 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4787 endian=ParseCommandOption(MagickEndianOptions,MagickFalse,argv[i]);
4789 ThrowMogrifyException(OptionError,
"UnrecognizedEndianType",
4793 if (LocaleCompare(
"enhance",option+1) == 0)
4795 if (LocaleCompare(
"equalize",option+1) == 0)
4797 if (LocaleCompare(
"evaluate",option+1) == 0)
4805 if (i == (ssize_t) argc)
4806 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4807 op=ParseCommandOption(MagickEvaluateOptions,MagickFalse,argv[i]);
4809 ThrowMogrifyException(OptionError,
"UnrecognizedEvaluateOperator",
4812 if (i == (ssize_t) argc)
4813 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4814 if (IsGeometry(argv[i]) == MagickFalse)
4815 ThrowMogrifyInvalidArgumentException(option,argv[i]);
4818 if (LocaleCompare(
"evaluate-sequence",option+1) == 0)
4826 if (i == (ssize_t) argc)
4827 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4828 op=ParseCommandOption(MagickEvaluateOptions,MagickFalse,argv[i]);
4830 ThrowMogrifyException(OptionError,
"UnrecognizedEvaluateOperator",
4834 if (LocaleCompare(
"extent",option+1) == 0)
4839 if (i == (ssize_t) argc)
4840 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4841 if (IsGeometry(argv[i]) == MagickFalse)
4842 ThrowMogrifyInvalidArgumentException(option,argv[i]);
4845 if (LocaleCompare(
"extract",option+1) == 0)
4850 if (i == (ssize_t) argc)
4851 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4852 if (IsGeometry(argv[i]) == MagickFalse)
4853 ThrowMogrifyInvalidArgumentException(option,argv[i]);
4856 ThrowMogrifyException(OptionError,
"UnrecognizedOption",option)
4860 if (LocaleCompare(
"family",option+1) == 0)
4865 if (i == (ssize_t) argc)
4866 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4869 if (LocaleCompare(
"features",option+1) == 0)
4874 if (i == (ssize_t) argc)
4875 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4876 if (IsGeometry(argv[i]) == MagickFalse)
4877 ThrowMogrifyInvalidArgumentException(option,argv[i]);
4880 if (LocaleCompare(
"fill",option+1) == 0)
4885 if (i == (ssize_t) argc)
4886 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4889 if (LocaleCompare(
"filter",option+1) == 0)
4897 if (i == (ssize_t) argc)
4898 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4899 filter=ParseCommandOption(MagickFilterOptions,MagickFalse,argv[i]);
4901 ThrowMogrifyException(OptionError,
"UnrecognizedImageFilter",
4905 if (LocaleCompare(
"flatten",option+1) == 0)
4907 if (LocaleCompare(
"flip",option+1) == 0)
4909 if (LocaleCompare(
"flop",option+1) == 0)
4911 if (LocaleCompare(
"floodfill",option+1) == 0)
4916 if (i == (ssize_t) argc)
4917 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4918 if (IsGeometry(argv[i]) == MagickFalse)
4919 ThrowMogrifyInvalidArgumentException(option,argv[i]);
4921 if (i == (ssize_t) argc)
4922 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4925 if (LocaleCompare(
"font",option+1) == 0)
4930 if (i == (ssize_t) argc)
4931 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4934 if (LocaleCompare(
"format",option+1) == 0)
4936 (void) CopyMagickString(argv[i]+1,
"sans",MagickPathExtent);
4937 (void) CloneString(&format,(
char *) NULL);
4941 if (i == (ssize_t) argc)
4942 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4943 (void) CloneString(&format,argv[i]);
4944 (void) CopyMagickString(image_info->filename,format,
4946 (void) ConcatenateMagickString(image_info->filename,
":",
4948 (void) SetImageInfo(image_info,0,exception);
4949 if (*image_info->magick ==
'\0')
4950 ThrowMogrifyException(OptionError,
"UnrecognizedImageFormat",
4954 if (LocaleCompare(
"frame",option+1) == 0)
4959 if (i == (ssize_t) argc)
4960 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4961 if (IsGeometry(argv[i]) == MagickFalse)
4962 ThrowMogrifyInvalidArgumentException(option,argv[i]);
4965 if (LocaleCompare(
"function",option+1) == 0)
4973 if (i == (ssize_t) argc)
4974 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4975 op=ParseCommandOption(MagickFunctionOptions,MagickFalse,argv[i]);
4977 ThrowMogrifyException(OptionError,
"UnrecognizedFunction",argv[i]);
4979 if (i == (ssize_t) argc)
4980 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4983 if (LocaleCompare(
"fuzz",option+1) == 0)
4988 if (i == (ssize_t) argc)
4989 ThrowMogrifyException(OptionError,
"MissingArgument",option);
4990 if (IsGeometry(argv[i]) == MagickFalse)
4991 ThrowMogrifyInvalidArgumentException(option,argv[i]);
4994 if (LocaleCompare(
"fx",option+1) == 0)
4997 if (i == (ssize_t) argc)
4998 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5001 ThrowMogrifyException(OptionError,
"UnrecognizedOption",option)
5005 if (LocaleCompare(
"gamma",option+1) == 0)
5008 if (i == (ssize_t) argc)
5009 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5010 if (IsGeometry(argv[i]) == MagickFalse)
5011 ThrowMogrifyInvalidArgumentException(option,argv[i]);
5014 if ((LocaleCompare(
"gaussian-blur",option+1) == 0) ||
5015 (LocaleCompare(
"gaussian",option+1) == 0))
5018 if (i == (ssize_t) argc)
5019 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5020 if (IsGeometry(argv[i]) == MagickFalse)
5021 ThrowMogrifyInvalidArgumentException(option,argv[i]);
5024 if (LocaleCompare(
"geometry",option+1) == 0)
5029 if (i == (ssize_t) argc)
5030 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5031 if (IsGeometry(argv[i]) == MagickFalse)
5032 ThrowMogrifyInvalidArgumentException(option,argv[i]);
5035 if (LocaleCompare(
"gravity",option+1) == 0)
5043 if (i == (ssize_t) argc)
5044 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5045 gravity=ParseCommandOption(MagickGravityOptions,MagickFalse,
5048 ThrowMogrifyException(OptionError,
"UnrecognizedGravityType",
5052 if (LocaleCompare(
"grayscale",option+1) == 0)
5060 if (i == (ssize_t) argc)
5061 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5062 method=ParseCommandOption(MagickPixelIntensityOptions,MagickFalse,
5065 ThrowMogrifyException(OptionError,
"UnrecognizedIntensityMethod",
5069 if (LocaleCompare(
"green-primary",option+1) == 0)
5074 if (i == (ssize_t) argc)
5075 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5076 if (IsGeometry(argv[i]) == MagickFalse)
5077 ThrowMogrifyInvalidArgumentException(option,argv[i]);
5080 ThrowMogrifyException(OptionError,
"UnrecognizedOption",option)
5084 if (LocaleCompare(
"hald-clut",option+1) == 0)
5086 if ((LocaleCompare(
"help",option+1) == 0) ||
5087 (LocaleCompare(
"-help",option+1) == 0))
5090 return(MogrifyUsage());
5092 if (LocaleCompare(
"hough-lines",option+1) == 0)
5097 if (i == (ssize_t) argc)
5098 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5099 if (IsGeometry(argv[i]) == MagickFalse)
5100 ThrowMogrifyInvalidArgumentException(option,argv[i]);
5103 ThrowMogrifyException(OptionError,
"UnrecognizedOption",option)
5107 if (LocaleCompare(
"identify",option+1) == 0)
5109 if (LocaleCompare(
"idft",option+1) == 0)
5111 if (LocaleCompare(
"illuminant",option+1) == 0)
5119 if (i == (ssize_t) argc)
5120 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5121 type=ParseCommandOption(MagickIlluminantOptions,MagickFalse,
5124 ThrowMogrifyException(OptionError,
"UnrecognizedIlluminantMethod",
5128 if (LocaleCompare(
"implode",option+1) == 0)
5133 if (i == (ssize_t) argc)
5134 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5135 if (IsGeometry(argv[i]) == MagickFalse)
5136 ThrowMogrifyInvalidArgumentException(option,argv[i]);
5139 if (LocaleCompare(
"intensity",option+1) == 0)
5147 if (i == (ssize_t) argc)
5148 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5149 intensity=ParseCommandOption(MagickPixelIntensityOptions,
5150 MagickFalse,argv[i]);
5152 ThrowMogrifyException(OptionError,
5153 "UnrecognizedPixelIntensityMethod",argv[i]);
5156 if (LocaleCompare(
"integral",option+1) == 0)
5158 if (LocaleCompare(
"intent",option+1) == 0)
5166 if (i == (ssize_t) argc)
5167 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5168 intent=ParseCommandOption(MagickIntentOptions,MagickFalse,argv[i]);
5170 ThrowMogrifyException(OptionError,
"UnrecognizedIntentType",
5174 if (LocaleCompare(
"interlace",option+1) == 0)
5182 if (i == (ssize_t) argc)
5183 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5184 interlace=ParseCommandOption(MagickInterlaceOptions,MagickFalse,
5187 ThrowMogrifyException(OptionError,
"UnrecognizedInterlaceType",
5191 if (LocaleCompare(
"interline-spacing",option+1) == 0)
5196 if (i == (ssize_t) argc)
5197 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5198 if (IsGeometry(argv[i]) == MagickFalse)
5199 ThrowMogrifyInvalidArgumentException(option,argv[i]);
5202 if (LocaleCompare(
"interpolate",option+1) == 0)
5210 if (i == (ssize_t) argc)
5211 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5212 interpolate=ParseCommandOption(MagickInterpolateOptions,MagickFalse,
5214 if (interpolate < 0)
5215 ThrowMogrifyException(OptionError,
"UnrecognizedInterpolateMethod",
5219 if (LocaleCompare(
"interword-spacing",option+1) == 0)
5224 if (i == (ssize_t) argc)
5225 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5226 if (IsGeometry(argv[i]) == MagickFalse)
5227 ThrowMogrifyInvalidArgumentException(option,argv[i]);
5230 ThrowMogrifyException(OptionError,
"UnrecognizedOption",option)
5234 if (LocaleCompare(
"kerning",option+1) == 0)
5239 if (i == (ssize_t) argc)
5240 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5241 if (IsGeometry(argv[i]) == MagickFalse)
5242 ThrowMogrifyInvalidArgumentException(option,argv[i]);
5245 if (LocaleCompare(
"kmeans",option+1) == 0)
5248 if (i == (ssize_t) argc)
5249 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5250 if (IsGeometry(argv[i]) == MagickFalse)
5251 ThrowMogrifyInvalidArgumentException(option,argv[i]);
5254 if (LocaleCompare(
"kuwahara",option+1) == 0)
5257 if (i == (ssize_t) argc)
5258 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5259 if (IsGeometry(argv[i]) == MagickFalse)
5260 ThrowMogrifyInvalidArgumentException(option,argv[i]);
5263 ThrowMogrifyException(OptionError,
"UnrecognizedOption",option)
5267 if (LocaleCompare(
"label",option+1) == 0)
5272 if (i == (ssize_t) argc)
5273 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5276 if (LocaleCompare(
"lat",option+1) == 0)
5281 if (i == (ssize_t) argc)
5282 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5283 if (IsGeometry(argv[i]) == MagickFalse)
5284 ThrowMogrifyInvalidArgumentException(option,argv[i]);
5287 if (LocaleCompare(
"layers",option+1) == 0)
5295 if (i == (ssize_t) argc)
5296 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5297 type=ParseCommandOption(MagickLayerOptions,MagickFalse,argv[i]);
5299 ThrowMogrifyException(OptionError,
"UnrecognizedLayerMethod",
5303 if (LocaleCompare(
"level",option+1) == 0)
5306 if (i == (ssize_t) argc)
5307 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5308 if (IsGeometry(argv[i]) == MagickFalse)
5309 ThrowMogrifyInvalidArgumentException(option,argv[i]);
5312 if (LocaleCompare(
"level-colors",option+1) == 0)
5315 if (i == (ssize_t) argc)
5316 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5319 if (LocaleCompare(
"limit",option+1) == 0)
5333 if (i == (ssize_t) argc)
5334 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5335 resource=ParseCommandOption(MagickResourceOptions,MagickFalse,
5338 ThrowMogrifyException(OptionError,
"UnrecognizedResourceType",
5341 if (i == (ssize_t) argc)
5342 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5343 value=StringToDouble(argv[i],&p);
5345 if ((p == argv[i]) && (LocaleCompare(
"unlimited",argv[i]) != 0))
5346 ThrowMogrifyInvalidArgumentException(option,argv[i]);
5349 if (LocaleCompare(
"liquid-rescale",option+1) == 0)
5352 if (i == (ssize_t) argc)
5353 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5354 if (IsGeometry(argv[i]) == MagickFalse)
5355 ThrowMogrifyInvalidArgumentException(option,argv[i]);
5358 if (LocaleCompare(
"list",option+1) == 0)
5366 if (i == (ssize_t) argc)
5367 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5368 list=ParseCommandOption(MagickListOptions,MagickFalse,argv[i]);
5370 ThrowMogrifyException(OptionError,
"UnrecognizedListType",argv[i]);
5371 status=MogrifyImageInfo(image_info,(
int) (i-j+1),(
const char **)
5373 return(status == 0 ? MagickFalse : MagickTrue);
5375 if (LocaleCompare(
"log",option+1) == 0)
5380 if ((i == (ssize_t) argc) ||
5381 (strchr(argv[i],
'%') == (
char *) NULL))
5382 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5385 if (LocaleCompare(
"loop",option+1) == 0)
5390 if (i == (ssize_t) argc)
5391 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5392 if (IsGeometry(argv[i]) == MagickFalse)
5393 ThrowMogrifyInvalidArgumentException(option,argv[i]);
5396 ThrowMogrifyException(OptionError,
"UnrecognizedOption",option)
5400 if (LocaleCompare(
"magnify",option+1) == 0)
5402 if (LocaleCompare(
"map",option+1) == 0)
5404 global_colormap=(*option ==
'+') ? MagickTrue : MagickFalse;
5408 if (i == (ssize_t) argc)
5409 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5412 if (LocaleCompare(
"mask",option+1) == 0)
5417 if (i == (ssize_t) argc)
5418 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5421 if (LocaleCompare(
"matte",option+1) == 0)
5423 if (LocaleCompare(
"mattecolor",option+1) == 0)
5428 if (i == (ssize_t) argc)
5429 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5432 if (LocaleCompare(
"maximum",option+1) == 0)
5434 if (LocaleCompare(
"mean-shift",option+1) == 0)
5439 if (i == (ssize_t) argc)
5440 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5441 if (IsGeometry(argv[i]) == MagickFalse)
5442 ThrowMogrifyInvalidArgumentException(option,argv[i]);
5445 if (LocaleCompare(
"median",option+1) == 0)
5450 if (i == (ssize_t) argc)
5451 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5452 if (IsGeometry(argv[i]) == MagickFalse)
5453 ThrowMogrifyInvalidArgumentException(option,argv[i]);
5456 if (LocaleCompare(
"metric",option+1) == 0)
5464 if (i == (ssize_t) argc)
5465 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5466 type=ParseCommandOption(MagickMetricOptions,MagickTrue,argv[i]);
5468 ThrowMogrifyException(OptionError,
"UnrecognizedMetricType",
5472 if (LocaleCompare(
"minimum",option+1) == 0)
5474 if (LocaleCompare(
"modulate",option+1) == 0)
5479 if (i == (ssize_t) argc)
5480 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5481 if (IsGeometry(argv[i]) == MagickFalse)
5482 ThrowMogrifyInvalidArgumentException(option,argv[i]);
5485 if (LocaleCompare(
"mode",option+1) == 0)
5490 if (i == (ssize_t) argc)
5491 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5492 if (IsGeometry(argv[i]) == MagickFalse)
5493 ThrowMogrifyInvalidArgumentException(option,argv[i]);
5496 if (LocaleCompare(
"monitor",option+1) == 0)
5498 if (LocaleCompare(
"monochrome",option+1) == 0)
5500 if (LocaleCompare(
"morph",option+1) == 0)
5505 if (i == (ssize_t) argc)
5506 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5507 if (IsGeometry(argv[i]) == MagickFalse)
5508 ThrowMogrifyInvalidArgumentException(option,argv[i]);
5511 if (LocaleCompare(
"morphology",option+1) == 0)
5514 token[MagickPathExtent];
5523 if (i == (ssize_t) argc)
5524 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5525 (void) GetNextToken(argv[i],(
const char **) NULL,MagickPathExtent,
5527 op=ParseCommandOption(MagickMorphologyOptions,MagickFalse,token);
5529 ThrowMogrifyException(OptionError,
"UnrecognizedMorphologyMethod",
5532 if (i == (ssize_t) argc)
5533 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5534 kernel_info=AcquireKernelInfo(argv[i],exception);
5535 if (kernel_info == (KernelInfo *) NULL)
5536 ThrowMogrifyInvalidArgumentException(option,argv[i]);
5537 kernel_info=DestroyKernelInfo(kernel_info);
5540 if (LocaleCompare(
"mosaic",option+1) == 0)
5542 if (LocaleCompare(
"motion-blur",option+1) == 0)
5547 if (i == (ssize_t) argc)
5548 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5549 if (IsGeometry(argv[i]) == MagickFalse)
5550 ThrowMogrifyInvalidArgumentException(option,argv[i]);
5553 ThrowMogrifyException(OptionError,
"UnrecognizedOption",option)
5557 if (LocaleCompare(
"negate",option+1) == 0)
5559 if (LocaleCompare(
"noise",option+1) == 0)
5562 if (i == (ssize_t) argc)
5563 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5569 noise=ParseCommandOption(MagickNoiseOptions,MagickFalse,
5572 ThrowMogrifyException(OptionError,
"UnrecognizedNoiseType",
5576 if (IsGeometry(argv[i]) == MagickFalse)
5577 ThrowMogrifyInvalidArgumentException(option,argv[i]);
5580 if (LocaleCompare(
"noop",option+1) == 0)
5582 if (LocaleCompare(
"normalize",option+1) == 0)
5584 ThrowMogrifyException(OptionError,
"UnrecognizedOption",option)
5588 if (LocaleCompare(
"opaque",option+1) == 0)
5591 if (i == (ssize_t) argc)
5592 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5595 if (LocaleCompare(
"ordered-dither",option+1) == 0)
5600 if (i == (ssize_t) argc)
5601 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5604 if (LocaleCompare(
"orient",option+1) == 0)
5609 orientation=UndefinedOrientation;
5613 if (i == (ssize_t) argc)
5614 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5615 orientation=ParseCommandOption(MagickOrientationOptions,MagickFalse,
5617 if (orientation < 0)
5618 ThrowMogrifyException(OptionError,
"UnrecognizedImageOrientation",
5622 ThrowMogrifyException(OptionError,
"UnrecognizedOption",option)
5626 if (LocaleCompare(
"page",option+1) == 0)
5631 if (i == (ssize_t) argc)
5632 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5635 if (LocaleCompare(
"paint",option+1) == 0)
5640 if (i == (ssize_t) argc)
5641 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5642 if (IsGeometry(argv[i]) == MagickFalse)
5643 ThrowMogrifyInvalidArgumentException(option,argv[i]);
5646 if (LocaleCompare(
"path",option+1) == 0)
5648 (void) CloneString(&path,(
char *) NULL);
5652 if (i == (ssize_t) argc)
5653 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5654 (void) CloneString(&path,argv[i]);
5657 if (LocaleCompare(
"perceptible",option+1) == 0)
5662 if (i == (ssize_t) argc)
5663 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5664 if (IsGeometry(argv[i]) == MagickFalse)
5665 ThrowMogrifyInvalidArgumentException(option,argv[i]);
5668 if (LocaleCompare(
"pointsize",option+1) == 0)
5673 if (i == (ssize_t) argc)
5674 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5675 if (IsGeometry(argv[i]) == MagickFalse)
5676 ThrowMogrifyInvalidArgumentException(option,argv[i]);
5679 if (LocaleCompare(
"polaroid",option+1) == 0)
5684 if (i == (ssize_t) argc)
5685 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5686 if (IsGeometry(argv[i]) == MagickFalse)
5687 ThrowMogrifyInvalidArgumentException(option,argv[i]);
5690 if (LocaleCompare(
"poly",option+1) == 0)
5695 if (i == (ssize_t) argc)
5696 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5697 if (IsGeometry(argv[i]) == MagickFalse)
5698 ThrowMogrifyInvalidArgumentException(option,argv[i]);
5701 if (LocaleCompare(
"posterize",option+1) == 0)
5706 if (i == (ssize_t) argc)
5707 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5708 if (IsGeometry(argv[i]) == MagickFalse)
5709 ThrowMogrifyInvalidArgumentException(option,argv[i]);
5712 if (LocaleCompare(
"precision",option+1) == 0)
5717 if (i == (ssize_t) argc)
5718 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5719 if (IsGeometry(argv[i]) == MagickFalse)
5720 ThrowMogrifyInvalidArgumentException(option,argv[i]);
5723 if (LocaleCompare(
"print",option+1) == 0)
5728 if (i == (ssize_t) argc)
5729 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5732 if (LocaleCompare(
"process",option+1) == 0)
5737 if (i == (ssize_t) argc)
5738 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5741 if (LocaleCompare(
"profile",option+1) == 0)
5744 if (i == (ssize_t) argc)
5745 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5748 ThrowMogrifyException(OptionError,
"UnrecognizedOption",option)
5752 if (LocaleCompare(
"quality",option+1) == 0)
5757 if (i == (ssize_t) argc)
5758 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5759 if (IsGeometry(argv[i]) == MagickFalse)
5760 ThrowMogrifyInvalidArgumentException(option,argv[i]);
5763 if (LocaleCompare(
"quantize",option+1) == 0)
5771 if (i == (ssize_t) argc)
5772 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5773 colorspace=ParseCommandOption(MagickColorspaceOptions,MagickFalse,
5776 ThrowMogrifyException(OptionError,
"UnrecognizedColorspace",
5780 if (LocaleCompare(
"quiet",option+1) == 0)
5782 ThrowMogrifyException(OptionError,
"UnrecognizedOption",option)
5786 if (LocaleCompare(
"rotational-blur",option+1) == 0)
5789 if (i == (ssize_t) argc)
5790 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5791 if (IsGeometry(argv[i]) == MagickFalse)
5792 ThrowMogrifyInvalidArgumentException(option,argv[i]);
5795 if (LocaleCompare(
"raise",option+1) == 0)
5798 if (i == (ssize_t) argc)
5799 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5800 if (IsGeometry(argv[i]) == MagickFalse)
5801 ThrowMogrifyInvalidArgumentException(option,argv[i]);
5804 if (LocaleCompare(
"random-threshold",option+1) == 0)
5809 if (i == (ssize_t) argc)
5810 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5811 if (IsGeometry(argv[i]) == MagickFalse)
5812 ThrowMogrifyInvalidArgumentException(option,argv[i]);
5815 if (LocaleCompare(
"range-threshold",option+1) == 0)
5820 if (i == (ssize_t) argc)
5821 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5822 if (IsGeometry(argv[i]) == MagickFalse)
5823 ThrowMogrifyInvalidArgumentException(option,argv[i]);
5826 if (LocaleCompare(
"read-mask",option+1) == 0)
5831 if (i == (ssize_t) argc)
5832 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5835 if (LocaleCompare(
"red-primary",option+1) == 0)
5840 if (i == (ssize_t) argc)
5841 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5842 if (IsGeometry(argv[i]) == MagickFalse)
5843 ThrowMogrifyInvalidArgumentException(option,argv[i]);
5845 if (LocaleCompare(
"regard-warnings",option+1) == 0)
5847 if (LocaleCompare(
"region",option+1) == 0)
5852 if (i == (ssize_t) argc)
5853 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5854 if (IsGeometry(argv[i]) == MagickFalse)
5855 ThrowMogrifyInvalidArgumentException(option,argv[i]);
5858 if (LocaleCompare(
"remap",option+1) == 0)
5863 if (i == (ssize_t) argc)
5864 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5867 if (LocaleCompare(
"render",option+1) == 0)
5869 if (LocaleCompare(
"repage",option+1) == 0)
5874 if (i == (ssize_t) argc)
5875 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5876 if (IsGeometry(argv[i]) == MagickFalse)
5877 ThrowMogrifyInvalidArgumentException(option,argv[i]);
5880 if (LocaleCompare(
"resample",option+1) == 0)
5885 if (i == (ssize_t) argc)
5886 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5887 if (IsGeometry(argv[i]) == MagickFalse)
5888 ThrowMogrifyInvalidArgumentException(option,argv[i]);
5891 if (LocaleCompare(
"reshape",option+1) == 0)
5896 if (i == (ssize_t) argc)
5897 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5898 if (IsGeometry(argv[i]) == MagickFalse)
5899 ThrowMogrifyInvalidArgumentException(option,argv[i]);
5902 if (LocaleCompare(
"resize",option+1) == 0)
5907 if (i == (ssize_t) argc)
5908 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5909 if (IsGeometry(argv[i]) == MagickFalse)
5910 ThrowMogrifyInvalidArgumentException(option,argv[i]);
5913 if ((LocaleNCompare(
"respect-parentheses",option+1,17) == 0) ||
5914 (LocaleNCompare(
"respect-parenthesis",option+1,17) == 0))
5916 respect_parentheses=(*option ==
'-') ? MagickTrue : MagickFalse;
5919 if (LocaleCompare(
"reverse",option+1) == 0)
5921 if (LocaleCompare(
"roll",option+1) == 0)
5926 if (i == (ssize_t) argc)
5927 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5928 if (IsGeometry(argv[i]) == MagickFalse)
5929 ThrowMogrifyInvalidArgumentException(option,argv[i]);
5932 if (LocaleCompare(
"rotate",option+1) == 0)
5935 if (i == (ssize_t) argc)
5936 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5937 if (IsGeometry(argv[i]) == MagickFalse)
5938 ThrowMogrifyInvalidArgumentException(option,argv[i]);
5941 ThrowMogrifyException(OptionError,
"UnrecognizedOption",option)
5945 if (LocaleCompare(
"sample",option+1) == 0)
5950 if (i == (ssize_t) argc)
5951 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5952 if (IsGeometry(argv[i]) == MagickFalse)
5953 ThrowMogrifyInvalidArgumentException(option,argv[i]);
5956 if (LocaleCompare(
"sampling-factor",option+1) == 0)
5961 if (i == (ssize_t) argc)
5962 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5963 if (IsGeometry(argv[i]) == MagickFalse)
5964 ThrowMogrifyInvalidArgumentException(option,argv[i]);
5967 if (LocaleCompare(
"scale",option+1) == 0)
5972 if (i == (ssize_t) argc)
5973 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5974 if (IsGeometry(argv[i]) == MagickFalse)
5975 ThrowMogrifyInvalidArgumentException(option,argv[i]);
5978 if (LocaleCompare(
"scene",option+1) == 0)
5983 if (i == (ssize_t) argc)
5984 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5985 if (IsGeometry(argv[i]) == MagickFalse)
5986 ThrowMogrifyInvalidArgumentException(option,argv[i]);
5989 if (LocaleCompare(
"seed",option+1) == 0)
5994 if (i == (ssize_t) argc)
5995 ThrowMogrifyException(OptionError,
"MissingArgument",option);
5996 if (IsGeometry(argv[i]) == MagickFalse)
5997 ThrowMogrifyInvalidArgumentException(option,argv[i]);
6000 if (LocaleCompare(
"segment",option+1) == 0)
6005 if (i == (ssize_t) argc)
6006 ThrowMogrifyException(OptionError,
"MissingArgument",option);
6007 if (IsGeometry(argv[i]) == MagickFalse)
6008 ThrowMogrifyInvalidArgumentException(option,argv[i]);
6011 if (LocaleCompare(
"selective-blur",option+1) == 0)
6014 if (i == (ssize_t) argc)
6015 ThrowMogrifyException(OptionError,
"MissingArgument",option);
6016 if (IsGeometry(argv[i]) == MagickFalse)
6017 ThrowMogrifyInvalidArgumentException(option,argv[i]);
6020 if (LocaleCompare(
"separate",option+1) == 0)
6022 if (LocaleCompare(
"sepia-tone",option+1) == 0)
6027 if (i == (ssize_t) argc)
6028 ThrowMogrifyException(OptionError,
"MissingArgument",option);
6029 if (IsGeometry(argv[i]) == MagickFalse)
6030 ThrowMogrifyInvalidArgumentException(option,argv[i]);
6033 if (LocaleCompare(
"set",option+1) == 0)
6036 if (i == (ssize_t) argc)
6037 ThrowMogrifyException(OptionError,
"MissingArgument",option);
6041 if (i == (ssize_t) argc)
6042 ThrowMogrifyException(OptionError,
"MissingArgument",option);
6045 if (LocaleCompare(
"shade",option+1) == 0)
6048 if (i == (ssize_t) argc)
6049 ThrowMogrifyException(OptionError,
"MissingArgument",option);
6050 if (IsGeometry(argv[i]) == MagickFalse)
6051 ThrowMogrifyInvalidArgumentException(option,argv[i]);
6054 if (LocaleCompare(
"shadow",option+1) == 0)
6059 if (i == (ssize_t) argc)
6060 ThrowMogrifyException(OptionError,
"MissingArgument",option);
6061 if (IsGeometry(argv[i]) == MagickFalse)
6062 ThrowMogrifyInvalidArgumentException(option,argv[i]);
6065 if (LocaleCompare(
"sharpen",option+1) == 0)
6068 if (i == (ssize_t) argc)
6069 ThrowMogrifyException(OptionError,
"MissingArgument",option);
6070 if (IsGeometry(argv[i]) == MagickFalse)
6071 ThrowMogrifyInvalidArgumentException(option,argv[i]);
6074 if (LocaleCompare(
"shave",option+1) == 0)
6079 if (i == (ssize_t) argc)
6080 ThrowMogrifyException(OptionError,
"MissingArgument",option);
6081 if (IsGeometry(argv[i]) == MagickFalse)
6082 ThrowMogrifyInvalidArgumentException(option,argv[i]);
6085 if (LocaleCompare(
"shear",option+1) == 0)
6088 if (i == (ssize_t) argc)
6089 ThrowMogrifyException(OptionError,
"MissingArgument",option);
6090 if (IsGeometry(argv[i]) == MagickFalse)
6091 ThrowMogrifyInvalidArgumentException(option,argv[i]);
6094 if (LocaleCompare(
"sigmoidal-contrast",option+1) == 0)
6097 if (i == (ssize_t) argc)
6098 ThrowMogrifyException(OptionError,
"MissingArgument",option);
6099 if (IsGeometry(argv[i]) == MagickFalse)
6100 ThrowMogrifyInvalidArgumentException(option,argv[i]);
6103 if (LocaleCompare(
"size",option+1) == 0)
6108 if (i == (ssize_t) argc)
6109 ThrowMogrifyException(OptionError,
"MissingArgument",option);
6110 if (IsGeometry(argv[i]) == MagickFalse)
6111 ThrowMogrifyInvalidArgumentException(option,argv[i]);
6114 if (LocaleCompare(
"sketch",option+1) == 0)
6119 if (i == (ssize_t) argc)
6120 ThrowMogrifyException(OptionError,
"MissingArgument",option);
6121 if (IsGeometry(argv[i]) == MagickFalse)
6122 ThrowMogrifyInvalidArgumentException(option,argv[i]);
6125 if (LocaleCompare(
"smush",option+1) == 0)
6128 if (i == (ssize_t) argc)
6129 ThrowMogrifyException(OptionError,
"MissingArgument",option);
6130 if (IsGeometry(argv[i]) == MagickFalse)
6131 ThrowMogrifyInvalidArgumentException(option,argv[i]);
6135 if (LocaleCompare(
"solarize",option+1) == 0)
6140 if (i == (ssize_t) argc)
6141 ThrowMogrifyException(OptionError,
"MissingArgument",option);
6142 if (IsGeometry(argv[i]) == MagickFalse)
6143 ThrowMogrifyInvalidArgumentException(option,argv[i]);
6146 if (LocaleCompare(
"sort",option+1) == 0)
6148 if (LocaleCompare(
"sparse-color",option+1) == 0)
6154 if (i == (ssize_t) argc)
6155 ThrowMogrifyException(OptionError,
"MissingArgument",option);
6156 op=ParseCommandOption(MagickSparseColorOptions,MagickFalse,argv[i]);
6158 ThrowMogrifyException(OptionError,
"UnrecognizedSparseColorMethod",
6161 if (i == (ssize_t) argc)
6162 ThrowMogrifyException(OptionError,
"MissingArgument",option);
6165 if (LocaleCompare(
"splice",option+1) == 0)
6170 if (i == (ssize_t) argc)
6171 ThrowMogrifyException(OptionError,
"MissingArgument",option);
6172 if (IsGeometry(argv[i]) == MagickFalse)
6173 ThrowMogrifyInvalidArgumentException(option,argv[i]);
6176 if (LocaleCompare(
"spread",option+1) == 0)
6181 if (i == (ssize_t) argc)
6182 ThrowMogrifyException(OptionError,
"MissingArgument",option);
6183 if (IsGeometry(argv[i]) == MagickFalse)
6184 ThrowMogrifyInvalidArgumentException(option,argv[i]);
6187 if (LocaleCompare(
"statistic",option+1) == 0)
6195 if (i == (ssize_t) argc)
6196 ThrowMogrifyException(OptionError,
"MissingArgument",option);
6197 op=ParseCommandOption(MagickStatisticOptions,MagickFalse,argv[i]);
6199 ThrowMogrifyException(OptionError,
"UnrecognizedStatisticType",
6202 if (i == (ssize_t) argc)
6203 ThrowMogrifyException(OptionError,
"MissingArgument",option);
6204 if (IsGeometry(argv[i]) == MagickFalse)
6205 ThrowMogrifyInvalidArgumentException(option,argv[i]);
6208 if (LocaleCompare(
"stretch",option+1) == 0)
6216 if (i == (ssize_t) argc)
6217 ThrowMogrifyException(OptionError,
"MissingArgument",option);
6218 stretch=ParseCommandOption(MagickStretchOptions,MagickFalse,
6221 ThrowMogrifyException(OptionError,
"UnrecognizedStyleType",
6225 if (LocaleCompare(
"strip",option+1) == 0)
6227 if (LocaleCompare(
"stroke",option+1) == 0)
6232 if (i == (ssize_t) argc)
6233 ThrowMogrifyException(OptionError,
"MissingArgument",option);
6236 if (LocaleCompare(
"strokewidth",option+1) == 0)
6241 if (i == (ssize_t) argc)
6242 ThrowMogrifyException(OptionError,
"MissingArgument",option);
6243 if (IsGeometry(argv[i]) == MagickFalse)
6244 ThrowMogrifyInvalidArgumentException(option,argv[i]);
6247 if (LocaleCompare(
"style",option+1) == 0)
6255 if (i == (ssize_t) argc)
6256 ThrowMogrifyException(OptionError,
"MissingArgument",option);
6257 style=ParseCommandOption(MagickStyleOptions,MagickFalse,argv[i]);
6259 ThrowMogrifyException(OptionError,
"UnrecognizedStyleType",
6263 if (LocaleCompare(
"swap",option+1) == 0)
6268 if (i == (ssize_t) argc)
6269 ThrowMogrifyException(OptionError,
"MissingArgument",option);
6270 if (IsGeometry(argv[i]) == MagickFalse)
6271 ThrowMogrifyInvalidArgumentException(option,argv[i]);
6274 if (LocaleCompare(
"swirl",option+1) == 0)
6279 if (i == (ssize_t) argc)
6280 ThrowMogrifyException(OptionError,
"MissingArgument",option);
6281 if (IsGeometry(argv[i]) == MagickFalse)
6282 ThrowMogrifyInvalidArgumentException(option,argv[i]);
6285 if (LocaleCompare(
"synchronize",option+1) == 0)
6287 ThrowMogrifyException(OptionError,
"UnrecognizedOption",option)
6291 if (LocaleCompare(
"taint",option+1) == 0)
6293 if (LocaleCompare(
"texture",option+1) == 0)
6298 if (i == (ssize_t) argc)
6299 ThrowMogrifyException(OptionError,
"MissingArgument",option);
6302 if (LocaleCompare(
"tile",option+1) == 0)
6307 if (i == (ssize_t) argc)
6308 ThrowMogrifyException(OptionError,
"MissingArgument",option);
6311 if (LocaleCompare(
"tile-offset",option+1) == 0)
6316 if (i == (ssize_t) argc)
6317 ThrowMogrifyException(OptionError,
"MissingArgument",option);
6318 if (IsGeometry(argv[i]) == MagickFalse)
6319 ThrowMogrifyInvalidArgumentException(option,argv[i]);
6322 if (LocaleCompare(
"tint",option+1) == 0)
6327 if (i == (ssize_t) argc)
6328 ThrowMogrifyException(OptionError,
"MissingArgument",option);
6329 if (IsGeometry(argv[i]) == MagickFalse)
6330 ThrowMogrifyInvalidArgumentException(option,argv[i]);
6333 if (LocaleCompare(
"transform",option+1) == 0)
6335 if (LocaleCompare(
"transpose",option+1) == 0)
6337 if (LocaleCompare(
"transverse",option+1) == 0)
6339 if (LocaleCompare(
"threshold",option+1) == 0)
6344 if (i == (ssize_t) argc)
6345 ThrowMogrifyException(OptionError,
"MissingArgument",option);
6346 if (IsGeometry(argv[i]) == MagickFalse)
6347 ThrowMogrifyInvalidArgumentException(option,argv[i]);
6350 if (LocaleCompare(
"thumbnail",option+1) == 0)
6355 if (i == (ssize_t) argc)
6356 ThrowMogrifyException(OptionError,
"MissingArgument",option);
6357 if (IsGeometry(argv[i]) == MagickFalse)
6358 ThrowMogrifyInvalidArgumentException(option,argv[i]);
6361 if (LocaleCompare(
"transparent",option+1) == 0)
6364 if (i == (ssize_t) argc)
6365 ThrowMogrifyException(OptionError,
"MissingArgument",option);
6368 if (LocaleCompare(
"transparent-color",option+1) == 0)
6373 if (i == (ssize_t) argc)
6374 ThrowMogrifyException(OptionError,
"MissingArgument",option);
6377 if (LocaleCompare(
"treedepth",option+1) == 0)
6382 if (i == (ssize_t) argc)
6383 ThrowMogrifyException(OptionError,
"MissingArgument",option);
6384 if (IsGeometry(argv[i]) == MagickFalse)
6385 ThrowMogrifyInvalidArgumentException(option,argv[i]);
6388 if (LocaleCompare(
"trim",option+1) == 0)
6390 if (LocaleCompare(
"type",option+1) == 0)
6398 if (i == (ssize_t) argc)
6399 ThrowMogrifyException(OptionError,
"MissingArgument",option);
6400 type=ParseCommandOption(MagickTypeOptions,MagickFalse,argv[i]);
6402 ThrowMogrifyException(OptionError,
"UnrecognizedImageType",
6406 ThrowMogrifyException(OptionError,
"UnrecognizedOption",option)
6410 if (LocaleCompare(
"undercolor",option+1) == 0)
6415 if (i == (ssize_t) argc)
6416 ThrowMogrifyException(OptionError,
"MissingArgument",option);
6419 if (LocaleCompare(
"unique-colors",option+1) == 0)
6421 if (LocaleCompare(
"units",option+1) == 0)
6429 if (i == (ssize_t) argc)
6430 ThrowMogrifyException(OptionError,
"MissingArgument",option);
6431 units=ParseCommandOption(MagickResolutionOptions,MagickFalse,
6434 ThrowMogrifyException(OptionError,
"UnrecognizedUnitsType",
6438 if (LocaleCompare(
"unsharp",option+1) == 0)
6441 if (i == (ssize_t) argc)
6442 ThrowMogrifyException(OptionError,
"MissingArgument",option);
6443 if (IsGeometry(argv[i]) == MagickFalse)
6444 ThrowMogrifyInvalidArgumentException(option,argv[i]);
6447 ThrowMogrifyException(OptionError,
"UnrecognizedOption",option)
6451 if (LocaleCompare(
"verbose",option+1) == 0)
6453 image_info->verbose=(*option ==
'-') ? MagickTrue : MagickFalse;
6456 if ((LocaleCompare(
"version",option+1) == 0) ||
6457 (LocaleCompare(
"-version",option+1) == 0))
6459 ListMagickVersion(stdout);
6462 if (LocaleCompare(
"vignette",option+1) == 0)
6467 if (i == (ssize_t) argc)
6468 ThrowMogrifyException(OptionError,
"MissingArgument",option);
6469 if (IsGeometry(argv[i]) == MagickFalse)
6470 ThrowMogrifyInvalidArgumentException(option,argv[i]);
6473 if (LocaleCompare(
"virtual-pixel",option+1) == 0)
6481 if (i == (ssize_t) argc)
6482 ThrowMogrifyException(OptionError,
"MissingArgument",option);
6483 method=ParseCommandOption(MagickVirtualPixelOptions,MagickFalse,
6486 ThrowMogrifyException(OptionError,
6487 "UnrecognizedVirtualPixelMethod",argv[i]);
6490 ThrowMogrifyException(OptionError,
"UnrecognizedOption",option)
6494 if (LocaleCompare(
"wave",option+1) == 0)
6497 if (i == (ssize_t) argc)
6498 ThrowMogrifyException(OptionError,
"MissingArgument",option);
6499 if (IsGeometry(argv[i]) == MagickFalse)
6500 ThrowMogrifyInvalidArgumentException(option,argv[i]);
6503 if (LocaleCompare(
"wavelet-denoise",option+1) == 0)
6506 if (i == (ssize_t) argc)
6507 ThrowMogrifyException(OptionError,
"MissingArgument",option);
6508 if (IsGeometry(argv[i]) == MagickFalse)
6509 ThrowMogrifyInvalidArgumentException(option,argv[i]);
6512 if (LocaleCompare(
"weight",option+1) == 0)
6517 if (i == (ssize_t) argc)
6518 ThrowMogrifyException(OptionError,
"MissingArgument",option);
6521 if (LocaleCompare(
"word-break",option+1) == 0)
6529 if (i == (ssize_t) argc)
6530 ThrowMogrifyException(OptionError,
"MissingArgument",option);
6531 word_break=ParseCommandOption(MagickWordBreakOptions,MagickFalse,
6534 ThrowMogrifyException(OptionError,
"UnrecognizedArgument",argv[i]);
6537 if (LocaleCompare(
"white-balance",option+1) == 0)
6539 if (LocaleCompare(
"white-point",option+1) == 0)
6544 if (i == (ssize_t) argc)
6545 ThrowMogrifyException(OptionError,
"MissingArgument",option);
6546 if (IsGeometry(argv[i]) == MagickFalse)
6547 ThrowMogrifyInvalidArgumentException(option,argv[i]);
6550 if (LocaleCompare(
"white-threshold",option+1) == 0)
6555 if (i == (ssize_t) argc)
6556 ThrowMogrifyException(OptionError,
"MissingArgument",option);
6557 if (IsGeometry(argv[i]) == MagickFalse)
6558 ThrowMogrifyInvalidArgumentException(option,argv[i]);
6561 if (LocaleCompare(
"write",option+1) == 0)
6564 if (i == (ssize_t) argc)
6565 ThrowMogrifyException(OptionError,
"MissingArgument",option);
6568 if (LocaleCompare(
"write-mask",option+1) == 0)
6573 if (i == (ssize_t) argc)
6574 ThrowMogrifyException(OptionError,
"MissingArgument",option);
6577 ThrowMogrifyException(OptionError,
"UnrecognizedOption",option)
6582 ThrowMogrifyException(OptionError,
"UnrecognizedOption",option)
6584 fire=(GetCommandOptionFlags(MagickCommandOptions,MagickFalse,option) &
6585 FireOptionFlag) == 0 ? MagickFalse : MagickTrue;
6586 if (fire != MagickFalse)
6587 FireImageStack(MagickFalse,MagickTrue,MagickTrue);
6590 ThrowMogrifyException(OptionError,
"UnbalancedParenthesis",argv[i]);
6591 if (i != (ssize_t) argc)
6592 ThrowMogrifyException(OptionError,
"MissingAnImageFilename",argv[i]);
6594 return(status != 0 ? MagickTrue : MagickFalse);
6629WandExport MagickBooleanType MogrifyImageInfo(ImageInfo *image_info,
6630 const int argc,
const char **argv,ExceptionInfo *exception)
6647 assert(image_info != (ImageInfo *) NULL);
6648 assert(image_info->signature == MagickCoreSignature);
6649 if (IsEventLogging() != MagickFalse)
6650 (void) LogMagickEvent(TraceEvent,GetMagickModule(),
"%s",
6651 image_info->filename);
6657 for (i=0; i < (ssize_t) argc; i++)
6660 if (IsCommandOption(option) == MagickFalse)
6662 count=ParseCommandOption(MagickCommandOptions,MagickFalse,option);
6663 count=MagickMax(count,0L);
6664 if ((i+count) >= (ssize_t) argc)
6666 switch (*(option+1))
6670 if (LocaleCompare(
"adjoin",option+1) == 0)
6672 image_info->adjoin=(*option ==
'-') ? MagickTrue : MagickFalse;
6675 if (LocaleCompare(
"antialias",option+1) == 0)
6677 image_info->antialias=(*option ==
'-') ? MagickTrue : MagickFalse;
6680 if (LocaleCompare(
"authenticate",option+1) == 0)
6683 (void) DeleteImageOption(image_info,option+1);
6685 (
void) SetImageOption(image_info,option+1,argv[i+1]);
6692 if (LocaleCompare(
"background",option+1) == 0)
6696 (void) DeleteImageOption(image_info,option+1);
6697 (void) QueryColorCompliance(MogrifyBackgroundColor,
6698 AllCompliance,&image_info->background_color,exception);
6701 (void) SetImageOption(image_info,option+1,argv[i+1]);
6702 (void) QueryColorCompliance(argv[i+1],AllCompliance,
6703 &image_info->background_color,exception);
6706 if (LocaleCompare(
"bias",option+1) == 0)
6710 (void) SetImageOption(image_info,
"convolve:bias",
"0.0");
6713 (void) SetImageOption(image_info,
"convolve:bias",argv[i+1]);
6716 if (LocaleCompare(
"black-point-compensation",option+1) == 0)
6720 (void) SetImageOption(image_info,option+1,
"false");
6723 (void) SetImageOption(image_info,option+1,
"true");
6726 if (LocaleCompare(
"blue-primary",option+1) == 0)
6730 (void) SetImageOption(image_info,option+1,
"0.0");
6733 (void) SetImageOption(image_info,option+1,argv[i+1]);
6736 if (LocaleCompare(
"bordercolor",option+1) == 0)
6740 (void) DeleteImageOption(image_info,option+1);
6741 (void) QueryColorCompliance(MogrifyBorderColor,AllCompliance,
6742 &image_info->border_color,exception);
6745 (void) QueryColorCompliance(argv[i+1],AllCompliance,
6746 &image_info->border_color,exception);
6747 (void) SetImageOption(image_info,option+1,argv[i+1]);
6750 if (LocaleCompare(
"box",option+1) == 0)
6754 (void) SetImageOption(image_info,
"undercolor",
"none");
6757 (void) SetImageOption(image_info,
"undercolor",argv[i+1]);
6764 if (LocaleCompare(
"cache",option+1) == 0)
6769 limit=MagickResourceInfinity;
6770 if (LocaleCompare(
"unlimited",argv[i+1]) != 0)
6771 limit=(MagickSizeType) SiPrefixToDoubleInterval(argv[i+1],
6773 (void) SetMagickResourceLimit(MemoryResource,limit);
6774 (void) SetMagickResourceLimit(MapResource,2*limit);
6777 if (LocaleCompare(
"caption",option+1) == 0)
6781 (void) DeleteImageOption(image_info,option+1);
6784 (void) SetImageOption(image_info,option+1,argv[i+1]);
6787 if (LocaleCompare(
"colorspace",option+1) == 0)
6791 image_info->colorspace=UndefinedColorspace;
6792 (void) SetImageOption(image_info,option+1,
"undefined");
6795 image_info->colorspace=(ColorspaceType) ParseCommandOption(
6796 MagickColorspaceOptions,MagickFalse,argv[i+1]);
6797 (void) SetImageOption(image_info,option+1,argv[i+1]);
6800 if (LocaleCompare(
"comment",option+1) == 0)
6804 (void) DeleteImageOption(image_info,option+1);
6807 (void) SetImageOption(image_info,option+1,argv[i+1]);
6810 if (LocaleCompare(
"compose",option+1) == 0)
6814 (void) SetImageOption(image_info,option+1,
"undefined");
6817 (void) SetImageOption(image_info,option+1,argv[i+1]);
6820 if (LocaleCompare(
"compress",option+1) == 0)
6824 image_info->compression=UndefinedCompression;
6825 (void) SetImageOption(image_info,option+1,
"undefined");
6828 image_info->compression=(CompressionType) ParseCommandOption(
6829 MagickCompressOptions,MagickFalse,argv[i+1]);
6830 (void) SetImageOption(image_info,option+1,argv[i+1]);
6837 if (LocaleCompare(
"debug",option+1) == 0)
6840 (void) SetLogEventMask(
"none");
6842 (
void) SetLogEventMask(argv[i+1]);
6843 image_info->debug=IsEventLogging();
6846 if (LocaleCompare(
"define",option+1) == 0)
6850 if (LocaleNCompare(argv[i+1],
"registry:",9) == 0)
6851 (void) DeleteImageRegistry(argv[i+1]+9);
6853 (
void) DeleteImageOption(image_info,argv[i+1]);
6856 if (LocaleNCompare(argv[i+1],
"registry:",9) == 0)
6858 (void) DefineImageRegistry(StringRegistryType,argv[i+1]+9,
6862 (void) DefineImageOption(image_info,argv[i+1]);
6865 if (LocaleCompare(
"delay",option+1) == 0)
6869 (void) SetImageOption(image_info,option+1,
"0");
6872 (void) SetImageOption(image_info,option+1,argv[i+1]);
6875 if (LocaleCompare(
"density",option+1) == 0)
6882 if (image_info->density != (
char *) NULL)
6883 image_info->density=DestroyString(image_info->density);
6884 (void) SetImageOption(image_info,option+1,
"72");
6887 (void) CloneString(&image_info->density,argv[i+1]);
6888 (void) SetImageOption(image_info,option+1,argv[i+1]);
6891 if (LocaleCompare(
"depth",option+1) == 0)
6895 image_info->depth=MAGICKCORE_QUANTUM_DEPTH;
6898 image_info->depth=StringToUnsignedLong(argv[i+1]);
6901 if (LocaleCompare(
"direction",option+1) == 0)
6905 (void) SetImageOption(image_info,option+1,
"undefined");
6908 (void) SetImageOption(image_info,option+1,argv[i+1]);
6911 if (LocaleCompare(
"display",option+1) == 0)
6915 if (image_info->server_name != (
char *) NULL)
6916 image_info->server_name=DestroyString(
6917 image_info->server_name);
6920 (void) CloneString(&image_info->server_name,argv[i+1]);
6923 if (LocaleCompare(
"dispose",option+1) == 0)
6927 (void) SetImageOption(image_info,option+1,
"undefined");
6930 (void) SetImageOption(image_info,option+1,argv[i+1]);
6933 if (LocaleCompare(
"dither",option+1) == 0)
6937 image_info->dither=MagickFalse;
6938 (void) SetImageOption(image_info,option+1,
"none");
6941 (void) SetImageOption(image_info,option+1,argv[i+1]);
6942 image_info->dither=MagickTrue;
6949 if (LocaleCompare(
"encoding",option+1) == 0)
6953 (void) SetImageOption(image_info,option+1,
"undefined");
6956 (void) SetImageOption(image_info,option+1,argv[i+1]);
6959 if (LocaleCompare(
"endian",option+1) == 0)
6963 image_info->endian=UndefinedEndian;
6964 (void) SetImageOption(image_info,option+1,
"undefined");
6967 image_info->endian=(EndianType) ParseCommandOption(
6968 MagickEndianOptions,MagickFalse,argv[i+1]);
6969 (void) SetImageOption(image_info,option+1,argv[i+1]);
6972 if (LocaleCompare(
"extract",option+1) == 0)
6979 if (image_info->extract != (
char *) NULL)
6980 image_info->extract=DestroyString(image_info->extract);
6983 (void) CloneString(&image_info->extract,argv[i+1]);
6990 if (LocaleCompare(
"family",option+1) == 0)
6993 (void) SetImageOption(image_info,option+1,argv[i+1]);
6996 if (LocaleCompare(
"fill",option+1) == 0)
7000 (void) SetImageOption(image_info,option+1,
"none");
7003 (void) SetImageOption(image_info,option+1,argv[i+1]);
7006 if (LocaleCompare(
"filter",option+1) == 0)
7010 (void) SetImageOption(image_info,option+1,
"undefined");
7013 (void) SetImageOption(image_info,option+1,argv[i+1]);
7016 if (LocaleCompare(
"font",option+1) == 0)
7020 if (image_info->font != (
char *) NULL)
7021 image_info->font=DestroyString(image_info->font);
7024 (void) CloneString(&image_info->font,argv[i+1]);
7027 if (LocaleCompare(
"format",option+1) == 0)
7029 (void) SetImageOption(image_info,option+1,argv[i+1]);
7032 if (LocaleCompare(
"fuzz",option+1) == 0)
7036 image_info->fuzz=0.0;
7037 (void) SetImageOption(image_info,option+1,
"0");
7040 image_info->fuzz=StringToDoubleInterval(argv[i+1],(
double)
7042 (void) SetImageOption(image_info,option+1,argv[i+1]);
7049 if (LocaleCompare(
"gravity",option+1) == 0)
7053 (void) SetImageOption(image_info,option+1,
"undefined");
7056 (void) SetImageOption(image_info,option+1,argv[i+1]);
7059 if (LocaleCompare(
"green-primary",option+1) == 0)
7063 (void) SetImageOption(image_info,option+1,
"0.0");
7066 (void) SetImageOption(image_info,option+1,argv[i+1]);
7073 if (LocaleCompare(
"intensity",option+1) == 0)
7077 (void) SetImageOption(image_info,option+1,
"undefined");
7080 (void) SetImageOption(image_info,option+1,argv[i+1]);
7083 if (LocaleCompare(
"intent",option+1) == 0)
7087 (void) SetImageOption(image_info,option+1,
"undefined");
7090 (void) SetImageOption(image_info,option+1,argv[i+1]);
7093 if (LocaleCompare(
"interlace",option+1) == 0)
7097 image_info->interlace=UndefinedInterlace;
7098 (void) SetImageOption(image_info,option+1,
"undefined");
7101 image_info->interlace=(InterlaceType) ParseCommandOption(
7102 MagickInterlaceOptions,MagickFalse,argv[i+1]);
7103 (void) SetImageOption(image_info,option+1,argv[i+1]);
7106 if (LocaleCompare(
"interline-spacing",option+1) == 0)
7110 (void) SetImageOption(image_info,option+1,
"undefined");
7113 (void) SetImageOption(image_info,option+1,argv[i+1]);
7116 if (LocaleCompare(
"interpolate",option+1) == 0)
7120 (void) SetImageOption(image_info,option+1,
"undefined");
7123 (void) SetImageOption(image_info,option+1,argv[i+1]);
7126 if (LocaleCompare(
"interword-spacing",option+1) == 0)
7130 (void) SetImageOption(image_info,option+1,
"undefined");
7133 (void) SetImageOption(image_info,option+1,argv[i+1]);
7140 if (LocaleCompare(
"kerning",option+1) == 0)
7144 (void) SetImageOption(image_info,option+1,
"undefined");
7147 (void) SetImageOption(image_info,option+1,argv[i+1]);
7154 if (LocaleCompare(
"label",option+1) == 0)
7158 (void) DeleteImageOption(image_info,option+1);
7161 (void) SetImageOption(image_info,option+1,argv[i+1]);
7164 if (LocaleCompare(
"limit",option+1) == 0)
7174 type=(ResourceType) ParseCommandOption(MagickResourceOptions,
7175 MagickFalse,argv[i+1]);
7176 limit=MagickResourceInfinity;
7177 if (LocaleCompare(
"unlimited",argv[i+2]) != 0)
7178 limit=(MagickSizeType) SiPrefixToDoubleInterval(argv[i+2],100.0);
7179 if (type == TimeResource)
7180 limit=(MagickSizeType) ParseMagickTimeToLive(argv[i+2]);
7181 (void) SetMagickResourceLimit(type,limit);
7184 if (LocaleCompare(
"list",option+1) == 0)
7192 list=ParseCommandOption(MagickListOptions,MagickFalse,argv[i+1]);
7195 case MagickCoderOptions:
7197 (void) ListCoderInfo((FILE *) NULL,exception);
7200 case MagickColorOptions:
7202 (void) ListColorInfo((FILE *) NULL,exception);
7205 case MagickConfigureOptions:
7207 (void) ListConfigureInfo((FILE *) NULL,exception);
7210 case MagickDelegateOptions:
7212 (void) ListDelegateInfo((FILE *) NULL,exception);
7215 case MagickFontOptions:
7217 (void) ListTypeInfo((FILE *) NULL,exception);
7220 case MagickFormatOptions:
7222 (void) ListMagickInfo((FILE *) NULL,exception);
7225 case MagickLocaleOptions:
7227 (void) ListLocaleInfo((FILE *) NULL,exception);
7230 case MagickLogOptions:
7232 (void) ListLogInfo((FILE *) NULL,exception);
7235 case MagickMagicOptions:
7237 (void) ListMagicInfo((FILE *) NULL,exception);
7240 case MagickMimeOptions:
7242 (void) ListMimeInfo((FILE *) NULL,exception);
7245 case MagickModuleOptions:
7247 (void) ListModuleInfo((FILE *) NULL,exception);
7250 case MagickPagesizeOptions:
7252 (void) ListPagesizes((FILE *) NULL,exception);
7255 case MagickPolicyOptions:
7257 (void) ListPolicyInfo((FILE *) NULL,exception);
7260 case MagickResourceOptions:
7262 (void) ListMagickResourceInfo((FILE *) NULL,exception);
7265 case MagickThresholdOptions:
7267 (void) ListThresholdMaps((FILE *) NULL,exception);
7272 (void) ListCommandOptions((FILE *) NULL,(CommandOption) list,
7279 if (LocaleCompare(
"log",option+1) == 0)
7283 (void) SetLogFormat(argv[i+1]);
7286 if (LocaleCompare(
"loop",option+1) == 0)
7290 (void) SetImageOption(image_info,option+1,
"0");
7293 (void) SetImageOption(image_info,option+1,argv[i+1]);
7300 if (LocaleCompare(
"matte",option+1) == 0)
7304 (void) SetImageOption(image_info,option+1,
"false");
7307 (void) SetImageOption(image_info,option+1,
"true");
7310 if (LocaleCompare(
"mattecolor",option+1) == 0)
7314 (void) SetImageOption(image_info,option+1,argv[i+1]);
7315 (void) QueryColorCompliance(MogrifyAlphaColor,AllCompliance,
7316 &image_info->matte_color,exception);
7319 (void) SetImageOption(image_info,option+1,argv[i+1]);
7320 (void) QueryColorCompliance(argv[i+1],AllCompliance,
7321 &image_info->matte_color,exception);
7324 if (LocaleCompare(
"metric",option+1) == 0)
7327 (void) DeleteImageOption(image_info,option+1);
7329 (
void) SetImageOption(image_info,option+1,argv[i+1]);
7332 if (LocaleCompare(
"monitor",option+1) == 0)
7334 (void) SetImageInfoProgressMonitor(image_info,MonitorProgress,
7338 if (LocaleCompare(
"monochrome",option+1) == 0)
7340 image_info->monochrome=(*option ==
'-') ? MagickTrue : MagickFalse;
7347 if (LocaleCompare(
"orient",option+1) == 0)
7351 image_info->orientation=UndefinedOrientation;
7352 (void) SetImageOption(image_info,option+1,
"undefined");
7355 image_info->orientation=(OrientationType) ParseCommandOption(
7356 MagickOrientationOptions,MagickFalse,argv[i+1]);
7357 (void) SetImageOption(image_info,option+1,argv[i+1]);
7364 if (LocaleCompare(
"page",option+1) == 0)
7368 page[MagickPathExtent];
7381 (void) DeleteImageOption(image_info,option+1);
7382 (void) CloneString(&image_info->page,(
char *) NULL);
7385 (void) memset(&geometry,0,
sizeof(geometry));
7386 image_option=GetImageOption(image_info,
"page");
7387 if (image_option != (
const char *) NULL)
7388 flags=ParseAbsoluteGeometry(image_option,&geometry);
7389 canonical_page=GetPageGeometry(argv[i+1]);
7390 flags=ParseAbsoluteGeometry(canonical_page,&geometry);
7391 canonical_page=DestroyString(canonical_page);
7392 (void) FormatLocaleString(page,MagickPathExtent,
"%lux%lu",
7393 (
unsigned long) geometry.width,(
unsigned long) geometry.height);
7394 if (((flags & XValue) != 0) || ((flags & YValue) != 0))
7395 (void) FormatLocaleString(page,MagickPathExtent,
"%lux%lu%+ld%+ld",
7396 (
unsigned long) geometry.width,(
unsigned long) geometry.height,
7397 (
long) geometry.x,(
long) geometry.y);
7398 (void) SetImageOption(image_info,option+1,page);
7399 (void) CloneString(&image_info->page,page);
7402 if (LocaleCompare(
"ping",option+1) == 0)
7404 image_info->ping=(*option ==
'-') ? MagickTrue : MagickFalse;
7407 if (LocaleCompare(
"pointsize",option+1) == 0)
7410 geometry_info.rho=0.0;
7412 (
void) ParseGeometry(argv[i+1],&geometry_info);
7413 image_info->pointsize=geometry_info.rho;
7416 if (LocaleCompare(
"precision",option+1) == 0)
7418 (void) SetMagickPrecision(StringToInteger(argv[i+1]));
7425 if (LocaleCompare(
"quality",option+1) == 0)
7432 image_info->quality=UndefinedCompressionQuality;
7433 (void) SetImageOption(image_info,option+1,
"0");
7436 image_info->quality=StringToUnsignedLong(argv[i+1]);
7437 (void) SetImageOption(image_info,option+1,argv[i+1]);
7440 if (LocaleCompare(
"quiet",option+1) == 0)
7442 static WarningHandler
7443 warning_handler = (WarningHandler) NULL;
7450 warning_handler=SetWarningHandler(warning_handler);
7456 warning_handler=SetWarningHandler((WarningHandler) NULL);
7463 if (LocaleCompare(
"red-primary",option+1) == 0)
7467 (void) SetImageOption(image_info,option+1,
"0.0");
7470 (void) SetImageOption(image_info,option+1,argv[i+1]);
7477 if (LocaleCompare(
"sampling-factor",option+1) == 0)
7484 if (image_info->sampling_factor != (
char *) NULL)
7485 image_info->sampling_factor=DestroyString(
7486 image_info->sampling_factor);
7489 (void) CloneString(&image_info->sampling_factor,argv[i+1]);
7492 if (LocaleCompare(
"scene",option+1) == 0)
7499 image_info->scene=0;
7500 (void) SetImageOption(image_info,option+1,
"0");
7503 image_info->scene=StringToUnsignedLong(argv[i+1]);
7504 (void) SetImageOption(image_info,option+1,argv[i+1]);
7507 if (LocaleCompare(
"seed",option+1) == 0)
7514 seed=(
unsigned long) time((time_t *) NULL);
7515 SetRandomSecretKey(seed);
7518 seed=StringToUnsignedLong(argv[i+1]);
7519 SetRandomSecretKey(seed);
7522 if (LocaleCompare(
"size",option+1) == 0)
7526 if (image_info->size != (
char *) NULL)
7527 image_info->size=DestroyString(image_info->size);
7530 (void) CloneString(&image_info->size,argv[i+1]);
7533 if (LocaleCompare(
"stroke",option+1) == 0)
7537 (void) SetImageOption(image_info,option+1,
"none");
7540 (void) SetImageOption(image_info,option+1,argv[i+1]);
7543 if (LocaleCompare(
"strokewidth",option+1) == 0)
7546 (void) SetImageOption(image_info,option+1,
"0");
7548 (
void) SetImageOption(image_info,option+1,argv[i+1]);
7551 if (LocaleCompare(
"style",option+1) == 0)
7555 (void) SetImageOption(image_info,option+1,
"none");
7558 (void) SetImageOption(image_info,option+1,argv[i+1]);
7561 if (LocaleCompare(
"synchronize",option+1) == 0)
7565 image_info->synchronize=MagickFalse;
7568 image_info->synchronize=MagickTrue;
7575 if (LocaleCompare(
"taint",option+1) == 0)
7579 (void) SetImageOption(image_info,option+1,
"false");
7582 (void) SetImageOption(image_info,option+1,
"true");
7585 if (LocaleCompare(
"texture",option+1) == 0)
7589 if (image_info->texture != (
char *) NULL)
7590 image_info->texture=DestroyString(image_info->texture);
7593 (void) CloneString(&image_info->texture,argv[i+1]);
7596 if (LocaleCompare(
"tile-offset",option+1) == 0)
7599 (void) SetImageOption(image_info,option+1,
"0");
7601 (
void) SetImageOption(image_info,option+1,argv[i+1]);
7604 if (LocaleCompare(
"transparent-color",option+1) == 0)
7608 (void) QueryColorCompliance(
"none",AllCompliance,
7609 &image_info->transparent_color,exception);
7610 (void) SetImageOption(image_info,option+1,
"none");
7613 (void) QueryColorCompliance(argv[i+1],AllCompliance,
7614 &image_info->transparent_color,exception);
7615 (void) SetImageOption(image_info,option+1,argv[i+1]);
7618 if (LocaleCompare(
"type",option+1) == 0)
7622 image_info->type=UndefinedType;
7623 (void) SetImageOption(image_info,option+1,
"undefined");
7626 image_info->type=(ImageType) ParseCommandOption(MagickTypeOptions,
7627 MagickFalse,argv[i+1]);
7628 (void) SetImageOption(image_info,option+1,argv[i+1]);
7635 if (LocaleCompare(
"undercolor",option+1) == 0)
7638 (void) DeleteImageOption(image_info,option+1);
7640 (
void) SetImageOption(image_info,option+1,argv[i+1]);
7643 if (LocaleCompare(
"units",option+1) == 0)
7647 image_info->units=UndefinedResolution;
7648 (void) SetImageOption(image_info,option+1,
"undefined");
7651 image_info->units=(ResolutionType) ParseCommandOption(
7652 MagickResolutionOptions,MagickFalse,argv[i+1]);
7653 (void) SetImageOption(image_info,option+1,argv[i+1]);
7660 if (LocaleCompare(
"verbose",option+1) == 0)
7664 image_info->verbose=MagickFalse;
7667 image_info->verbose=MagickTrue;
7668 image_info->ping=MagickFalse;
7671 if (LocaleCompare(
"virtual-pixel",option+1) == 0)
7674 (void) SetImageOption(image_info,option+1,
"undefined");
7676 (
void) SetImageOption(image_info,option+1,argv[i+1]);
7683 if (LocaleCompare(
"weight",option+1) == 0)
7686 (void) SetImageOption(image_info,option+1,
"0");
7688 (
void) SetImageOption(image_info,option+1,argv[i+1]);
7691 if (LocaleCompare(
"white-point",option+1) == 0)
7694 (void) SetImageOption(image_info,option+1,
"0.0");
7696 (
void) SetImageOption(image_info,option+1,argv[i+1]);
7699 if (LocaleCompare(
"word-break",option+1) == 0)
7703 (void) SetImageOption(image_info,option+1,
"undefined");
7706 (void) SetImageOption(image_info,option+1,argv[i+1]);
7753WandExport MagickBooleanType MogrifyImageList(ImageInfo *image_info,
7754 const int argc,
const char **argv,Image **images,ExceptionInfo *exception)
7765 PixelInterpolateMethod
7781 assert(image_info != (ImageInfo *) NULL);
7782 assert(image_info->signature == MagickCoreSignature);
7783 assert(images != (Image **) NULL);
7784 assert((*images)->previous == (Image *) NULL);
7785 assert((*images)->signature == MagickCoreSignature);
7786 if (IsEventLogging() != MagickFalse)
7787 (void) LogMagickEvent(TraceEvent,GetMagickModule(),
"%s",
7788 (*images)->filename);
7789 if ((argc <= 0) || (*argv == (
char *) NULL))
7791 interpolate_method=UndefinedInterpolatePixel;
7792 mogrify_info=CloneImageInfo(image_info);
7793 quantize_info=AcquireQuantizeInfo(mogrify_info);
7795 for (i=0; i < (ssize_t) argc; i++)
7797 if (*images == (Image *) NULL)
7800 if (IsCommandOption(option) == MagickFalse)
7802 count=ParseCommandOption(MagickCommandOptions,MagickFalse,option);
7803 count=MagickMax(count,0L);
7804 if ((i+count) >= (ssize_t) argc)
7806 status=MogrifyImageInfo(mogrify_info,(
int) count+1,argv+i,exception);
7807 switch (*(option+1))
7811 if (LocaleCompare(
"affinity",option+1) == 0)
7813 (void) SyncImagesSettings(mogrify_info,*images,exception);
7816 (void) RemapImages(quantize_info,*images,(Image *) NULL,
7823 if (LocaleCompare(
"append",option+1) == 0)
7828 (void) SyncImagesSettings(mogrify_info,*images,exception);
7829 append_image=AppendImages(*images,*option ==
'-' ? MagickTrue :
7830 MagickFalse,exception);
7831 if (append_image == (Image *) NULL)
7836 *images=DestroyImageList(*images);
7837 *images=append_image;
7840 if (LocaleCompare(
"average",option+1) == 0)
7848 (void) SyncImagesSettings(mogrify_info,*images,exception);
7849 average_image=EvaluateImages(*images,MeanEvaluateOperator,
7851 if (average_image == (Image *) NULL)
7856 *images=DestroyImageList(*images);
7857 *images=average_image;
7864 if (LocaleCompare(
"channel-fx",option+1) == 0)
7869 (void) SyncImagesSettings(mogrify_info,*images,exception);
7870 channel_image=ChannelFxImage(*images,argv[i+1],exception);
7871 if (channel_image == (Image *) NULL)
7876 *images=DestroyImageList(*images);
7877 *images=channel_image;
7880 if (LocaleCompare(
"clut",option+1) == 0)
7886 (void) SyncImagesSettings(mogrify_info,*images,exception);
7887 image=RemoveFirstImageFromList(images);
7888 clut_image=RemoveFirstImageFromList(images);
7889 if (clut_image == (Image *) NULL)
7891 (void) ThrowMagickException(exception,GetMagickModule(),
7892 OptionError,
"ImageSequenceRequired",
"`%s'",option);
7893 image=DestroyImage(image);
7897 (void) ClutImage(image,clut_image,interpolate_method,exception);
7898 clut_image=DestroyImage(clut_image);
7899 *images=DestroyImageList(*images);
7903 if (LocaleCompare(
"coalesce",option+1) == 0)
7908 (void) SyncImagesSettings(mogrify_info,*images,exception);
7909 coalesce_image=CoalesceImages(*images,exception);
7910 if (coalesce_image == (Image *) NULL)
7915 *images=DestroyImageList(*images);
7916 *images=coalesce_image;
7919 if (LocaleCompare(
"combine",option+1) == 0)
7927 (void) SyncImagesSettings(mogrify_info,*images,exception);
7928 colorspace=(*images)->colorspace;
7929 if ((*images)->number_channels < GetImageListLength(*images))
7930 colorspace=sRGBColorspace;
7932 colorspace=(ColorspaceType) ParseCommandOption(
7933 MagickColorspaceOptions,MagickFalse,argv[i+1]);
7934 combine_image=CombineImages(*images,colorspace,exception);
7935 if (combine_image == (Image *) NULL)
7940 *images=DestroyImageList(*images);
7941 *images=combine_image;
7944 if (LocaleCompare(
"compare",option+1) == 0)
7961 (void) SyncImagesSettings(mogrify_info,*images,exception);
7962 image=RemoveFirstImageFromList(images);
7963 reconstruct_image=RemoveFirstImageFromList(images);
7964 if (reconstruct_image == (Image *) NULL)
7966 (void) ThrowMagickException(exception,GetMagickModule(),
7967 OptionError,
"ImageSequenceRequired",
"`%s'",option);
7968 image=DestroyImage(image);
7972 metric=UndefinedErrorMetric;
7973 option=GetImageOption(mogrify_info,
"metric");
7974 if (option != (
const char *) NULL)
7975 metric=(MetricType) ParseCommandOption(MagickMetricOptions,
7976 MagickFalse,option);
7977 difference_image=CompareImages(image,reconstruct_image,metric,
7978 &distortion,exception);
7979 if (difference_image == (Image *) NULL)
7981 reconstruct_image=DestroyImage(reconstruct_image);
7982 image=DestroyImage(image);
7983 if (*images != (Image *) NULL)
7984 *images=DestroyImageList(*images);
7985 *images=difference_image;
7988 if (LocaleCompare(
"complex",option+1) == 0)
7996 (void) SyncImageSettings(mogrify_info,*images,exception);
7997 op=(ComplexOperator) ParseCommandOption(MagickComplexOptions,
7998 MagickFalse,argv[i+1]);
7999 complex_images=ComplexImages(*images,op,exception);
8000 if (complex_images == (Image *) NULL)
8005 *images=DestroyImageList(*images);
8006 *images=complex_images;
8009 if (LocaleCompare(
"composite",option+1) == 0)
8029 (void) SyncImageSettings(mogrify_info,*images,exception);
8030 value=GetImageOption(mogrify_info,
"compose");
8031 if (value == (
const char *) NULL)
8032 compose=OverCompositeOp;
8034 compose=(CompositeOperator) ParseCommandOption(
8035 MagickComposeOptions,MagickFalse,value);
8038 clip_to_self=GetCompositeClipToSelf(compose);
8039 value=GetImageOption(mogrify_info,
"compose:clip-to-self");
8040 if (value != (
const char *) NULL)
8041 clip_to_self=IsStringTrue(value);
8042 value=GetImageOption(mogrify_info,
"compose:outside-overlay");
8043 if (value != (
const char *) NULL)
8044 clip_to_self=IsStringFalse(value);
8046 new_images=RemoveFirstImageFromList(images);
8047 source_image=RemoveFirstImageFromList(images);
8048 if (source_image == (Image *) NULL)
8050 (void) ThrowMagickException(exception,GetMagickModule(),
8051 OptionError,
"ImageSequenceRequired",
"`%s'",option);
8052 new_images=DestroyImage(new_images);
8058 if (source_image->geometry != (
char *) NULL)
8063 (void) ParseRegionGeometry(source_image,source_image->geometry,
8064 &resize_geometry,exception);
8065 if ((source_image->columns != resize_geometry.width) ||
8066 (source_image->rows != resize_geometry.height))
8071 resize_image=ResizeImage(source_image,resize_geometry.width,
8072 resize_geometry.height,source_image->filter,exception);
8073 if (resize_image != (Image *) NULL)
8075 source_image=DestroyImage(source_image);
8076 source_image=resize_image;
8080 SetGeometry(source_image,&geometry);
8081 (void) ParseAbsoluteGeometry(source_image->geometry,&geometry);
8082 GravityAdjustGeometry(new_images->columns,new_images->rows,
8083 new_images->gravity,&geometry);
8084 mask_image=RemoveFirstImageFromList(images);
8085 if (mask_image == (Image *) NULL)
8086 status&=(MagickStatusType) CompositeImage(new_images,source_image,
8087 compose,clip_to_self,geometry.x,geometry.y,exception);
8093 canvas_image=CloneImage(new_images,0,0,MagickTrue,exception);
8094 if (canvas_image == (Image *) NULL)
8098 case BlendCompositeOp:
8100 status&=(MagickStatusType) CompositeImage(new_images,
8101 source_image,compose,clip_to_self,geometry.x,geometry.y,
8103 status&=(MagickStatusType) CompositeImage(new_images,
8104 mask_image,CopyAlphaCompositeOp,MagickTrue,0,0,exception);
8107 case DisplaceCompositeOp:
8108 case DistortCompositeOp:
8110 status&=(MagickStatusType) CompositeImage(source_image,
8111 mask_image,CopyGreenCompositeOp,MagickTrue,0,0,exception);
8112 (void) SetImageColorspace(source_image,sRGBColorspace,
8114 status&=(MagickStatusType) CompositeImage(new_images,
8115 source_image,compose,clip_to_self,geometry.x,geometry.y,
8119 case SaliencyBlendCompositeOp:
8120 case SeamlessBlendCompositeOp:
8122 status&=(MagickStatusType) CompositeImage(source_image,
8123 mask_image,CopyAlphaCompositeOp,MagickTrue,0,0,exception);
8124 status&=(MagickStatusType) CompositeImage(new_images,
8125 source_image,compose,clip_to_self,geometry.x,geometry.y,
8134 clone_image=CloneImage(new_images,0,0,MagickTrue,exception);
8135 if (clone_image == (Image *) NULL)
8137 status&=(MagickStatusType) CompositeImage(new_images,
8138 source_image,compose,clip_to_self,geometry.x,geometry.y,
8140 status&=(MagickStatusType) CompositeImage(new_images,
8141 mask_image,CopyAlphaCompositeOp,MagickTrue,0,0,exception);
8142 status&=(MagickStatusType) CompositeImage(clone_image,
8143 new_images,OverCompositeOp,clip_to_self,0,0,exception);
8144 new_images=DestroyImageList(new_images);
8145 new_images=clone_image;
8151 case DisplaceCompositeOp:
8152 case DistortCompositeOp:
8154 status&=(MagickStatusType) CompositeImage(canvas_image,
8155 new_images,CopyCompositeOp,clip_to_self,0,0,exception);
8160 status&=(MagickStatusType) CompositeImage(canvas_image,
8161 new_images,OverCompositeOp,clip_to_self,0,0,exception);
8165 new_images=DestroyImageList(new_images);
8166 new_images=canvas_image;
8167 mask_image=DestroyImage(mask_image);
8169 source_image=DestroyImage(source_image);
8170 *images=DestroyImageList(*images);
8174 if (LocaleCompare(
"copy",option+1) == 0)
8188 (void) SyncImageSettings(mogrify_info,*images,exception);
8189 (void) ParsePageGeometry(*images,argv[i+2],&geometry,exception);
8190 offset.x=geometry.x;
8191 offset.y=geometry.y;
8192 source_image=(*images);
8193 if (source_image->next != (Image *) NULL)
8194 source_image=source_image->next;
8195 (void) ParsePageGeometry(source_image,argv[i+1],&geometry,
8197 status=CopyImagePixels(*images,source_image,&geometry,&offset,
8205 if (LocaleCompare(
"deconstruct",option+1) == 0)
8210 (void) SyncImagesSettings(mogrify_info,*images,exception);
8211 deconstruct_image=CompareImagesLayers(*images,CompareAnyLayer,
8213 if (deconstruct_image == (Image *) NULL)
8218 *images=DestroyImageList(*images);
8219 *images=deconstruct_image;
8222 if (LocaleCompare(
"delete",option+1) == 0)
8225 DeleteImages(images,
"-1",exception);
8227 DeleteImages(images,argv[i+1],exception);
8230 if (LocaleCompare(
"dither",option+1) == 0)
8234 quantize_info->dither_method=NoDitherMethod;
8237 quantize_info->dither_method=(DitherMethod) ParseCommandOption(
8238 MagickDitherOptions,MagickFalse,argv[i+1]);
8241 if (LocaleCompare(
"duplicate",option+1) == 0)
8247 duplicate_images=DuplicateImages(*images,1,
"-1",exception);
8256 number_duplicates=(size_t) StringToLong(argv[i+1]);
8257 p=strchr(argv[i+1],
',');
8258 if (p == (
const char *) NULL)
8259 duplicate_images=DuplicateImages(*images,number_duplicates,
8262 duplicate_images=DuplicateImages(*images,number_duplicates,
8265 AppendImageToList(images, duplicate_images);
8266 (void) SyncImagesSettings(mogrify_info,*images,exception);
8273 if (LocaleCompare(
"evaluate-sequence",option+1) == 0)
8278 MagickEvaluateOperator
8281 (void) SyncImageSettings(mogrify_info,*images,exception);
8282 op=(MagickEvaluateOperator) ParseCommandOption(
8283 MagickEvaluateOptions,MagickFalse,argv[i+1]);
8284 evaluate_image=EvaluateImages(*images,op,exception);
8285 if (evaluate_image == (Image *) NULL)
8290 *images=DestroyImageList(*images);
8291 *images=evaluate_image;
8298 if (LocaleCompare(
"fft",option+1) == 0)
8306 (void) SyncImageSettings(mogrify_info,*images,exception);
8307 fourier_image=ForwardFourierTransformImage(*images,*option ==
'-' ?
8308 MagickTrue : MagickFalse,exception);
8309 if (fourier_image == (Image *) NULL)
8311 *images=DestroyImageList(*images);
8312 *images=fourier_image;
8315 if (LocaleCompare(
"flatten",option+1) == 0)
8320 (void) SyncImagesSettings(mogrify_info,*images,exception);
8321 flatten_image=MergeImageLayers(*images,FlattenLayer,exception);
8322 if (flatten_image == (Image *) NULL)
8324 *images=DestroyImageList(*images);
8325 *images=flatten_image;
8328 if (LocaleCompare(
"fx",option+1) == 0)
8334 (void) SyncImagesSettings(mogrify_info,*images,exception);
8335 fx_image=FxImage(*images,argv[i+1],exception);
8336 if (fx_image == (Image *) NULL)
8341 *images=DestroyImageList(*images);
8349 if (LocaleCompare(
"hald-clut",option+1) == 0)
8355 (void) SyncImagesSettings(mogrify_info,*images,exception);
8356 image=RemoveFirstImageFromList(images);
8357 hald_image=RemoveFirstImageFromList(images);
8358 if (hald_image == (Image *) NULL)
8360 (void) ThrowMagickException(exception,GetMagickModule(),
8361 OptionError,
"ImageSequenceRequired",
"`%s'",option);
8362 image=DestroyImage(image);
8366 (void) HaldClutImage(image,hald_image,exception);
8367 hald_image=DestroyImage(hald_image);
8368 if (*images != (Image *) NULL)
8369 *images=DestroyImageList(*images);
8377 if (LocaleCompare(
"ift",option+1) == 0)
8387 (void) SyncImagesSettings(mogrify_info,*images,exception);
8388 magnitude_image=RemoveFirstImageFromList(images);
8389 phase_image=RemoveFirstImageFromList(images);
8390 if (phase_image == (Image *) NULL)
8392 (void) ThrowMagickException(exception,GetMagickModule(),
8393 OptionError,
"ImageSequenceRequired",
"`%s'",option);
8394 magnitude_image=DestroyImage(magnitude_image);
8398 fourier_image=InverseFourierTransformImage(magnitude_image,
8399 phase_image,*option ==
'-' ? MagickTrue : MagickFalse,exception);
8400 magnitude_image=DestroyImage(magnitude_image);
8401 phase_image=DestroyImage(phase_image);
8402 if (fourier_image == (Image *) NULL)
8404 if (*images != (Image *) NULL)
8405 *images=DestroyImageList(*images);
8406 *images=fourier_image;
8409 if (LocaleCompare(
"insert",option+1) == 0)
8417 index=(ssize_t) StringToLong(argv[i+1]);
8418 p=RemoveLastImageFromList(images);
8419 if (p == (Image *) NULL)
8421 (void) ThrowMagickException(exception,GetMagickModule(),
8422 OptionError,
"NoSuchImage",
"`%s'",argv[i+1]);
8428 PrependImageToList(images,q);
8430 if (index == (ssize_t) GetImageListLength(*images))
8431 AppendImageToList(images,q);
8434 q=GetImageFromList(*images,index-1);
8435 if (q == (Image *) NULL)
8438 (void) ThrowMagickException(exception,GetMagickModule(),
8439 OptionError,
"NoSuchImage",
"`%s'",argv[i+1]);
8443 InsertImageInList(&q,p);
8445 *images=GetFirstImageInList(q);
8448 if (LocaleCompare(
"interpolate",option+1) == 0)
8450 interpolate_method=(PixelInterpolateMethod) ParseCommandOption(
8451 MagickInterpolateOptions,MagickFalse,argv[i+1]);
8458 if (LocaleCompare(
"layers",option+1) == 0)
8466 (void) SyncImagesSettings(mogrify_info,*images,exception);
8467 layers=(Image *) NULL;
8468 method=(LayerMethod) ParseCommandOption(MagickLayerOptions,
8469 MagickFalse,argv[i+1]);
8474 layers=CoalesceImages(*images,exception);
8477 case CompareAnyLayer:
8478 case CompareClearLayer:
8479 case CompareOverlayLayer:
8482 layers=CompareImagesLayers(*images,method,exception);
8488 case TrimBoundsLayer:
8490 layers=MergeImageLayers(*images,method,exception);
8495 layers=DisposeImages(*images,exception);
8498 case OptimizeImageLayer:
8500 layers=OptimizeImageLayers(*images,exception);
8503 case OptimizePlusLayer:
8505 layers=OptimizePlusImageLayers(*images,exception);
8508 case OptimizeTransLayer:
8510 OptimizeImageTransparency(*images,exception);
8513 case RemoveDupsLayer:
8515 RemoveDuplicateLayers(images,exception);
8518 case RemoveZeroLayer:
8520 RemoveZeroDelayLayers(images,exception);
8528 layers=CoalesceImages(*images,exception);
8529 if (layers == (Image *) NULL)
8534 *images=DestroyImageList(*images);
8536 layers=OptimizeImageLayers(*images,exception);
8537 if (layers == (Image *) NULL)
8542 *images=DestroyImageList(*images);
8544 layers=(Image *) NULL;
8545 OptimizeImageTransparency(*images,exception);
8546 (void) RemapImages(quantize_info,*images,(Image *) NULL,
8550 case CompositeLayer:
8565 while (source != (Image *) NULL)
8567 source=GetNextImageInList(source);
8568 if ((source != (Image *) NULL) &&
8569 (LocaleCompare(source->magick,
"NULL") == 0))
8572 if (source != (Image *) NULL)
8574 if ((GetPreviousImageInList(source) == (Image *) NULL) ||
8575 (GetNextImageInList(source) == (Image *) NULL))
8576 source=(Image *) NULL;
8582 source=SplitImageList(source->previous);
8583 DeleteImageFromList(&source);
8586 if (source == (Image *) NULL)
8588 (void) ThrowMagickException(exception,GetMagickModule(),
8589 OptionError,
"MissingNullSeparator",
"layers Composite");
8596 SetGeometry(*images,&geometry);
8597 (void) ParseAbsoluteGeometry((*images)->geometry,&geometry);
8598 geometry.width=source->page.width != 0 ?
8599 source->page.width : source->columns;
8600 geometry.height=source->page.height != 0 ?
8601 source->page.height : source->rows;
8602 GravityAdjustGeometry((*images)->page.width != 0 ?
8603 (*images)->page.width : (*images)->columns,
8604 (*images)->page.height != 0 ? (*images)->page.height :
8605 (*images)->rows,(*images)->gravity,&geometry);
8606 compose=OverCompositeOp;
8607 option=GetImageOption(mogrify_info,
"compose");
8608 if (option != (
const char *) NULL)
8609 compose=(CompositeOperator) ParseCommandOption(
8610 MagickComposeOptions,MagickFalse,option);
8611 CompositeLayers(*images,compose,source,geometry.x,geometry.y,
8613 source=DestroyImageList(source);
8617 if (layers == (Image *) NULL)
8619 *images=DestroyImageList(*images);
8627 if (LocaleCompare(
"map",option+1) == 0)
8629 (void) SyncImagesSettings(mogrify_info,*images,exception);
8632 (void) RemapImages(quantize_info,*images,(Image *) NULL,
8639 if (LocaleCompare(
"maximum",option+1) == 0)
8647 (void) SyncImagesSettings(mogrify_info,*images,exception);
8648 maximum_image=EvaluateImages(*images,MaxEvaluateOperator,exception);
8649 if (maximum_image == (Image *) NULL)
8654 *images=DestroyImageList(*images);
8655 *images=maximum_image;
8658 if (LocaleCompare(
"minimum",option+1) == 0)
8666 (void) SyncImagesSettings(mogrify_info,*images,exception);
8667 minimum_image=EvaluateImages(*images,MinEvaluateOperator,exception);
8668 if (minimum_image == (Image *) NULL)
8673 *images=DestroyImageList(*images);
8674 *images=minimum_image;
8677 if (LocaleCompare(
"morph",option+1) == 0)
8682 (void) SyncImagesSettings(mogrify_info,*images,exception);
8683 morph_image=MorphImages(*images,StringToUnsignedLong(argv[i+1]),
8685 if (morph_image == (Image *) NULL)
8690 *images=DestroyImageList(*images);
8691 *images=morph_image;
8694 if (LocaleCompare(
"mosaic",option+1) == 0)
8699 (void) SyncImagesSettings(mogrify_info,*images,exception);
8700 mosaic_image=MergeImageLayers(*images,MosaicLayer,exception);
8701 if (mosaic_image == (Image *) NULL)
8706 *images=DestroyImageList(*images);
8707 *images=mosaic_image;
8714 if (LocaleCompare(
"poly",option+1) == 0)
8718 token[MagickPathExtent];
8738 (void) SyncImageSettings(mogrify_info,*images,exception);
8739 args=InterpretImageProperties(mogrify_info,*images,argv[i+1],
8741 if (args == (
char *) NULL)
8744 for (x=0; *p !=
'\0'; x++)
8746 (void) GetNextToken(p,&p,MagickPathExtent,token);
8748 (void) GetNextToken(p,&p,MagickPathExtent,token);
8750 number_arguments=(size_t) x;
8751 arguments=(
double *) AcquireQuantumMemory(number_arguments,
8752 sizeof(*arguments));
8753 if (arguments == (
double *) NULL)
8754 ThrowWandFatalException(ResourceLimitFatalError,
8755 "MemoryAllocationFailed",(*images)->filename);
8756 (void) memset(arguments,0,number_arguments*
8757 sizeof(*arguments));
8759 for (x=0; (x < (ssize_t) number_arguments) && (*p !=
'\0'); x++)
8761 (void) GetNextToken(p,&p,MagickPathExtent,token);
8763 (void) GetNextToken(p,&p,MagickPathExtent,token);
8764 arguments[x]=StringToDouble(token,(
char **) NULL);
8766 args=DestroyString(args);
8767 polynomial_image=PolynomialImage(*images,number_arguments >> 1,
8768 arguments,exception);
8769 arguments=(
double *) RelinquishMagickMemory(arguments);
8770 if (polynomial_image == (Image *) NULL)
8775 *images=DestroyImageList(*images);
8776 *images=polynomial_image;
8778 if (LocaleCompare(
"print",option+1) == 0)
8783 (void) SyncImagesSettings(mogrify_info,*images,exception);
8784 string=InterpretImageProperties(mogrify_info,*images,argv[i+1],
8786 if (
string == (
char *) NULL)
8788 (void) FormatLocaleFile(stdout,
"%s",
string);
8789 string=DestroyString(
string);
8791 if (LocaleCompare(
"process",option+1) == 0)
8800 (void) SyncImagesSettings(mogrify_info,*images,exception);
8801 arguments=StringToArgv(argv[i+1],&number_arguments);
8802 if ((arguments == (
char **) NULL) || (number_arguments == 1))
8804 if ((argc > 1) && (strchr(arguments[1],
'=') != (
char *) NULL))
8827 length=strlen(argv[i+1]);
8828 token=(
char *) NULL;
8829 if (~length >= (MagickPathExtent-1))
8830 token=(
char *) AcquireQuantumMemory(length+MagickPathExtent,
8832 if (token == (
char *) NULL)
8836 token_info=AcquireTokenInfo();
8837 token_status=Tokenizer(token_info,0,token,length,argument,
"",
8838 "=",
"\"",
'\0',&breaker,&next,"e);
8839 token_info=DestroyTokenInfo(token_info);
8840 if (token_status == 0)
8845 arg=(&(argument[next]));
8846 (void) InvokeDynamicImageFilter(token,&(*images),1,&arg,
8849 token=DestroyString(token);
8852 (void) SubstituteString(&arguments[1],
"-",
"");
8853 (void) InvokeDynamicImageFilter(arguments[1],&(*images),
8854 number_arguments-2,(
const char **) arguments+2,exception);
8855 for (j=0; j < number_arguments; j++)
8856 arguments[j]=DestroyString(arguments[j]);
8857 arguments=(
char **) RelinquishMagickMemory(arguments);
8864 if (LocaleCompare(
"reverse",option+1) == 0)
8866 ReverseImageList(images);
8873 if (LocaleCompare(
"smush",option+1) == 0)
8881 (void) SyncImagesSettings(mogrify_info,*images,exception);
8882 offset=(ssize_t) StringToLong(argv[i+1]);
8883 smush_image=SmushImages(*images,*option ==
'-' ? MagickTrue :
8884 MagickFalse,offset,exception);
8885 if (smush_image == (Image *) NULL)
8890 *images=DestroyImageList(*images);
8891 *images=smush_image;
8894 if (LocaleCompare(
"swap",option+1) == 0)
8916 flags=ParseGeometry(argv[i+1],&geometry_info);
8917 index=(ssize_t) geometry_info.rho;
8918 if ((flags & SigmaValue) != 0)
8919 swap_index=(ssize_t) geometry_info.sigma;
8921 p=GetImageFromList(*images,index);
8922 q=GetImageFromList(*images,swap_index);
8923 if ((p == (Image *) NULL) || (q == (Image *) NULL))
8925 (void) ThrowMagickException(exception,GetMagickModule(),
8926 OptionError,
"NoSuchImage",
"`%s'",(*images)->filename);
8932 u=CloneImage(p,0,0,MagickTrue,exception);
8933 if (u == (Image *) NULL)
8935 v=CloneImage(q,0,0,MagickTrue,exception);
8936 if (v == (Image *) NULL)
8941 ReplaceImageInList(&p,v);
8942 ReplaceImageInList(&q,u);
8943 *images=GetFirstImageInList(q);
8950 if (LocaleCompare(
"write",option+1) == 0)
8953 key[MagickPathExtent];
8961 (void) SyncImagesSettings(mogrify_info,*images,exception);
8962 (void) FormatLocaleString(key,MagickPathExtent,
"cache:%s",
8964 (void) DeleteImageRegistry(key);
8965 write_images=CloneImageList(*images,exception);
8966 write_info=CloneImageInfo(mogrify_info);
8967 status&=(MagickStatusType) WriteImages(write_info,write_images,
8968 argv[i+1],exception);
8969 write_info=DestroyImageInfo(write_info);
8970 write_images=DestroyImageList(write_images);
8980 quantize_info=DestroyQuantizeInfo(quantize_info);
8981 mogrify_info=DestroyImageInfo(mogrify_info);
8982 status&=(MagickStatusType) MogrifyImageInfo(image_info,argc,argv,exception);
8983 return(status != 0 ? MagickTrue : MagickFalse);
9023WandExport MagickBooleanType MogrifyImages(ImageInfo *image_info,
9024 const MagickBooleanType post,
const int argc,
const char **argv,
9025 Image **images,ExceptionInfo *exception)
9027#define MogrifyImageTag "Mogrify/Image"
9041 assert(image_info != (ImageInfo *) NULL);
9042 assert(image_info->signature == MagickCoreSignature);
9043 if (images == (Image **) NULL)
9044 return(MogrifyImage(image_info,argc,argv,images,exception));
9045 assert((*images)->previous == (Image *) NULL);
9046 assert((*images)->signature == MagickCoreSignature);
9047 if (IsEventLogging() != MagickFalse)
9048 (void) LogMagickEvent(TraceEvent,GetMagickModule(),
"%s",
9049 (*images)->filename);
9050 if ((argc <= 0) || (*argv == (
char *) NULL))
9052 (void) SetImageInfoProgressMonitor(image_info,(MagickProgressMonitor) NULL,
9056 (void) FormatLocaleFile(stderr,
"mogrify start %s %d (%s)\n",argv[0],argc,
9062 if (post == MagickFalse)
9063 status&=(MagickStatusType) MogrifyImageList(image_info,argc,argv,images,
9069 n=GetImageListLength(*images);
9073 (void) FormatLocaleFile(stderr,
"mogrify %ld of %ld\n",(
long)
9074 GetImageIndexInList(*images),(
long)GetImageListLength(*images));
9076 status&=(MagickStatusType) MogrifyImage(image_info,argc,argv,images,
9078 proceed=SetImageProgress(*images,MogrifyImageTag,(MagickOffsetType) i, n);
9079 if (proceed == MagickFalse)
9081 if ( (*images)->next == (Image *) NULL )
9083 *images=(*images)->next;
9086 assert( *images != (Image *) NULL );
9088 (void) FormatLocaleFile(stderr,
"mogrify end %ld of %ld\n",(
long)
9089 GetImageIndexInList(*images),(
long)GetImageListLength(*images));
9094 *images=GetFirstImageInList(*images);
9095 if (post != MagickFalse)
9096 status&=(MagickStatusType) MogrifyImageList(image_info,argc,argv,images,
9098 return(status != 0 ? MagickTrue : MagickFalse);