2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6 % DDDD IIIII SSSSS PPPP L AAA Y Y %
7 % D D I SS P P L A A Y Y %
8 % D D I SSS PPPP L AAAAA Y %
10 % DDDD IIIII SSSSS P LLLLL A A Y %
13 % Methods to Interactively Display and Edit an Image %
20 % Copyright 1999-2018 ImageMagick Studio LLC, a non-profit organization %
21 % dedicated to making software imaging solutions freely available. %
23 % You may not use this file except in compliance with the License. You may %
24 % obtain a copy of the License at %
26 % https://www.imagemagick.org/script/license.php %
28 % Unless required by applicable law or agreed to in writing, software %
29 % distributed under the License is distributed on an "AS IS" BASIS, %
30 % WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. %
31 % See the License for the specific language governing permissions and %
32 % limitations under the License. %
34 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
36 % Use the display program to display an image or image sequence on any X
44 #include "MagickWand/studio.h"
45 #include "MagickWand/MagickWand.h"
46 #include "MagickWand/mogrify-private.h"
47 #include "MagickCore/display-private.h"
48 #include "MagickCore/string-private.h"
51 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
55 + D i s p l a y I m a g e C o m m a n d %
59 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
61 % DisplayImageCommand() displays a sequence of images on any workstation
62 % display running an X server. Display first determines the hardware
63 % capabilities of the workstation. If the number of unique colors in an image
64 % is less than or equal to the number the workstation can support, the image
65 % is displayed in an X window. Otherwise the number of colors in the image is
66 % first reduced to match the color resolution of the workstation before it is
69 % This means that a continuous-tone 24 bits/pixel image can display on a 8
70 % bit pseudo-color device or monochrome device. In most instances the reduced
71 % color image closely resembles the original. Alternatively, a monochrome or
72 % pseudo-color image sequence can display on a continuous-tone 24 bits/pixels
75 % The format of the DisplayImageCommand method is:
77 % MagickBooleanType DisplayImageCommand(ImageInfo *image_info,int argc,
78 % char **argv,char **metadata,ExceptionInfo *exception)
80 % A description of each parameter follows:
82 % o image_info: the image info.
84 % o argc: the number of elements in the argument vector.
86 % o argv: A text array containing the command line arguments.
88 % o metadata: any metadata is returned here.
90 % o exception: return any errors or warnings in this structure.
94 static MagickBooleanType DisplayUsage(void)
102 "1 press to map or unmap the Command widget",
103 "2 press and drag to magnify a region of an image",
104 "3 press to load an image from a visual image directory",
109 "-debug events display copious debugging information",
110 "-help print program options",
111 "-list type print a list of supported option arguments",
112 "-log format format of debugging information",
113 "-version print version information",
118 "-auto-orient automagically orient image",
119 "-border geometry surround image with a border of color",
120 "-clip clip along the first path from the 8BIM profile",
121 "-clip-path id clip along a named path from the 8BIM profile",
122 "-colors value preferred number of colors in the image",
123 "-contrast enhance or reduce the image contrast",
124 "-crop geometry preferred size and location of the cropped image",
125 "-decipher filename convert cipher pixels to plain pixels",
126 "-deskew threshold straighten an image",
127 "-despeckle reduce the speckles within an image",
128 "-edge factor apply a filter to detect edges in the image",
129 "-enhance apply a digital filter to enhance a noisy image",
130 "-equalize perform histogram equalization to an image",
131 "-extract geometry extract area from image",
132 "-flip flip image in the vertical direction",
133 "-flop flop image in the horizontal direction",
134 "-frame geometry surround image with an ornamental border",
135 "-fuzz distance colors within this distance are considered equal",
136 "-gamma value level of gamma correction",
137 "-monochrome transform image to black and white",
138 "-negate replace every pixel with its complementary color",
139 "-normalize transform image to span the full range of colors",
140 "-raise value lighten/darken image edges to create a 3-D effect",
141 "-resample geometry change the resolution of an image",
142 "-resize geometry resize the image",
143 "-roll geometry roll an image vertically or horizontally",
144 "-rotate degrees apply Paeth rotation to the image",
145 "-sample geometry scale image with pixel sampling",
146 "-segment value segment an image",
147 "-sharpen geometry sharpen the image",
148 "-strip strip image of all profiles and comments",
149 "-threshold value threshold the image",
150 "-thumbnail geometry create a thumbnail of the image",
151 "-trim trim image edges",
156 "-alpha option on, activate, off, deactivate, set, opaque, copy",
157 " transparent, extract, background, or shape",
158 "-antialias remove pixel-aliasing",
159 "-authenticate password",
160 " decipher image with this password",
161 "-backdrop display image centered on a backdrop",
162 "-channel type apply option to select image channels",
163 "-colormap type Shared or Private",
164 "-colorspace type alternate image colorspace",
165 "-comment string annotate image with comment",
166 "-compress type type of pixel compression when writing the image",
167 "-define format:option",
168 " define one or more image format options",
169 "-delay value display the next image after pausing",
170 "-density geometry horizontal and vertical density of the image",
171 "-depth value image depth",
172 "-display server display image to this X server",
173 "-dispose method layer disposal method",
174 "-dither method apply error diffusion to image",
175 "-endian type endianness (MSB or LSB) of the image",
176 "-filter type use this filter when resizing an image",
177 "-format string output formatted image characteristics",
178 "-geometry geometry preferred size and location of the Image window",
179 "-gravity type horizontal and vertical backdrop placement",
180 "-identify identify the format and characteristics of the image",
181 "-immutable displayed image cannot be modified",
182 "-interlace type type of image interlacing scheme",
183 "-interpolate method pixel color interpolation method",
184 "-label string assign a label to an image",
185 "-limit type value pixel cache resource limit",
186 "-loop iterations loop images then exit",
187 "-map type display image using this Standard Colormap",
188 "-matte store matte channel if the image has one",
189 "-monitor monitor progress",
190 "-nostdin do not try to open stdin",
191 "-page geometry size and location of an image canvas",
192 "-profile filename add, delete, or apply an image profile",
193 "-quality value JPEG/MIFF/PNG compression level",
194 "-quantize colorspace reduce colors in this colorspace",
195 "-quiet suppress all warning messages",
196 "-regard-warnings pay attention to warning messages",
197 "-remote command execute a command in an remote display process",
198 "-repage geometry size and location of an image canvas (operator)",
199 "-respect-parentheses settings remain in effect until parenthesis boundary",
200 "-sampling-factor geometry",
201 " horizontal and vertical sampling factor",
202 "-scenes range image scene range",
203 "-seed value seed a new sequence of pseudo-random numbers",
204 "-set property value set an image property",
205 "-size geometry width and height of image",
206 "-support factor resize support: > 1.0 is blurry, < 1.0 is sharp",
207 "-texture filename name of texture to tile onto the image background",
208 "-transparent-color color",
209 " transparent color",
210 "-treedepth value color tree depth",
211 "-update seconds detect when image file is modified and redisplay",
212 "-verbose print detailed information about the image",
213 "-visual type display image using this visual type",
214 "-virtual-pixel method",
215 " virtual pixel access method",
216 "-window id display image to background of this window",
217 "-window-group id exit program when this window id is destroyed",
218 "-write filename write image to a file",
221 *sequence_operators[]=
223 "-coalesce merge a sequence of images",
224 "-flatten flatten a sequence of images",
228 ListMagickVersion(stdout);
229 (void) printf("Usage: %s [options ...] file [ [options ...] file ...]\n",
231 (void) printf("\nImage Settings:\n");
232 for (p=settings; *p != (char *) NULL; p++)
233 (void) printf(" %s\n",*p);
234 (void) printf("\nImage Operators:\n");
235 for (p=operators; *p != (char *) NULL; p++)
236 (void) printf(" %s\n",*p);
237 (void) printf("\nImage Sequence Operators:\n");
238 for (p=sequence_operators; *p != (char *) NULL; p++)
239 (void) printf(" %s\n",*p);
240 (void) printf("\nMiscellaneous Options:\n");
241 for (p=miscellaneous; *p != (char *) NULL; p++)
242 (void) printf(" %s\n",*p);
244 "\nIn addition to those listed above, you can specify these standard X\n");
246 "resources as command line options: -background, -bordercolor,\n");
248 " -mattecolor, -borderwidth, -font, -foreground, -iconGeometry,\n");
249 (void) printf("-iconic, -name, -shared-memory, -usePixmap, or -title.\n");
251 "\nBy default, the image format of 'file' is determined by its magic\n");
253 "number. To specify a particular image format, precede the filename\n");
255 "with an image format name and a colon (i.e. ps:image) or specify the\n");
257 "image type as the filename suffix (i.e. image.ps). Specify 'file' as\n");
258 (void) printf("'-' for standard input or output.\n");
259 (void) printf("\nButtons: \n");
260 for (p=buttons; *p != (char *) NULL; p++)
261 (void) printf(" %s\n",*p);
265 WandExport MagickBooleanType DisplayImageCommand(ImageInfo *image_info,
266 int argc,char **argv,char **wand_unused(metadata),ExceptionInfo *exception)
268 #if defined(MAGICKCORE_X11_DELEGATE)
269 #define DestroyDisplay() \
271 if ((state & ExitState) == 0) \
272 DestroyXResources(); \
273 if (display != (Display *) NULL) \
275 XCloseDisplay(display); \
276 display=(Display *) NULL; \
278 XDestroyResourceInfo(&resource_info); \
279 DestroyImageStack(); \
280 if (image_marker != (size_t *) NULL) \
281 image_marker=(size_t *) RelinquishMagickMemory(image_marker); \
282 for (i=0; i < (ssize_t) argc; i++) \
283 argv[i]=DestroyString(argv[i]); \
284 argv=(char **) RelinquishMagickMemory(argv); \
286 #define ThrowDisplayException(asperity,tag,option) \
288 (void) ThrowMagickException(exception,GetMagickModule(),asperity,tag,"`%s'", \
291 return(MagickFalse); \
293 #define ThrowDisplayInvalidArgumentException(option,argument) \
295 (void) ThrowMagickException(exception,GetMagickModule(),OptionError, \
296 "InvalidArgument","'%s': %s",option,argument); \
298 return(MagickFalse); \
315 image_stack[MaxImageStackDepth+1];
354 assert(image_info != (ImageInfo *) NULL);
355 assert(image_info->signature == MagickCoreSignature);
356 if (image_info->debug != MagickFalse)
357 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");
358 assert(exception != (ExceptionInfo *) NULL);
362 if ((LocaleCompare("version",option+1) == 0) ||
363 (LocaleCompare("-version",option+1) == 0))
365 ListMagickVersion(stdout);
370 display=(Display *) NULL;
373 image_marker=(size_t *) NULL;
377 option=(char *) NULL;
379 respect_parenthesis=MagickFalse;
381 resource_database=(XrmDatabase) NULL;
382 (void) memset(&resource_info,0,sizeof(resource_info));
383 server_name=(char *) NULL;
386 ReadCommandlLine(argc,&argv);
387 status=ExpandFilenames(&argc,&argv);
388 if (status == MagickFalse)
389 ThrowDisplayException(ResourceLimitError,"MemoryAllocationFailed",
390 GetExceptionMessage(errno));
391 image_marker=(size_t *) AcquireQuantumMemory((size_t) argc+1UL,
392 sizeof(*image_marker));
393 if (image_marker == (size_t *) NULL)
394 ThrowDisplayException(ResourceLimitError,"MemoryAllocationFailed",
395 GetExceptionMessage(errno));
396 for (i=0; i <= (ssize_t) argc; i++)
397 image_marker[i]=(size_t) argc;
399 Check for server name specified on the command line.
401 for (i=1; i < (ssize_t) argc; i++)
404 Check command line for server name.
407 if (IsCommandOption(option) == MagickFalse)
409 if (LocaleCompare("display",option+1) == 0)
412 User specified server name.
415 if (i == (ssize_t) argc)
416 ThrowDisplayException(OptionError,"MissingArgument",option);
419 if (LocaleCompare("nostdin",option+1) == 0)
421 if ((LocaleCompare("help",option+1) == 0) ||
422 (LocaleCompare("-help",option+1) == 0))
423 return(DisplayUsage());
426 Get user defaults from X resource database.
428 display=XOpenDisplay(server_name);
429 if (display == (Display *) NULL)
430 ThrowDisplayException(XServerError,"UnableToOpenXServer",
431 XDisplayName(server_name));
432 (void) XSetErrorHandler(XError);
433 resource_database=XGetResourceDatabase(display,GetClientName());
434 XGetResourceInfo(image_info,resource_database,GetClientName(),
436 quantize_info=resource_info.quantize_info;
437 image_info->density=XGetResourceInstance(resource_database,GetClientName(),
438 "density",(char *) NULL);
439 if (image_info->density == (char *) NULL)
440 image_info->density=XGetScreenDensity(display);
441 resource_value=XGetResourceInstance(resource_database,GetClientName(),
443 image_info->interlace=(InterlaceType)
444 ParseCommandOption(MagickInterlaceOptions,MagickFalse,resource_value);
445 image_info->page=XGetResourceInstance(resource_database,GetClientName(),
446 "pageGeometry",(char *) NULL);
447 resource_value=XGetResourceInstance(resource_database,GetClientName(),
449 image_info->quality=StringToUnsignedLong(resource_value);
450 resource_value=XGetResourceInstance(resource_database,GetClientName(),
452 image_info->verbose=IsStringTrue(resource_value);
453 resource_value=XGetResourceInstance(resource_database,GetClientName(),
455 quantize_info->dither_method=IsStringTrue(resource_value) != MagickFalse ?
456 RiemersmaDitherMethod : NoDitherMethod;
461 for (i=1; ((i <= (ssize_t) argc) && ((state & ExitState) == 0)); i++)
463 if (i < (ssize_t) argc)
466 if (image != (Image *) NULL)
469 if (isatty(STDIN_FILENO) != MagickFalse || (nostdin != MagickFalse))
473 if (LocaleCompare(option,"(") == 0)
475 FireImageStack(MagickFalse,MagickTrue,pend);
476 if (k == MaxImageStackDepth)
477 ThrowDisplayException(OptionError,"ParenthesisNestedTooDeeply",
482 if (LocaleCompare(option,")") == 0)
484 FireImageStack(MagickFalse,MagickTrue,MagickTrue);
486 ThrowDisplayException(OptionError,"UnableToParseExpression",option);
490 if (IsCommandOption(option) == MagickFalse)
501 Option is a file name.
503 FireImageStack(MagickFalse,MagickFalse,pend);
505 if ((LocaleCompare(filename,"--") == 0) && (i < (ssize_t) (argc-1)))
510 (void) CopyMagickString(image_info->filename,filename,MagickPathExtent);
511 images=ReadImage(image_info,exception);
512 CatchException(exception);
513 status&=(images != (Image *) NULL) &&
514 (exception->severity < ErrorException);
515 if (images == (Image *) NULL)
517 AppendImageStack(images);
518 FinalizeImageSettings(image_info,image,MagickFalse);
519 iterations=image->iterations;
520 image_list=CloneImageList(image,exception);
521 if (image_list == (Image *) NULL)
522 ThrowDisplayException(ResourceLimitError,"MemoryAllocationFailed",
523 GetExceptionMessage(errno));
524 display_image=image_list;
528 Transmogrify image as defined by the image processing options.
530 resource_info.quantum=1;
531 if (resource_info.window_id != (char *) NULL)
534 Display image to a specified X window.
536 status=XDisplayBackgroundImage(display,&resource_info,
537 display_image,exception);
538 if (status != MagickFalse)
540 state|=RetainColorsState;
543 if (GetNextImageInList(display_image) == (Image *) NULL)
553 Display image to X server.
555 if (resource_info.delay != 1)
556 display_image->delay=resource_info.delay;
557 nexus=XDisplayImage(display,&resource_info,argv,argc,
558 &display_image,&state,exception);
559 if (nexus == (Image *) NULL)
561 while ((nexus != (Image *) NULL) && ((state & ExitState) == 0))
566 if (nexus->montage != (char *) NULL)
569 User selected a visual directory image (montage).
574 next=XDisplayImage(display,&resource_info,argv,argc,&nexus,
576 if ((next == (Image *) NULL) &&
577 (GetNextImageInList(nexus) != (Image *) NULL))
579 display_image=GetNextImageInList(nexus);
580 nexus=NewImageList();
584 if (nexus != display_image)
585 nexus=DestroyImageList(nexus);
589 } while ((state & ExitState) == 0);
590 if (resource_info.write_filename != (char *) NULL)
595 (void) CopyMagickString(display_image->filename,
596 resource_info.write_filename,MagickPathExtent);
597 (void) SetImageInfo(image_info,1,exception);
598 status&=WriteImage(image_info,display_image,exception);
601 Proceed to next/previous image.
603 if ((state & FormerImageState) != 0)
604 for (l=0; l < (ssize_t) resource_info.quantum; l++)
606 if (GetPreviousImageInList(display_image) == (Image *) NULL)
608 display_image=GetPreviousImageInList(display_image);
611 for (l=0; l < (ssize_t) resource_info.quantum; l++)
613 if (GetNextImageInList(display_image) == (Image *) NULL)
615 display_image=GetNextImageInList(display_image);
617 if (l < (ssize_t) resource_info.quantum)
619 } while ((display_image != (Image *) NULL) && ((state & ExitState) == 0));
621 Free image resources.
623 display_image=DestroyImageList(display_image);
624 if ((state & FormerImageState) == 0)
626 last_image=(size_t) image_number;
627 image_marker[i]=(size_t) image_number++;
632 Proceed to previous image.
634 for (i--; i > 0; i--)
635 if (image_marker[i] == (size_t) (image_number-2))
639 if ((i == (ssize_t) argc) && ((state & ExitState) == 0))
641 if ((state & ExitState) != 0)
644 Determine if we should proceed to the first image.
646 if (image_number < 0)
648 if ((state & FormerImageState) != 0)
651 for (i=1; i < (ssize_t) (argc-2); i++)
652 if (last_image == image_marker[i])
654 image_number=(ssize_t) image_marker[i]+1;
658 if (resource_info.window_id != (char *) NULL)
662 if (++iteration == (ssize_t) iterations)
666 if (LocaleCompare(filename,"-") == 0)
668 RemoveAllImageStack();
671 pend=image != (Image *) NULL ? MagickTrue : MagickFalse;
676 if (LocaleCompare("alpha",option+1) == 0)
684 if (i == (ssize_t) argc)
685 ThrowDisplayException(OptionError,"MissingArgument",option);
686 type=ParseCommandOption(MagickAlphaChannelOptions,MagickFalse,
689 ThrowDisplayException(OptionError,
690 "UnrecognizedAlphaChannelOption",argv[i]);
693 if (LocaleCompare("antialias",option+1) == 0)
695 if (LocaleCompare("authenticate",option+1) == 0)
700 if (i == (ssize_t) argc)
701 ThrowDisplayException(OptionError,"MissingArgument",option);
704 if (LocaleCompare("auto-orient",option+1) == 0)
706 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
710 if (LocaleCompare("backdrop",option+1) == 0)
712 resource_info.backdrop=(*option == '-') ? MagickTrue : MagickFalse;
715 if (LocaleCompare("background",option+1) == 0)
720 if (i == (ssize_t) argc)
721 ThrowDisplayException(OptionError,"MissingArgument",option);
722 resource_info.background_color=argv[i];
725 if (LocaleCompare("border",option+1) == 0)
730 if (i == (ssize_t) argc)
731 ThrowDisplayException(OptionError,"MissingArgument",option);
732 if (IsGeometry(argv[i]) == MagickFalse)
733 ThrowDisplayInvalidArgumentException(option,argv[i]);
736 if (LocaleCompare("bordercolor",option+1) == 0)
741 if (i == (ssize_t) argc)
742 ThrowDisplayException(OptionError,"MissingArgument",option);
743 resource_info.border_color=argv[i];
746 if (LocaleCompare("borderwidth",option+1) == 0)
748 resource_info.border_width=0;
752 if (i == (ssize_t) argc)
753 ThrowDisplayException(OptionError,"MissingArgument",option);
754 if (IsGeometry(argv[i]) == MagickFalse)
755 ThrowDisplayInvalidArgumentException(option,argv[i]);
756 resource_info.border_width=(unsigned int)
757 StringToUnsignedLong(argv[i]);
760 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
764 if (LocaleCompare("cache",option+1) == 0)
769 if (i == (ssize_t) argc)
770 ThrowDisplayException(OptionError,"MissingArgument",option);
771 if (IsGeometry(argv[i]) == MagickFalse)
772 ThrowDisplayInvalidArgumentException(option,argv[i]);
775 if (LocaleCompare("channel",option+1) == 0)
783 if (i == (ssize_t) argc)
784 ThrowDisplayException(OptionError,"MissingArgument",option);
785 channel=ParseChannelOption(argv[i]);
787 ThrowDisplayException(OptionError,"UnrecognizedChannelType",
791 if (LocaleCompare("clip",option+1) == 0)
793 if (LocaleCompare("clip-path",option+1) == 0)
796 if (i == (ssize_t) argc)
797 ThrowDisplayException(OptionError,"MissingArgument",option);
800 if (LocaleCompare("coalesce",option+1) == 0)
802 if (LocaleCompare("colormap",option+1) == 0)
804 resource_info.colormap=PrivateColormap;
808 if (i == (ssize_t) argc)
809 ThrowDisplayException(OptionError,"MissingArgument",option);
810 resource_info.colormap=UndefinedColormap;
811 if (LocaleCompare("private",argv[i]) == 0)
812 resource_info.colormap=PrivateColormap;
813 if (LocaleCompare("shared",argv[i]) == 0)
814 resource_info.colormap=SharedColormap;
815 if (resource_info.colormap == UndefinedColormap)
816 ThrowDisplayException(OptionError,"UnrecognizedColormapType",
820 if (LocaleCompare("colors",option+1) == 0)
822 quantize_info->number_colors=0;
826 if (i == (ssize_t) argc)
827 ThrowDisplayException(OptionError,"MissingArgument",option);
828 if (IsGeometry(argv[i]) == MagickFalse)
829 ThrowDisplayInvalidArgumentException(option,argv[i]);
830 quantize_info->number_colors=StringToUnsignedLong(argv[i]);
833 if (LocaleCompare("colorspace",option+1) == 0)
841 if (i == (ssize_t) argc)
842 ThrowDisplayException(OptionError,"MissingArgument",option);
843 colorspace=ParseCommandOption(MagickColorspaceOptions,
844 MagickFalse,argv[i]);
846 ThrowDisplayException(OptionError,"UnrecognizedColorspace",
850 if (LocaleCompare("comment",option+1) == 0)
855 if (i == (ssize_t) argc)
856 ThrowDisplayException(OptionError,"MissingArgument",option);
859 if (LocaleCompare("compress",option+1) == 0)
867 if (i == (ssize_t) argc)
868 ThrowDisplayException(OptionError,"MissingArgument",option);
869 compress=ParseCommandOption(MagickCompressOptions,MagickFalse,
872 ThrowDisplayException(OptionError,"UnrecognizedImageCompression",
876 if (LocaleCompare("concurrent",option+1) == 0)
878 if (LocaleCompare("contrast",option+1) == 0)
880 if (LocaleCompare("crop",option+1) == 0)
885 if (i == (ssize_t) argc)
886 ThrowDisplayException(OptionError,"MissingArgument",option);
887 if (IsGeometry(argv[i]) == MagickFalse)
888 ThrowDisplayInvalidArgumentException(option,argv[i]);
891 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
895 if (LocaleCompare("debug",option+1) == 0)
903 if (i == (ssize_t) argc)
904 ThrowDisplayException(OptionError,"MissingArgument",option);
905 event=ParseCommandOption(MagickLogEventOptions,MagickFalse,argv[i]);
907 ThrowDisplayException(OptionError,"UnrecognizedEventType",
909 (void) SetLogEventMask(argv[i]);
912 if (LocaleCompare("decipher",option+1) == 0)
917 if (i == (ssize_t) argc)
918 ThrowDisplayException(OptionError,"MissingArgument",option);
921 if (LocaleCompare("define",option+1) == 0)
924 if (i == (ssize_t) argc)
925 ThrowDisplayException(OptionError,"MissingArgument",option);
931 define=GetImageOption(image_info,argv[i]);
932 if (define == (const char *) NULL)
933 ThrowDisplayException(OptionError,"NoSuchOption",argv[i]);
938 if (LocaleCompare("delay",option+1) == 0)
943 if (i == (ssize_t) argc)
944 ThrowDisplayException(OptionError,"MissingArgument",option);
945 if (IsGeometry(argv[i]) == MagickFalse)
946 ThrowDisplayInvalidArgumentException(option,argv[i]);
949 if (LocaleCompare("density",option+1) == 0)
954 if (i == (ssize_t) argc)
955 ThrowDisplayException(OptionError,"MissingArgument",option);
956 if (IsGeometry(argv[i]) == MagickFalse)
957 ThrowDisplayInvalidArgumentException(option,argv[i]);
960 if (LocaleCompare("depth",option+1) == 0)
965 if (i == (ssize_t) argc)
966 ThrowDisplayException(OptionError,"MissingArgument",option);
967 if (IsGeometry(argv[i]) == MagickFalse)
968 ThrowDisplayInvalidArgumentException(option,argv[i]);
971 if (LocaleCompare("deskew",option+1) == 0)
976 if (i == (ssize_t) argc)
977 ThrowDisplayException(OptionError,"MissingArgument",option);
978 if (IsGeometry(argv[i]) == MagickFalse)
979 ThrowDisplayInvalidArgumentException(option,argv[i]);
982 if (LocaleCompare("despeckle",option+1) == 0)
984 if (LocaleCompare("display",option+1) == 0)
989 if (i == (ssize_t) argc)
990 ThrowDisplayException(OptionError,"MissingArgument",option);
993 if (LocaleCompare("dispose",option+1) == 0)
1001 if (i == (ssize_t) argc)
1002 ThrowDisplayException(OptionError,"MissingArgument",option);
1003 dispose=ParseCommandOption(MagickDisposeOptions,MagickFalse,argv[i]);
1005 ThrowDisplayException(OptionError,"UnrecognizedDisposeMethod",
1009 if (LocaleCompare("dither",option+1) == 0)
1014 quantize_info->dither_method=NoDitherMethod;
1018 if (i == (ssize_t) argc)
1019 ThrowDisplayException(OptionError,"MissingArgument",option);
1020 method=ParseCommandOption(MagickDitherOptions,MagickFalse,argv[i]);
1022 ThrowDisplayException(OptionError,"UnrecognizedDitherMethod",
1024 quantize_info->dither_method=(DitherMethod) method;
1027 if (LocaleCompare("duration",option+1) == 0)
1032 if (i == (ssize_t) argc)
1033 ThrowDisplayException(OptionError,"MissingArgument",option);
1034 if (IsGeometry(argv[i]) == MagickFalse)
1035 ThrowDisplayInvalidArgumentException(option,argv[i]);
1038 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
1042 if (LocaleCompare("edge",option+1) == 0)
1047 if (i == (ssize_t) argc)
1048 ThrowDisplayException(OptionError,"MissingArgument",option);
1049 if (IsGeometry(argv[i]) == MagickFalse)
1050 ThrowDisplayInvalidArgumentException(option,argv[i]);
1053 if (LocaleCompare("endian",option+1) == 0)
1061 if (i == (ssize_t) argc)
1062 ThrowDisplayException(OptionError,"MissingArgument",option);
1063 endian=ParseCommandOption(MagickEndianOptions,MagickFalse,
1066 ThrowDisplayException(OptionError,"UnrecognizedEndianType",
1070 if (LocaleCompare("enhance",option+1) == 0)
1072 if (LocaleCompare("equalize",option+1) == 0)
1074 if (LocaleCompare("extract",option+1) == 0)
1079 if (i == (ssize_t) argc)
1080 ThrowDisplayException(OptionError,"MissingArgument",option);
1081 if (IsGeometry(argv[i]) == MagickFalse)
1082 ThrowDisplayInvalidArgumentException(option,argv[i]);
1085 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
1089 if (LocaleCompare("filter",option+1) == 0)
1097 if (i == (ssize_t) argc)
1098 ThrowDisplayException(OptionError,"MissingArgument",option);
1099 filter=ParseCommandOption(MagickFilterOptions,MagickFalse,argv[i]);
1101 ThrowDisplayException(OptionError,"UnrecognizedImageFilter",
1105 if (LocaleCompare("flatten",option+1) == 0)
1107 if (LocaleCompare("flip",option+1) == 0)
1109 if (LocaleCompare("flop",option+1) == 0)
1111 if (LocaleCompare("font",option+1) == 0)
1116 if (i == (ssize_t) argc)
1117 ThrowDisplayException(OptionError,"MissingArgument",option);
1118 resource_info.font=XGetResourceClass(resource_database,
1119 GetClientName(),"font",argv[i]);
1122 if (LocaleCompare("foreground",option+1) == 0)
1127 if (i == (ssize_t) argc)
1128 ThrowDisplayException(OptionError,"MissingArgument",option);
1129 resource_info.foreground_color=argv[i];
1132 if (LocaleCompare("format",option+1) == 0)
1137 if (i == (ssize_t) argc)
1138 ThrowDisplayException(OptionError,"MissingArgument",option);
1141 if (LocaleCompare("frame",option+1) == 0)
1146 if (i == (ssize_t) argc)
1147 ThrowDisplayException(OptionError,"MissingArgument",option);
1148 if (IsGeometry(argv[i]) == MagickFalse)
1149 ThrowDisplayInvalidArgumentException(option,argv[i]);
1152 if (LocaleCompare("fuzz",option+1) == 0)
1157 if (i == (ssize_t) argc)
1158 ThrowDisplayException(OptionError,"MissingArgument",option);
1159 if (IsGeometry(argv[i]) == MagickFalse)
1160 ThrowDisplayInvalidArgumentException(option,argv[i]);
1163 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
1167 if (LocaleCompare("gamma",option+1) == 0)
1170 if (i == (ssize_t) argc)
1171 ThrowDisplayException(OptionError,"MissingArgument",option);
1172 if (IsGeometry(argv[i]) == MagickFalse)
1173 ThrowDisplayInvalidArgumentException(option,argv[i]);
1176 if (LocaleCompare("geometry",option+1) == 0)
1178 resource_info.image_geometry=(char *) NULL;
1181 (void) CopyMagickString(argv[i]+1,"sans",MagickPathExtent);
1183 if (i == (ssize_t) argc)
1184 ThrowDisplayException(OptionError,"MissingArgument",option);
1185 if (IsGeometry(argv[i]) == MagickFalse)
1186 ThrowDisplayInvalidArgumentException(option,argv[i]);
1187 resource_info.image_geometry=ConstantString(argv[i]);
1190 if (LocaleCompare("gravity",option+1) == 0)
1198 if (i == (ssize_t) argc)
1199 ThrowDisplayException(OptionError,"MissingArgument",option);
1200 gravity=ParseCommandOption(MagickGravityOptions,MagickFalse,
1203 ThrowDisplayException(OptionError,"UnrecognizedGravityType",
1207 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
1211 if ((LocaleCompare("help",option+1) == 0) ||
1212 (LocaleCompare("-help",option+1) == 0))
1214 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
1218 if (LocaleCompare("identify",option+1) == 0)
1220 if (LocaleCompare("iconGeometry",option+1) == 0)
1222 resource_info.icon_geometry=(char *) NULL;
1226 if (i == (ssize_t) argc)
1227 ThrowDisplayException(OptionError,"MissingArgument",option);
1228 if (IsGeometry(argv[i]) == MagickFalse)
1229 ThrowDisplayInvalidArgumentException(option,argv[i]);
1230 resource_info.icon_geometry=argv[i];
1233 if (LocaleCompare("iconic",option+1) == 0)
1235 resource_info.iconic=(*option == '-') ? MagickTrue : MagickFalse;
1238 if (LocaleCompare("immutable",option+1) == 0)
1240 resource_info.immutable=(*option == '-') ? MagickTrue : MagickFalse;
1243 if (LocaleCompare("interlace",option+1) == 0)
1251 if (i == (ssize_t) argc)
1252 ThrowDisplayException(OptionError,"MissingArgument",option);
1253 interlace=ParseCommandOption(MagickInterlaceOptions,MagickFalse,
1256 ThrowDisplayException(OptionError,"UnrecognizedInterlaceType",
1260 if (LocaleCompare("interpolate",option+1) == 0)
1268 if (i == (ssize_t) argc)
1269 ThrowDisplayException(OptionError,"MissingArgument",option);
1270 interpolate=ParseCommandOption(MagickInterpolateOptions,MagickFalse,
1272 if (interpolate < 0)
1273 ThrowDisplayException(OptionError,"UnrecognizedInterpolateMethod",
1277 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
1281 if (LocaleCompare("label",option+1) == 0)
1286 if (i == (ssize_t) argc)
1287 ThrowDisplayException(OptionError,"MissingArgument",option);
1290 if (LocaleCompare("limit",option+1) == 0)
1304 if (i == (ssize_t) argc)
1305 ThrowDisplayException(OptionError,"MissingArgument",option);
1306 resource=ParseCommandOption(MagickResourceOptions,MagickFalse,
1309 ThrowDisplayException(OptionError,"UnrecognizedResourceType",
1312 if (i == (ssize_t) argc)
1313 ThrowDisplayException(OptionError,"MissingArgument",option);
1314 value=StringToDouble(argv[i],&p);
1316 if ((p == argv[i]) && (LocaleCompare("unlimited",argv[i]) != 0))
1317 ThrowDisplayInvalidArgumentException(option,argv[i]);
1320 if (LocaleCompare("list",option+1) == 0)
1328 if (i == (ssize_t) argc)
1329 ThrowDisplayException(OptionError,"MissingArgument",option);
1330 list=ParseCommandOption(MagickListOptions,MagickFalse,argv[i]);
1332 ThrowDisplayException(OptionError,"UnrecognizedListType",argv[i]);
1333 status=MogrifyImageInfo(image_info,(int) (i-j+1),(const char **)
1336 return(status == 0 ? MagickTrue : MagickFalse);
1338 if (LocaleCompare("log",option+1) == 0)
1343 if ((i == (ssize_t) argc) ||
1344 (strchr(argv[i],'%') == (char *) NULL))
1345 ThrowDisplayException(OptionError,"MissingArgument",option);
1348 if (LocaleCompare("loop",option+1) == 0)
1353 if (i == (ssize_t) argc)
1354 ThrowDisplayException(OptionError,"MissingArgument",option);
1355 if (IsGeometry(argv[i]) == MagickFalse)
1356 ThrowDisplayInvalidArgumentException(option,argv[i]);
1357 iterations=StringToUnsignedLong(argv[i]);
1360 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
1364 if (LocaleCompare("magnify",option+1) == 0)
1366 resource_info.magnify=2;
1370 if (i == (ssize_t) argc)
1371 ThrowDisplayException(OptionError,"MissingArgument",option);
1372 if (IsGeometry(argv[i]) == MagickFalse)
1373 ThrowDisplayInvalidArgumentException(option,argv[i]);
1374 resource_info.magnify=(unsigned int) StringToUnsignedLong(argv[i]);
1377 if (LocaleCompare("map",option+1) == 0)
1379 resource_info.map_type=(char *) NULL;
1382 (void) strcpy(argv[i]+1,"san");
1384 if (i == (ssize_t) argc)
1385 ThrowDisplayException(OptionError,"MissingArgument",option);
1386 resource_info.map_type=argv[i];
1389 if (LocaleCompare("matte",option+1) == 0)
1391 if (LocaleCompare("mattecolor",option+1) == 0)
1396 if (i == (ssize_t) argc)
1397 ThrowDisplayException(OptionError,"MissingArgument",option);
1398 resource_info.matte_color=argv[i];
1401 if (LocaleCompare("monitor",option+1) == 0)
1403 if (LocaleCompare("monochrome",option+1) == 0)
1407 quantize_info->number_colors=2;
1408 quantize_info->colorspace=GRAYColorspace;
1411 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
1415 if (LocaleCompare("name",option+1) == 0)
1417 resource_info.name=(char *) NULL;
1421 if (i == (ssize_t) argc)
1422 ThrowDisplayException(OptionError,"MissingArgument",option);
1423 resource_info.name=ConstantString(argv[i]);
1426 if (LocaleCompare("negate",option+1) == 0)
1428 if (LocaleCompare("noop",option+1) == 0)
1430 if (LocaleCompare("normalize",option+1) == 0)
1432 if (LocaleCompare("nostdin",option+1) == 0)
1434 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
1438 if (LocaleCompare("page",option+1) == 0)
1440 resource_info.image_geometry=(char *) NULL;
1444 if (i == (ssize_t) argc)
1445 ThrowDisplayException(OptionError,"MissingArgument",option);
1446 resource_info.image_geometry=ConstantString(argv[i]);
1449 if (LocaleCompare("profile",option+1) == 0)
1452 if (i == (ssize_t) argc)
1453 ThrowDisplayException(OptionError,"MissingArgument",option);
1456 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
1460 if (LocaleCompare("quality",option+1) == 0)
1465 if (i == (ssize_t) argc)
1466 ThrowDisplayException(OptionError,"MissingArgument",option);
1467 if (IsGeometry(argv[i]) == MagickFalse)
1468 ThrowDisplayInvalidArgumentException(option,argv[i]);
1471 if (LocaleCompare("quantize",option+1) == 0)
1479 if (i == (ssize_t) argc)
1480 ThrowDisplayException(OptionError,"MissingArgument",option);
1481 colorspace=ParseCommandOption(MagickColorspaceOptions,
1482 MagickFalse,argv[i]);
1484 ThrowDisplayException(OptionError,"UnrecognizedColorspace",
1488 if (LocaleCompare("quiet",option+1) == 0)
1490 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
1494 if (LocaleCompare("raise",option+1) == 0)
1497 if (i == (ssize_t) argc)
1498 ThrowDisplayException(OptionError,"MissingArgument",option);
1499 if (IsGeometry(argv[i]) == MagickFalse)
1500 ThrowDisplayInvalidArgumentException(option,argv[i]);
1503 if (LocaleCompare("regard-warnings",option+1) == 0)
1505 if (LocaleCompare("remote",option+1) == 0)
1508 if (i == (ssize_t) argc)
1509 ThrowDisplayException(OptionError,"MissingArgument",option);
1510 if (XRemoteCommand(display,resource_info.window_id,argv[i]) != 0)
1511 return(MagickFalse);
1515 if (LocaleCompare("repage",option+1) == 0)
1520 if (i == (ssize_t) argc)
1521 ThrowDisplayException(OptionError,"MissingArgument",option);
1522 if (IsGeometry(argv[i]) == MagickFalse)
1523 ThrowDisplayInvalidArgumentException(option,argv[i]);
1526 if (LocaleCompare("resample",option+1) == 0)
1531 if (i == (ssize_t) argc)
1532 ThrowDisplayException(OptionError,"MissingArgument",option);
1533 if (IsGeometry(argv[i]) == MagickFalse)
1534 ThrowDisplayInvalidArgumentException(option,argv[i]);
1537 if (LocaleCompare("resize",option+1) == 0)
1542 if (i == (ssize_t) argc)
1543 ThrowDisplayException(OptionError,"MissingArgument",option);
1544 if (IsGeometry(argv[i]) == MagickFalse)
1545 ThrowDisplayInvalidArgumentException(option,argv[i]);
1548 if (LocaleNCompare("respect-parentheses",option+1,17) == 0)
1550 respect_parenthesis=(*option == '-') ? MagickTrue : MagickFalse;
1553 if (LocaleCompare("roll",option+1) == 0)
1558 if (i == (ssize_t) argc)
1559 ThrowDisplayException(OptionError,"MissingArgument",option);
1560 if (IsGeometry(argv[i]) == MagickFalse)
1561 ThrowDisplayInvalidArgumentException(option,argv[i]);
1564 if (LocaleCompare("rotate",option+1) == 0)
1567 if (i == (ssize_t) argc)
1568 ThrowDisplayException(OptionError,"MissingArgument",option);
1569 if (IsGeometry(argv[i]) == MagickFalse)
1570 ThrowDisplayInvalidArgumentException(option,argv[i]);
1573 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
1577 if (LocaleCompare("sample",option+1) == 0)
1582 if (i == (ssize_t) argc)
1583 ThrowDisplayException(OptionError,"MissingArgument",option);
1584 if (IsGeometry(argv[i]) == MagickFalse)
1585 ThrowDisplayInvalidArgumentException(option,argv[i]);
1588 if (LocaleCompare("sampling-factor",option+1) == 0)
1593 if (i == (ssize_t) argc)
1594 ThrowDisplayException(OptionError,"MissingArgument",option);
1595 if (IsGeometry(argv[i]) == MagickFalse)
1596 ThrowDisplayInvalidArgumentException(option,argv[i]);
1599 if (LocaleCompare("scenes",option+1) == 0)
1604 if (i == (ssize_t) argc)
1605 ThrowDisplayException(OptionError,"MissingArgument",option);
1606 if (IsSceneGeometry(argv[i],MagickFalse) == MagickFalse)
1607 ThrowDisplayInvalidArgumentException(option,argv[i]);
1610 if (LocaleCompare("seed",option+1) == 0)
1615 if (i == (ssize_t) argc)
1616 ThrowDisplayException(OptionError,"MissingArgument",option);
1617 if (IsGeometry(argv[i]) == MagickFalse)
1618 ThrowDisplayInvalidArgumentException(option,argv[i]);
1621 if (LocaleCompare("segment",option+1) == 0)
1626 if (i == (ssize_t) argc)
1627 ThrowDisplayException(OptionError,"MissingArgument",option);
1628 if (IsGeometry(argv[i]) == MagickFalse)
1629 ThrowDisplayInvalidArgumentException(option,argv[i]);
1632 if (LocaleCompare("set",option+1) == 0)
1635 if (i == (ssize_t) argc)
1636 ThrowDisplayException(OptionError,"MissingArgument",option);
1640 if (i == (ssize_t) argc)
1641 ThrowDisplayException(OptionError,"MissingArgument",option);
1644 if (LocaleCompare("sharpen",option+1) == 0)
1649 if (i == (ssize_t) argc)
1650 ThrowDisplayException(OptionError,"MissingArgument",option);
1651 if (IsGeometry(argv[i]) == MagickFalse)
1652 ThrowDisplayInvalidArgumentException(option,argv[i]);
1655 if (LocaleCompare("shared-memory",option+1) == 0)
1657 resource_info.use_shared_memory= (*option == '-') ? MagickTrue :
1661 if (LocaleCompare("size",option+1) == 0)
1666 if (i == (ssize_t) argc)
1667 ThrowDisplayException(OptionError,"MissingArgument",option);
1668 if (IsGeometry(argv[i]) == MagickFalse)
1669 ThrowDisplayInvalidArgumentException(option,argv[i]);
1672 if (LocaleCompare("strip",option+1) == 0)
1674 if (LocaleCompare("support",option+1) == 0)
1676 i++; /* deprecated */
1679 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
1683 if (LocaleCompare("text-font",option+1) == 0)
1685 resource_info.text_font=(char *) NULL;
1689 if (i == (ssize_t) argc)
1690 ThrowDisplayException(OptionError,"MissingArgument",option);
1691 resource_info.text_font=XGetResourceClass(resource_database,
1692 GetClientName(),"font",argv[i]);
1695 if (LocaleCompare("texture",option+1) == 0)
1700 if (i == (ssize_t) argc)
1701 ThrowDisplayException(OptionError,"MissingArgument",option);
1704 if (LocaleCompare("threshold",option+1) == 0)
1709 if (i == (ssize_t) argc)
1710 ThrowDisplayException(OptionError,"MissingArgument",option);
1711 if (IsGeometry(argv[i]) == MagickFalse)
1712 ThrowDisplayInvalidArgumentException(option,argv[i]);
1715 if (LocaleCompare("thumbnail",option+1) == 0)
1720 if (i == (ssize_t) argc)
1721 ThrowDisplayException(OptionError,"MissingArgument",option);
1722 if (IsGeometry(argv[i]) == MagickFalse)
1723 ThrowDisplayInvalidArgumentException(option,argv[i]);
1726 if (LocaleCompare("title",option+1) == 0)
1728 resource_info.title=(char *) NULL;
1732 if (i == (ssize_t) argc)
1733 ThrowDisplayException(OptionError,"MissingArgument",option);
1734 resource_info.title=argv[i];
1737 if (LocaleCompare("transparent-color",option+1) == 0)
1742 if (i == (ssize_t) argc)
1743 ThrowDisplayException(OptionError,"MissingArgument",option);
1746 if (LocaleCompare("treedepth",option+1) == 0)
1748 quantize_info->tree_depth=0;
1752 if (i == (ssize_t) argc)
1753 ThrowDisplayException(OptionError,"MissingArgument",option);
1754 if (IsGeometry(argv[i]) == MagickFalse)
1755 ThrowDisplayInvalidArgumentException(option,argv[i]);
1756 quantize_info->tree_depth=StringToUnsignedLong(argv[i]);
1759 if (LocaleCompare("trim",option+1) == 0)
1761 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
1765 if (LocaleCompare("update",option+1) == 0)
1767 resource_info.update=(unsigned int) (*option == '-');
1771 if (i == (ssize_t) argc)
1772 ThrowDisplayException(OptionError,"MissingArgument",option);
1773 if (IsGeometry(argv[i]) == MagickFalse)
1774 ThrowDisplayInvalidArgumentException(option,argv[i]);
1775 resource_info.update=(unsigned int) StringToUnsignedLong(argv[i]);
1778 if (LocaleCompare("use-pixmap",option+1) == 0)
1780 resource_info.use_pixmap=(*option == '-') ? MagickTrue :
1784 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
1788 if (LocaleCompare("verbose",option+1) == 0)
1790 if ((LocaleCompare("version",option+1) == 0) ||
1791 (LocaleCompare("-version",option+1) == 0))
1793 ListMagickVersion(stdout);
1796 if (LocaleCompare("visual",option+1) == 0)
1798 resource_info.visual_type=(char *) NULL;
1802 if (i == (ssize_t) argc)
1803 ThrowDisplayException(OptionError,"MissingArgument",option);
1804 resource_info.visual_type=argv[i];
1807 if (LocaleCompare("virtual-pixel",option+1) == 0)
1815 if (i == (ssize_t) argc)
1816 ThrowDisplayException(OptionError,"MissingArgument",option);
1817 method=ParseCommandOption(MagickVirtualPixelOptions,MagickFalse,
1820 ThrowDisplayException(OptionError,
1821 "UnrecognizedVirtualPixelMethod",argv[i]);
1824 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
1828 if (LocaleCompare("window",option+1) == 0)
1830 resource_info.window_id=(char *) NULL;
1834 if (i == (ssize_t) argc)
1835 ThrowDisplayException(OptionError,"MissingArgument",option);
1836 resource_info.window_id=argv[i];
1839 if (LocaleCompare("window-group",option+1) == 0)
1841 resource_info.window_group=(char *) NULL;
1845 if (i == (ssize_t) argc)
1846 ThrowDisplayException(OptionError,"MissingArgument",option);
1847 if (StringToDouble(argv[i],(char **) NULL) != 0)
1848 resource_info.window_group=argv[i];
1851 if (LocaleCompare("write",option+1) == 0)
1853 resource_info.write_filename=(char *) NULL;
1857 if (i == (ssize_t) argc)
1858 ThrowDisplayException(OptionError,"MissingArgument",option);
1859 resource_info.write_filename=argv[i];
1860 if (IsPathAccessible(resource_info.write_filename) != MagickFalse)
1866 (void) FormatLocaleFile(stderr,"Overwrite %s? ",
1867 resource_info.write_filename);
1868 p=fgets(answer,(int) sizeof(answer),stdin);
1870 if (((*answer != 'y') && (*answer != 'Y')))
1871 return(MagickFalse);
1875 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
1880 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
1882 fire=(GetCommandOptionFlags(MagickCommandOptions,MagickFalse,option) &
1883 FireOptionFlag) == 0 ? MagickFalse : MagickTrue;
1884 if (fire != MagickFalse)
1885 FireImageStack(MagickFalse,MagickTrue,MagickTrue);
1888 ThrowDisplayException(OptionError,"UnbalancedParenthesis",argv[i]);
1889 if (state & RetainColorsState)
1891 XRetainWindowColors(display,XRootWindow(display,XDefaultScreen(display)));
1892 (void) XSync(display,MagickFalse);
1895 return(status != 0 ? MagickTrue : MagickFalse);
1897 wand_unreferenced(argc);
1898 wand_unreferenced(argv);
1899 wand_unreferenced(metadata);
1900 (void) ThrowMagickException(exception,GetMagickModule(),MissingDelegateError,
1901 "DelegateLibrarySupportNotBuiltIn","'%s' (X11)",image_info->filename);
1902 return(DisplayUsage());