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-2019 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://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)
98 " 1 press to map or unmap the Command widget\n"
99 " 2 press and drag to magnify a region of an image\n"
100 " 3 press to load an image from a visual image directory",
102 " -debug events display copious debugging information\n"
103 " -help print program options\n"
104 " -list type print a list of supported option arguments\n"
105 " -log format format of debugging information\n"
106 " -version print version information",
108 " -auto-orient automagically orient image\n"
109 " -border geometry surround image with a border of color\n"
110 " -clip clip along the first path from the 8BIM profile\n"
111 " -clip-path id clip along a named path from the 8BIM profile\n"
112 " -colors value preferred number of colors in the image\n"
113 " -contrast enhance or reduce the image contrast\n"
114 " -crop geometry preferred size and location of the cropped image\n"
115 " -decipher filename convert cipher pixels to plain pixels\n"
116 " -deskew threshold straighten an image\n"
117 " -despeckle reduce the speckles within an image\n"
118 " -edge factor apply a filter to detect edges in the image\n"
119 " -enhance apply a digital filter to enhance a noisy image\n"
120 " -equalize perform histogram equalization to an image\n"
121 " -extract geometry extract area from image\n"
122 " -flip flip image in the vertical direction\n"
123 " -flop flop image in the horizontal direction\n"
124 " -frame geometry surround image with an ornamental border\n"
125 " -fuzz distance colors within this distance are considered equal\n"
126 " -gamma value level of gamma correction\n"
127 " -monochrome transform image to black and white\n"
128 " -negate replace every pixel with its complementary color\n"
129 " -normalize transform image to span the full range of colors\n"
130 " -raise value lighten/darken image edges to create a 3-D effect\n"
131 " -resample geometry change the resolution of an image\n"
132 " -resize geometry resize the image\n"
133 " -roll geometry roll an image vertically or horizontally\n"
134 " -rotate degrees apply Paeth rotation to the image\n"
135 " -sample geometry scale image with pixel sampling\n"
136 " -segment value segment an image\n"
137 " -sharpen geometry sharpen the image\n"
138 " -strip strip image of all profiles and comments\n"
139 " -threshold value threshold the image\n"
140 " -thumbnail geometry create a thumbnail of the image\n"
141 " -trim trim image edges",
143 " -alpha option on, activate, off, deactivate, set, opaque, copy\n"
144 " transparent, extract, background, or shape\n"
145 " -antialias remove pixel-aliasing\n"
146 " -authenticate password\n"
147 " decipher image with this password\n"
148 " -backdrop display image centered on a backdrop\n"
149 " -channel type apply option to select image channels\n"
150 " -colormap type Shared or Private\n"
151 " -colorspace type alternate image colorspace\n"
152 " -comment string annotate image with comment\n"
153 " -compress type type of pixel compression when writing the image\n"
154 " -define format:option\n"
155 " define one or more image format options\n"
156 " -delay value display the next image after pausing\n"
157 " -density geometry horizontal and vertical density of the image\n"
158 " -depth value image depth\n"
159 " -display server display image to this X server\n"
160 " -dispose method layer disposal method\n"
161 " -dither method apply error diffusion to image\n"
162 " -endian type endianness (MSB or LSB) of the image\n"
163 " -filter type use this filter when resizing an image\n"
164 " -format string output formatted image characteristics\n"
165 " -geometry geometry preferred size and location of the Image window\n"
166 " -gravity type horizontal and vertical backdrop placement\n"
167 " -identify identify the format and characteristics of the image\n"
168 " -immutable displayed image cannot be modified\n"
169 " -interlace type type of image interlacing scheme\n"
170 " -interpolate method pixel color interpolation method\n"
171 " -label string assign a label to an image\n"
172 " -limit type value pixel cache resource limit\n"
173 " -loop iterations loop images then exit\n"
174 " -map type display image using this Standard Colormap\n"
175 " -matte store matte channel if the image has one\n"
176 " -monitor monitor progress\n"
177 " -nostdin do not try to open stdin\n"
178 " -page geometry size and location of an image canvas\n"
179 " -profile filename add, delete, or apply an image profile\n"
180 " -quality value JPEG/MIFF/PNG compression level\n"
181 " -quantize colorspace reduce colors in this colorspace\n"
182 " -quiet suppress all warning messages\n"
183 " -regard-warnings pay attention to warning messages\n"
184 " -remote command execute a command in an remote display process\n"
185 " -repage geometry size and location of an image canvas (operator)\n"
186 " -respect-parentheses settings remain in effect until parenthesis boundary\n"
187 " -sampling-factor geometry\n"
188 " horizontal and vertical sampling factor\n"
189 " -scenes range image scene range\n"
190 " -seed value seed a new sequence of pseudo-random numbers\n"
191 " -set property value set an image property\n"
192 " -size geometry width and height of image\n"
193 " -support factor resize support: > 1.0 is blurry, < 1.0 is sharp\n"
194 " -texture filename name of texture to tile onto the image background\n"
195 " -transparent-color color\n"
196 " transparent color\n"
197 " -treedepth value color tree depth\n"
198 " -update seconds detect when image file is modified and redisplay\n"
199 " -verbose print detailed information about the image\n"
200 " -visual type display image using this visual type\n"
201 " -virtual-pixel method\n"
202 " virtual pixel access method\n"
203 " -window id display image to background of this window\n"
204 " -window-group id exit program when this window id is destroyed\n"
205 " -write filename write image to a file",
206 sequence_operators[] =
207 " -coalesce merge a sequence of images\n"
208 " -flatten flatten a sequence of images";
210 ListMagickVersion(stdout);
211 (void) printf("Usage: %s [options ...] file [ [options ...] file ...]\n",
213 (void) printf("\nImage Settings:\n");
214 (void) puts(settings);
215 (void) printf("\nImage Operators:\n");
216 (void) puts(operators);
217 (void) printf("\nImage Sequence Operators:\n");
218 (void) puts(sequence_operators);
219 (void) printf("\nMiscellaneous Options:\n");
220 (void) puts(miscellaneous);
222 "\nIn addition to those listed above, you can specify these standard X\n");
224 "resources as command line options: -background, -bordercolor,\n");
226 " -mattecolor, -borderwidth, -font, -foreground, -iconGeometry,\n");
227 (void) printf("-iconic, -name, -shared-memory, -usePixmap, or -title.\n");
229 "\nBy default, the image format of 'file' is determined by its magic\n");
231 "number. To specify a particular image format, precede the filename\n");
233 "with an image format name and a colon (i.e. ps:image) or specify the\n");
235 "image type as the filename suffix (i.e. image.ps). Specify 'file' as\n");
236 (void) printf("'-' for standard input or output.\n");
237 (void) printf("\nButtons: \n");
238 (void) puts(buttons);
242 WandExport MagickBooleanType DisplayImageCommand(ImageInfo *image_info,
243 int argc,char **argv,char **wand_unused(metadata),ExceptionInfo *exception)
245 #if defined(MAGICKCORE_X11_DELEGATE)
246 #define DestroyDisplay() \
248 if ((state & ExitState) == 0) \
249 DestroyXResources(); \
250 if (display != (Display *) NULL) \
252 XCloseDisplay(display); \
253 display=(Display *) NULL; \
255 XDestroyResourceInfo(&resource_info); \
256 DestroyImageStack(); \
257 if (image_marker != (size_t *) NULL) \
258 image_marker=(size_t *) RelinquishMagickMemory(image_marker); \
259 for (i=0; i < (ssize_t) argc; i++) \
260 argv[i]=DestroyString(argv[i]); \
261 argv=(char **) RelinquishMagickMemory(argv); \
263 #define ThrowDisplayException(asperity,tag,option) \
265 (void) ThrowMagickException(exception,GetMagickModule(),asperity,tag,"`%s'", \
268 return(MagickFalse); \
270 #define ThrowDisplayInvalidArgumentException(option,argument) \
272 (void) ThrowMagickException(exception,GetMagickModule(),OptionError, \
273 "InvalidArgument","'%s': %s",option,argument); \
275 return(MagickFalse); \
292 image_stack[MaxImageStackDepth+1];
331 assert(image_info != (ImageInfo *) NULL);
332 assert(image_info->signature == MagickCoreSignature);
333 if (image_info->debug != MagickFalse)
334 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");
335 assert(exception != (ExceptionInfo *) NULL);
339 if ((LocaleCompare("version",option+1) == 0) ||
340 (LocaleCompare("-version",option+1) == 0))
342 ListMagickVersion(stdout);
347 display=(Display *) NULL;
350 image_marker=(size_t *) NULL;
354 option=(char *) NULL;
356 respect_parenthesis=MagickFalse;
358 resource_database=(XrmDatabase) NULL;
359 (void) memset(&resource_info,0,sizeof(resource_info));
360 server_name=(char *) NULL;
363 ReadCommandlLine(argc,&argv);
364 status=ExpandFilenames(&argc,&argv);
365 if (status == MagickFalse)
366 ThrowDisplayException(ResourceLimitError,"MemoryAllocationFailed",
367 GetExceptionMessage(errno));
368 image_marker=(size_t *) AcquireQuantumMemory((size_t) argc+1UL,
369 sizeof(*image_marker));
370 if (image_marker == (size_t *) NULL)
371 ThrowDisplayException(ResourceLimitError,"MemoryAllocationFailed",
372 GetExceptionMessage(errno));
373 for (i=0; i <= (ssize_t) argc; i++)
374 image_marker[i]=(size_t) argc;
376 Check for server name specified on the command line.
378 for (i=1; i < (ssize_t) argc; i++)
381 Check command line for server name.
384 if (IsCommandOption(option) == MagickFalse)
386 if (LocaleCompare("display",option+1) == 0)
389 User specified server name.
392 if (i == (ssize_t) argc)
393 ThrowDisplayException(OptionError,"MissingArgument",option);
396 if (LocaleCompare("nostdin",option+1) == 0)
398 if ((LocaleCompare("help",option+1) == 0) ||
399 (LocaleCompare("-help",option+1) == 0))
400 return(DisplayUsage());
403 Get user defaults from X resource database.
405 display=XOpenDisplay(server_name);
406 if (display == (Display *) NULL)
407 ThrowDisplayException(XServerError,"UnableToOpenXServer",
408 XDisplayName(server_name));
409 (void) XSetErrorHandler(XError);
410 resource_database=XGetResourceDatabase(display,GetClientName());
411 XGetResourceInfo(image_info,resource_database,GetClientName(),
413 quantize_info=resource_info.quantize_info;
414 image_info->density=XGetResourceInstance(resource_database,GetClientName(),
415 "density",(char *) NULL);
416 if (image_info->density == (char *) NULL)
417 image_info->density=XGetScreenDensity(display);
418 resource_value=XGetResourceInstance(resource_database,GetClientName(),
420 image_info->interlace=(InterlaceType)
421 ParseCommandOption(MagickInterlaceOptions,MagickFalse,resource_value);
422 image_info->page=XGetResourceInstance(resource_database,GetClientName(),
423 "pageGeometry",(char *) NULL);
424 resource_value=XGetResourceInstance(resource_database,GetClientName(),
426 image_info->quality=StringToUnsignedLong(resource_value);
427 resource_value=XGetResourceInstance(resource_database,GetClientName(),
429 image_info->verbose=IsStringTrue(resource_value);
430 resource_value=XGetResourceInstance(resource_database,GetClientName(),
432 quantize_info->dither_method=IsStringTrue(resource_value) != MagickFalse ?
433 RiemersmaDitherMethod : NoDitherMethod;
438 for (i=1; ((i <= (ssize_t) argc) && ((state & ExitState) == 0)); i++)
440 if (i < (ssize_t) argc)
443 if (image != (Image *) NULL)
446 if (isatty(STDIN_FILENO) != MagickFalse || (nostdin != MagickFalse))
450 if (LocaleCompare(option,"(") == 0)
452 FireImageStack(MagickFalse,MagickTrue,pend);
453 if (k == MaxImageStackDepth)
454 ThrowDisplayException(OptionError,"ParenthesisNestedTooDeeply",
459 if (LocaleCompare(option,")") == 0)
461 FireImageStack(MagickFalse,MagickTrue,MagickTrue);
463 ThrowDisplayException(OptionError,"UnableToParseExpression",option);
467 if (IsCommandOption(option) == MagickFalse)
478 Option is a file name.
480 FireImageStack(MagickFalse,MagickFalse,pend);
482 if ((LocaleCompare(filename,"--") == 0) && (i < (ssize_t) (argc-1)))
487 (void) CopyMagickString(image_info->filename,filename,MagickPathExtent);
488 images=ReadImage(image_info,exception);
489 CatchException(exception);
490 status&=(images != (Image *) NULL) &&
491 (exception->severity < ErrorException);
492 if (images == (Image *) NULL)
494 AppendImageStack(images);
495 FinalizeImageSettings(image_info,image,MagickFalse);
496 iterations=image->iterations;
497 image_list=CloneImageList(image,exception);
498 if (image_list == (Image *) NULL)
499 ThrowDisplayException(ResourceLimitError,"MemoryAllocationFailed",
500 GetExceptionMessage(errno));
501 display_image=image_list;
505 Transmogrify image as defined by the image processing options.
507 resource_info.quantum=1;
508 if (resource_info.window_id != (char *) NULL)
511 Display image to a specified X window.
513 status=XDisplayBackgroundImage(display,&resource_info,
514 display_image,exception);
515 if (status != MagickFalse)
517 state|=RetainColorsState;
520 if (GetNextImageInList(display_image) == (Image *) NULL)
530 Display image to X server.
532 if (resource_info.delay != 1)
533 display_image->delay=resource_info.delay;
534 nexus=XDisplayImage(display,&resource_info,argv,argc,
535 &display_image,&state,exception);
536 if (nexus == (Image *) NULL)
538 while ((nexus != (Image *) NULL) && ((state & ExitState) == 0))
543 if (nexus->montage != (char *) NULL)
546 User selected a visual directory image (montage).
551 next=XDisplayImage(display,&resource_info,argv,argc,&nexus,
553 if ((next == (Image *) NULL) &&
554 (GetNextImageInList(nexus) != (Image *) NULL))
556 display_image=GetNextImageInList(nexus);
557 nexus=NewImageList();
561 if (nexus != display_image)
562 nexus=DestroyImageList(nexus);
566 } while ((state & ExitState) == 0);
567 if (resource_info.write_filename != (char *) NULL)
572 (void) CopyMagickString(display_image->filename,
573 resource_info.write_filename,MagickPathExtent);
574 (void) SetImageInfo(image_info,1,exception);
575 status&=WriteImage(image_info,display_image,exception);
578 Proceed to next/previous image.
580 if ((state & FormerImageState) != 0)
581 for (l=0; l < (ssize_t) resource_info.quantum; l++)
583 if (GetPreviousImageInList(display_image) == (Image *) NULL)
585 display_image=GetPreviousImageInList(display_image);
588 for (l=0; l < (ssize_t) resource_info.quantum; l++)
590 if (GetNextImageInList(display_image) == (Image *) NULL)
592 display_image=GetNextImageInList(display_image);
594 if (l < (ssize_t) resource_info.quantum)
596 } while ((display_image != (Image *) NULL) && ((state & ExitState) == 0));
598 Free image resources.
600 display_image=DestroyImageList(display_image);
601 if ((state & FormerImageState) == 0)
603 last_image=(size_t) image_number;
604 image_marker[i]=(size_t) image_number++;
609 Proceed to previous image.
611 for (i--; i > 0; i--)
612 if (image_marker[i] == (size_t) (image_number-2))
616 if ((i == (ssize_t) argc) && ((state & ExitState) == 0))
618 if ((state & ExitState) != 0)
621 Determine if we should proceed to the first image.
623 if (image_number < 0)
625 if ((state & FormerImageState) != 0)
628 for (i=1; i < (ssize_t) (argc-2); i++)
629 if (last_image == image_marker[i])
631 image_number=(ssize_t) image_marker[i]+1;
635 if (resource_info.window_id != (char *) NULL)
639 if (++iteration == (ssize_t) iterations)
643 if (LocaleCompare(filename,"-") == 0)
645 RemoveAllImageStack();
648 pend=image != (Image *) NULL ? MagickTrue : MagickFalse;
653 if (LocaleCompare("alpha",option+1) == 0)
661 if (i == (ssize_t) argc)
662 ThrowDisplayException(OptionError,"MissingArgument",option);
663 type=ParseCommandOption(MagickAlphaChannelOptions,MagickFalse,
666 ThrowDisplayException(OptionError,
667 "UnrecognizedAlphaChannelOption",argv[i]);
670 if (LocaleCompare("antialias",option+1) == 0)
672 if (LocaleCompare("authenticate",option+1) == 0)
677 if (i == (ssize_t) argc)
678 ThrowDisplayException(OptionError,"MissingArgument",option);
681 if (LocaleCompare("auto-orient",option+1) == 0)
683 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
687 if (LocaleCompare("backdrop",option+1) == 0)
689 resource_info.backdrop=(*option == '-') ? MagickTrue : MagickFalse;
692 if (LocaleCompare("background",option+1) == 0)
697 if (i == (ssize_t) argc)
698 ThrowDisplayException(OptionError,"MissingArgument",option);
699 resource_info.background_color=argv[i];
702 if (LocaleCompare("border",option+1) == 0)
707 if (i == (ssize_t) argc)
708 ThrowDisplayException(OptionError,"MissingArgument",option);
709 if (IsGeometry(argv[i]) == MagickFalse)
710 ThrowDisplayInvalidArgumentException(option,argv[i]);
713 if (LocaleCompare("bordercolor",option+1) == 0)
718 if (i == (ssize_t) argc)
719 ThrowDisplayException(OptionError,"MissingArgument",option);
720 resource_info.border_color=argv[i];
723 if (LocaleCompare("borderwidth",option+1) == 0)
725 resource_info.border_width=0;
729 if (i == (ssize_t) argc)
730 ThrowDisplayException(OptionError,"MissingArgument",option);
731 if (IsGeometry(argv[i]) == MagickFalse)
732 ThrowDisplayInvalidArgumentException(option,argv[i]);
733 resource_info.border_width=(unsigned int)
734 StringToUnsignedLong(argv[i]);
737 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
741 if (LocaleCompare("cache",option+1) == 0)
746 if (i == (ssize_t) argc)
747 ThrowDisplayException(OptionError,"MissingArgument",option);
748 if (IsGeometry(argv[i]) == MagickFalse)
749 ThrowDisplayInvalidArgumentException(option,argv[i]);
752 if (LocaleCompare("channel",option+1) == 0)
760 if (i == (ssize_t) argc)
761 ThrowDisplayException(OptionError,"MissingArgument",option);
762 channel=ParseChannelOption(argv[i]);
764 ThrowDisplayException(OptionError,"UnrecognizedChannelType",
768 if (LocaleCompare("clip",option+1) == 0)
770 if (LocaleCompare("clip-path",option+1) == 0)
773 if (i == (ssize_t) argc)
774 ThrowDisplayException(OptionError,"MissingArgument",option);
777 if (LocaleCompare("coalesce",option+1) == 0)
779 if (LocaleCompare("colormap",option+1) == 0)
781 resource_info.colormap=PrivateColormap;
785 if (i == (ssize_t) argc)
786 ThrowDisplayException(OptionError,"MissingArgument",option);
787 resource_info.colormap=UndefinedColormap;
788 if (LocaleCompare("private",argv[i]) == 0)
789 resource_info.colormap=PrivateColormap;
790 if (LocaleCompare("shared",argv[i]) == 0)
791 resource_info.colormap=SharedColormap;
792 if (resource_info.colormap == UndefinedColormap)
793 ThrowDisplayException(OptionError,"UnrecognizedColormapType",
797 if (LocaleCompare("colors",option+1) == 0)
799 quantize_info->number_colors=0;
803 if (i == (ssize_t) argc)
804 ThrowDisplayException(OptionError,"MissingArgument",option);
805 if (IsGeometry(argv[i]) == MagickFalse)
806 ThrowDisplayInvalidArgumentException(option,argv[i]);
807 quantize_info->number_colors=StringToUnsignedLong(argv[i]);
810 if (LocaleCompare("colorspace",option+1) == 0)
818 if (i == (ssize_t) argc)
819 ThrowDisplayException(OptionError,"MissingArgument",option);
820 colorspace=ParseCommandOption(MagickColorspaceOptions,
821 MagickFalse,argv[i]);
823 ThrowDisplayException(OptionError,"UnrecognizedColorspace",
827 if (LocaleCompare("comment",option+1) == 0)
832 if (i == (ssize_t) argc)
833 ThrowDisplayException(OptionError,"MissingArgument",option);
836 if (LocaleCompare("compress",option+1) == 0)
844 if (i == (ssize_t) argc)
845 ThrowDisplayException(OptionError,"MissingArgument",option);
846 compress=ParseCommandOption(MagickCompressOptions,MagickFalse,
849 ThrowDisplayException(OptionError,"UnrecognizedImageCompression",
853 if (LocaleCompare("concurrent",option+1) == 0)
855 if (LocaleCompare("contrast",option+1) == 0)
857 if (LocaleCompare("crop",option+1) == 0)
862 if (i == (ssize_t) argc)
863 ThrowDisplayException(OptionError,"MissingArgument",option);
864 if (IsGeometry(argv[i]) == MagickFalse)
865 ThrowDisplayInvalidArgumentException(option,argv[i]);
868 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
872 if (LocaleCompare("debug",option+1) == 0)
880 if (i == (ssize_t) argc)
881 ThrowDisplayException(OptionError,"MissingArgument",option);
882 event=ParseCommandOption(MagickLogEventOptions,MagickFalse,argv[i]);
884 ThrowDisplayException(OptionError,"UnrecognizedEventType",
886 (void) SetLogEventMask(argv[i]);
889 if (LocaleCompare("decipher",option+1) == 0)
894 if (i == (ssize_t) argc)
895 ThrowDisplayException(OptionError,"MissingArgument",option);
898 if (LocaleCompare("define",option+1) == 0)
901 if (i == (ssize_t) argc)
902 ThrowDisplayException(OptionError,"MissingArgument",option);
908 define=GetImageOption(image_info,argv[i]);
909 if (define == (const char *) NULL)
910 ThrowDisplayException(OptionError,"NoSuchOption",argv[i]);
915 if (LocaleCompare("delay",option+1) == 0)
920 if (i == (ssize_t) argc)
921 ThrowDisplayException(OptionError,"MissingArgument",option);
922 if (IsGeometry(argv[i]) == MagickFalse)
923 ThrowDisplayInvalidArgumentException(option,argv[i]);
926 if (LocaleCompare("density",option+1) == 0)
931 if (i == (ssize_t) argc)
932 ThrowDisplayException(OptionError,"MissingArgument",option);
933 if (IsGeometry(argv[i]) == MagickFalse)
934 ThrowDisplayInvalidArgumentException(option,argv[i]);
937 if (LocaleCompare("depth",option+1) == 0)
942 if (i == (ssize_t) argc)
943 ThrowDisplayException(OptionError,"MissingArgument",option);
944 if (IsGeometry(argv[i]) == MagickFalse)
945 ThrowDisplayInvalidArgumentException(option,argv[i]);
948 if (LocaleCompare("deskew",option+1) == 0)
953 if (i == (ssize_t) argc)
954 ThrowDisplayException(OptionError,"MissingArgument",option);
955 if (IsGeometry(argv[i]) == MagickFalse)
956 ThrowDisplayInvalidArgumentException(option,argv[i]);
959 if (LocaleCompare("despeckle",option+1) == 0)
961 if (LocaleCompare("display",option+1) == 0)
966 if (i == (ssize_t) argc)
967 ThrowDisplayException(OptionError,"MissingArgument",option);
970 if (LocaleCompare("dispose",option+1) == 0)
978 if (i == (ssize_t) argc)
979 ThrowDisplayException(OptionError,"MissingArgument",option);
980 dispose=ParseCommandOption(MagickDisposeOptions,MagickFalse,argv[i]);
982 ThrowDisplayException(OptionError,"UnrecognizedDisposeMethod",
986 if (LocaleCompare("dither",option+1) == 0)
991 quantize_info->dither_method=NoDitherMethod;
995 if (i == (ssize_t) argc)
996 ThrowDisplayException(OptionError,"MissingArgument",option);
997 method=ParseCommandOption(MagickDitherOptions,MagickFalse,argv[i]);
999 ThrowDisplayException(OptionError,"UnrecognizedDitherMethod",
1001 quantize_info->dither_method=(DitherMethod) method;
1004 if (LocaleCompare("duration",option+1) == 0)
1009 if (i == (ssize_t) argc)
1010 ThrowDisplayException(OptionError,"MissingArgument",option);
1011 if (IsGeometry(argv[i]) == MagickFalse)
1012 ThrowDisplayInvalidArgumentException(option,argv[i]);
1015 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
1019 if (LocaleCompare("edge",option+1) == 0)
1024 if (i == (ssize_t) argc)
1025 ThrowDisplayException(OptionError,"MissingArgument",option);
1026 if (IsGeometry(argv[i]) == MagickFalse)
1027 ThrowDisplayInvalidArgumentException(option,argv[i]);
1030 if (LocaleCompare("endian",option+1) == 0)
1038 if (i == (ssize_t) argc)
1039 ThrowDisplayException(OptionError,"MissingArgument",option);
1040 endian=ParseCommandOption(MagickEndianOptions,MagickFalse,
1043 ThrowDisplayException(OptionError,"UnrecognizedEndianType",
1047 if (LocaleCompare("enhance",option+1) == 0)
1049 if (LocaleCompare("equalize",option+1) == 0)
1051 if (LocaleCompare("extract",option+1) == 0)
1056 if (i == (ssize_t) argc)
1057 ThrowDisplayException(OptionError,"MissingArgument",option);
1058 if (IsGeometry(argv[i]) == MagickFalse)
1059 ThrowDisplayInvalidArgumentException(option,argv[i]);
1062 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
1066 if (LocaleCompare("filter",option+1) == 0)
1074 if (i == (ssize_t) argc)
1075 ThrowDisplayException(OptionError,"MissingArgument",option);
1076 filter=ParseCommandOption(MagickFilterOptions,MagickFalse,argv[i]);
1078 ThrowDisplayException(OptionError,"UnrecognizedImageFilter",
1082 if (LocaleCompare("flatten",option+1) == 0)
1084 if (LocaleCompare("flip",option+1) == 0)
1086 if (LocaleCompare("flop",option+1) == 0)
1088 if (LocaleCompare("font",option+1) == 0)
1093 if (i == (ssize_t) argc)
1094 ThrowDisplayException(OptionError,"MissingArgument",option);
1095 resource_info.font=XGetResourceClass(resource_database,
1096 GetClientName(),"font",argv[i]);
1099 if (LocaleCompare("foreground",option+1) == 0)
1104 if (i == (ssize_t) argc)
1105 ThrowDisplayException(OptionError,"MissingArgument",option);
1106 resource_info.foreground_color=argv[i];
1109 if (LocaleCompare("format",option+1) == 0)
1114 if (i == (ssize_t) argc)
1115 ThrowDisplayException(OptionError,"MissingArgument",option);
1118 if (LocaleCompare("frame",option+1) == 0)
1123 if (i == (ssize_t) argc)
1124 ThrowDisplayException(OptionError,"MissingArgument",option);
1125 if (IsGeometry(argv[i]) == MagickFalse)
1126 ThrowDisplayInvalidArgumentException(option,argv[i]);
1129 if (LocaleCompare("fuzz",option+1) == 0)
1134 if (i == (ssize_t) argc)
1135 ThrowDisplayException(OptionError,"MissingArgument",option);
1136 if (IsGeometry(argv[i]) == MagickFalse)
1137 ThrowDisplayInvalidArgumentException(option,argv[i]);
1140 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
1144 if (LocaleCompare("gamma",option+1) == 0)
1147 if (i == (ssize_t) argc)
1148 ThrowDisplayException(OptionError,"MissingArgument",option);
1149 if (IsGeometry(argv[i]) == MagickFalse)
1150 ThrowDisplayInvalidArgumentException(option,argv[i]);
1153 if (LocaleCompare("geometry",option+1) == 0)
1155 resource_info.image_geometry=(char *) NULL;
1158 (void) CopyMagickString(argv[i]+1,"sans",MagickPathExtent);
1160 if (i == (ssize_t) argc)
1161 ThrowDisplayException(OptionError,"MissingArgument",option);
1162 if (IsGeometry(argv[i]) == MagickFalse)
1163 ThrowDisplayInvalidArgumentException(option,argv[i]);
1164 resource_info.image_geometry=ConstantString(argv[i]);
1167 if (LocaleCompare("gravity",option+1) == 0)
1175 if (i == (ssize_t) argc)
1176 ThrowDisplayException(OptionError,"MissingArgument",option);
1177 gravity=ParseCommandOption(MagickGravityOptions,MagickFalse,
1180 ThrowDisplayException(OptionError,"UnrecognizedGravityType",
1184 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
1188 if ((LocaleCompare("help",option+1) == 0) ||
1189 (LocaleCompare("-help",option+1) == 0))
1191 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
1195 if (LocaleCompare("identify",option+1) == 0)
1197 if (LocaleCompare("iconGeometry",option+1) == 0)
1199 resource_info.icon_geometry=(char *) NULL;
1203 if (i == (ssize_t) argc)
1204 ThrowDisplayException(OptionError,"MissingArgument",option);
1205 if (IsGeometry(argv[i]) == MagickFalse)
1206 ThrowDisplayInvalidArgumentException(option,argv[i]);
1207 resource_info.icon_geometry=argv[i];
1210 if (LocaleCompare("iconic",option+1) == 0)
1212 resource_info.iconic=(*option == '-') ? MagickTrue : MagickFalse;
1215 if (LocaleCompare("immutable",option+1) == 0)
1217 resource_info.immutable=(*option == '-') ? MagickTrue : MagickFalse;
1220 if (LocaleCompare("interlace",option+1) == 0)
1228 if (i == (ssize_t) argc)
1229 ThrowDisplayException(OptionError,"MissingArgument",option);
1230 interlace=ParseCommandOption(MagickInterlaceOptions,MagickFalse,
1233 ThrowDisplayException(OptionError,"UnrecognizedInterlaceType",
1237 if (LocaleCompare("interpolate",option+1) == 0)
1245 if (i == (ssize_t) argc)
1246 ThrowDisplayException(OptionError,"MissingArgument",option);
1247 interpolate=ParseCommandOption(MagickInterpolateOptions,MagickFalse,
1249 if (interpolate < 0)
1250 ThrowDisplayException(OptionError,"UnrecognizedInterpolateMethod",
1254 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
1258 if (LocaleCompare("label",option+1) == 0)
1263 if (i == (ssize_t) argc)
1264 ThrowDisplayException(OptionError,"MissingArgument",option);
1267 if (LocaleCompare("limit",option+1) == 0)
1281 if (i == (ssize_t) argc)
1282 ThrowDisplayException(OptionError,"MissingArgument",option);
1283 resource=ParseCommandOption(MagickResourceOptions,MagickFalse,
1286 ThrowDisplayException(OptionError,"UnrecognizedResourceType",
1289 if (i == (ssize_t) argc)
1290 ThrowDisplayException(OptionError,"MissingArgument",option);
1291 value=StringToDouble(argv[i],&p);
1293 if ((p == argv[i]) && (LocaleCompare("unlimited",argv[i]) != 0))
1294 ThrowDisplayInvalidArgumentException(option,argv[i]);
1297 if (LocaleCompare("list",option+1) == 0)
1305 if (i == (ssize_t) argc)
1306 ThrowDisplayException(OptionError,"MissingArgument",option);
1307 list=ParseCommandOption(MagickListOptions,MagickFalse,argv[i]);
1309 ThrowDisplayException(OptionError,"UnrecognizedListType",argv[i]);
1310 status=MogrifyImageInfo(image_info,(int) (i-j+1),(const char **)
1313 return(status == 0 ? MagickFalse : MagickTrue);
1315 if (LocaleCompare("log",option+1) == 0)
1320 if ((i == (ssize_t) argc) ||
1321 (strchr(argv[i],'%') == (char *) NULL))
1322 ThrowDisplayException(OptionError,"MissingArgument",option);
1325 if (LocaleCompare("loop",option+1) == 0)
1330 if (i == (ssize_t) argc)
1331 ThrowDisplayException(OptionError,"MissingArgument",option);
1332 if (IsGeometry(argv[i]) == MagickFalse)
1333 ThrowDisplayInvalidArgumentException(option,argv[i]);
1334 iterations=StringToUnsignedLong(argv[i]);
1337 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
1341 if (LocaleCompare("magnify",option+1) == 0)
1343 resource_info.magnify=2;
1347 if (i == (ssize_t) argc)
1348 ThrowDisplayException(OptionError,"MissingArgument",option);
1349 if (IsGeometry(argv[i]) == MagickFalse)
1350 ThrowDisplayInvalidArgumentException(option,argv[i]);
1351 resource_info.magnify=(unsigned int) StringToUnsignedLong(argv[i]);
1354 if (LocaleCompare("map",option+1) == 0)
1356 resource_info.map_type=(char *) NULL;
1359 (void) strcpy(argv[i]+1,"san");
1361 if (i == (ssize_t) argc)
1362 ThrowDisplayException(OptionError,"MissingArgument",option);
1363 resource_info.map_type=argv[i];
1366 if (LocaleCompare("matte",option+1) == 0)
1368 if (LocaleCompare("mattecolor",option+1) == 0)
1373 if (i == (ssize_t) argc)
1374 ThrowDisplayException(OptionError,"MissingArgument",option);
1375 resource_info.matte_color=argv[i];
1378 if (LocaleCompare("monitor",option+1) == 0)
1380 if (LocaleCompare("monochrome",option+1) == 0)
1384 quantize_info->number_colors=2;
1385 quantize_info->colorspace=GRAYColorspace;
1388 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
1392 if (LocaleCompare("name",option+1) == 0)
1394 resource_info.name=(char *) NULL;
1398 if (i == (ssize_t) argc)
1399 ThrowDisplayException(OptionError,"MissingArgument",option);
1400 resource_info.name=ConstantString(argv[i]);
1403 if (LocaleCompare("negate",option+1) == 0)
1405 if (LocaleCompare("noop",option+1) == 0)
1407 if (LocaleCompare("normalize",option+1) == 0)
1409 if (LocaleCompare("nostdin",option+1) == 0)
1411 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
1415 if (LocaleCompare("page",option+1) == 0)
1417 resource_info.image_geometry=(char *) NULL;
1421 if (i == (ssize_t) argc)
1422 ThrowDisplayException(OptionError,"MissingArgument",option);
1423 resource_info.image_geometry=ConstantString(argv[i]);
1426 if (LocaleCompare("profile",option+1) == 0)
1429 if (i == (ssize_t) argc)
1430 ThrowDisplayException(OptionError,"MissingArgument",option);
1433 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
1437 if (LocaleCompare("quality",option+1) == 0)
1442 if (i == (ssize_t) argc)
1443 ThrowDisplayException(OptionError,"MissingArgument",option);
1444 if (IsGeometry(argv[i]) == MagickFalse)
1445 ThrowDisplayInvalidArgumentException(option,argv[i]);
1448 if (LocaleCompare("quantize",option+1) == 0)
1456 if (i == (ssize_t) argc)
1457 ThrowDisplayException(OptionError,"MissingArgument",option);
1458 colorspace=ParseCommandOption(MagickColorspaceOptions,
1459 MagickFalse,argv[i]);
1461 ThrowDisplayException(OptionError,"UnrecognizedColorspace",
1465 if (LocaleCompare("quiet",option+1) == 0)
1467 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
1471 if (LocaleCompare("raise",option+1) == 0)
1474 if (i == (ssize_t) argc)
1475 ThrowDisplayException(OptionError,"MissingArgument",option);
1476 if (IsGeometry(argv[i]) == MagickFalse)
1477 ThrowDisplayInvalidArgumentException(option,argv[i]);
1480 if (LocaleCompare("regard-warnings",option+1) == 0)
1482 if (LocaleCompare("remote",option+1) == 0)
1485 if (i == (ssize_t) argc)
1486 ThrowDisplayException(OptionError,"MissingArgument",option);
1487 if (XRemoteCommand(display,resource_info.window_id,argv[i]) != 0)
1488 return(MagickFalse);
1492 if (LocaleCompare("repage",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("resample",option+1) == 0)
1508 if (i == (ssize_t) argc)
1509 ThrowDisplayException(OptionError,"MissingArgument",option);
1510 if (IsGeometry(argv[i]) == MagickFalse)
1511 ThrowDisplayInvalidArgumentException(option,argv[i]);
1514 if (LocaleCompare("resize",option+1) == 0)
1519 if (i == (ssize_t) argc)
1520 ThrowDisplayException(OptionError,"MissingArgument",option);
1521 if (IsGeometry(argv[i]) == MagickFalse)
1522 ThrowDisplayInvalidArgumentException(option,argv[i]);
1525 if (LocaleNCompare("respect-parentheses",option+1,17) == 0)
1527 respect_parenthesis=(*option == '-') ? MagickTrue : MagickFalse;
1530 if (LocaleCompare("roll",option+1) == 0)
1535 if (i == (ssize_t) argc)
1536 ThrowDisplayException(OptionError,"MissingArgument",option);
1537 if (IsGeometry(argv[i]) == MagickFalse)
1538 ThrowDisplayInvalidArgumentException(option,argv[i]);
1541 if (LocaleCompare("rotate",option+1) == 0)
1544 if (i == (ssize_t) argc)
1545 ThrowDisplayException(OptionError,"MissingArgument",option);
1546 if (IsGeometry(argv[i]) == MagickFalse)
1547 ThrowDisplayInvalidArgumentException(option,argv[i]);
1550 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
1554 if (LocaleCompare("sample",option+1) == 0)
1559 if (i == (ssize_t) argc)
1560 ThrowDisplayException(OptionError,"MissingArgument",option);
1561 if (IsGeometry(argv[i]) == MagickFalse)
1562 ThrowDisplayInvalidArgumentException(option,argv[i]);
1565 if (LocaleCompare("sampling-factor",option+1) == 0)
1570 if (i == (ssize_t) argc)
1571 ThrowDisplayException(OptionError,"MissingArgument",option);
1572 if (IsGeometry(argv[i]) == MagickFalse)
1573 ThrowDisplayInvalidArgumentException(option,argv[i]);
1576 if (LocaleCompare("scenes",option+1) == 0)
1581 if (i == (ssize_t) argc)
1582 ThrowDisplayException(OptionError,"MissingArgument",option);
1583 if (IsSceneGeometry(argv[i],MagickFalse) == MagickFalse)
1584 ThrowDisplayInvalidArgumentException(option,argv[i]);
1587 if (LocaleCompare("seed",option+1) == 0)
1592 if (i == (ssize_t) argc)
1593 ThrowDisplayException(OptionError,"MissingArgument",option);
1594 if (IsGeometry(argv[i]) == MagickFalse)
1595 ThrowDisplayInvalidArgumentException(option,argv[i]);
1598 if (LocaleCompare("segment",option+1) == 0)
1603 if (i == (ssize_t) argc)
1604 ThrowDisplayException(OptionError,"MissingArgument",option);
1605 if (IsGeometry(argv[i]) == MagickFalse)
1606 ThrowDisplayInvalidArgumentException(option,argv[i]);
1609 if (LocaleCompare("set",option+1) == 0)
1612 if (i == (ssize_t) argc)
1613 ThrowDisplayException(OptionError,"MissingArgument",option);
1617 if (i == (ssize_t) argc)
1618 ThrowDisplayException(OptionError,"MissingArgument",option);
1621 if (LocaleCompare("sharpen",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("shared-memory",option+1) == 0)
1634 resource_info.use_shared_memory= (*option == '-') ? MagickTrue :
1638 if (LocaleCompare("size",option+1) == 0)
1643 if (i == (ssize_t) argc)
1644 ThrowDisplayException(OptionError,"MissingArgument",option);
1645 if (IsGeometry(argv[i]) == MagickFalse)
1646 ThrowDisplayInvalidArgumentException(option,argv[i]);
1649 if (LocaleCompare("strip",option+1) == 0)
1651 if (LocaleCompare("support",option+1) == 0)
1653 i++; /* deprecated */
1656 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
1660 if (LocaleCompare("text-font",option+1) == 0)
1662 resource_info.text_font=(char *) NULL;
1666 if (i == (ssize_t) argc)
1667 ThrowDisplayException(OptionError,"MissingArgument",option);
1668 resource_info.text_font=XGetResourceClass(resource_database,
1669 GetClientName(),"font",argv[i]);
1672 if (LocaleCompare("texture",option+1) == 0)
1677 if (i == (ssize_t) argc)
1678 ThrowDisplayException(OptionError,"MissingArgument",option);
1681 if (LocaleCompare("threshold",option+1) == 0)
1686 if (i == (ssize_t) argc)
1687 ThrowDisplayException(OptionError,"MissingArgument",option);
1688 if (IsGeometry(argv[i]) == MagickFalse)
1689 ThrowDisplayInvalidArgumentException(option,argv[i]);
1692 if (LocaleCompare("thumbnail",option+1) == 0)
1697 if (i == (ssize_t) argc)
1698 ThrowDisplayException(OptionError,"MissingArgument",option);
1699 if (IsGeometry(argv[i]) == MagickFalse)
1700 ThrowDisplayInvalidArgumentException(option,argv[i]);
1703 if (LocaleCompare("title",option+1) == 0)
1705 resource_info.title=(char *) NULL;
1709 if (i == (ssize_t) argc)
1710 ThrowDisplayException(OptionError,"MissingArgument",option);
1711 resource_info.title=argv[i];
1714 if (LocaleCompare("transparent-color",option+1) == 0)
1719 if (i == (ssize_t) argc)
1720 ThrowDisplayException(OptionError,"MissingArgument",option);
1723 if (LocaleCompare("treedepth",option+1) == 0)
1725 quantize_info->tree_depth=0;
1729 if (i == (ssize_t) argc)
1730 ThrowDisplayException(OptionError,"MissingArgument",option);
1731 if (IsGeometry(argv[i]) == MagickFalse)
1732 ThrowDisplayInvalidArgumentException(option,argv[i]);
1733 quantize_info->tree_depth=StringToUnsignedLong(argv[i]);
1736 if (LocaleCompare("trim",option+1) == 0)
1738 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
1742 if (LocaleCompare("update",option+1) == 0)
1744 resource_info.update=(unsigned int) (*option == '-');
1748 if (i == (ssize_t) argc)
1749 ThrowDisplayException(OptionError,"MissingArgument",option);
1750 if (IsGeometry(argv[i]) == MagickFalse)
1751 ThrowDisplayInvalidArgumentException(option,argv[i]);
1752 resource_info.update=(unsigned int) StringToUnsignedLong(argv[i]);
1755 if (LocaleCompare("use-pixmap",option+1) == 0)
1757 resource_info.use_pixmap=(*option == '-') ? MagickTrue :
1761 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
1765 if (LocaleCompare("verbose",option+1) == 0)
1767 if ((LocaleCompare("version",option+1) == 0) ||
1768 (LocaleCompare("-version",option+1) == 0))
1770 ListMagickVersion(stdout);
1773 if (LocaleCompare("visual",option+1) == 0)
1775 resource_info.visual_type=(char *) NULL;
1779 if (i == (ssize_t) argc)
1780 ThrowDisplayException(OptionError,"MissingArgument",option);
1781 resource_info.visual_type=argv[i];
1784 if (LocaleCompare("virtual-pixel",option+1) == 0)
1792 if (i == (ssize_t) argc)
1793 ThrowDisplayException(OptionError,"MissingArgument",option);
1794 method=ParseCommandOption(MagickVirtualPixelOptions,MagickFalse,
1797 ThrowDisplayException(OptionError,
1798 "UnrecognizedVirtualPixelMethod",argv[i]);
1801 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
1805 if (LocaleCompare("window",option+1) == 0)
1807 resource_info.window_id=(char *) NULL;
1811 if (i == (ssize_t) argc)
1812 ThrowDisplayException(OptionError,"MissingArgument",option);
1813 resource_info.window_id=argv[i];
1816 if (LocaleCompare("window-group",option+1) == 0)
1818 resource_info.window_group=(char *) NULL;
1822 if (i == (ssize_t) argc)
1823 ThrowDisplayException(OptionError,"MissingArgument",option);
1824 if (StringToDouble(argv[i],(char **) NULL) != 0)
1825 resource_info.window_group=argv[i];
1828 if (LocaleCompare("write",option+1) == 0)
1830 resource_info.write_filename=(char *) NULL;
1834 if (i == (ssize_t) argc)
1835 ThrowDisplayException(OptionError,"MissingArgument",option);
1836 resource_info.write_filename=argv[i];
1837 if (IsPathAccessible(resource_info.write_filename) != MagickFalse)
1843 (void) FormatLocaleFile(stderr,"Overwrite %s? ",
1844 resource_info.write_filename);
1845 p=fgets(answer,(int) sizeof(answer),stdin);
1847 if (((*answer != 'y') && (*answer != 'Y')))
1848 return(MagickFalse);
1852 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
1857 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
1859 fire=(GetCommandOptionFlags(MagickCommandOptions,MagickFalse,option) &
1860 FireOptionFlag) == 0 ? MagickFalse : MagickTrue;
1861 if (fire != MagickFalse)
1862 FireImageStack(MagickFalse,MagickTrue,MagickTrue);
1865 ThrowDisplayException(OptionError,"UnbalancedParenthesis",argv[i]);
1866 if (state & RetainColorsState)
1868 XRetainWindowColors(display,XRootWindow(display,XDefaultScreen(display)));
1869 (void) XSync(display,MagickFalse);
1872 return(status != 0 ? MagickTrue : MagickFalse);
1874 wand_unreferenced(argc);
1875 wand_unreferenced(argv);
1876 wand_unreferenced(metadata);
1877 (void) ThrowMagickException(exception,GetMagickModule(),MissingDelegateError,
1878 "DelegateLibrarySupportNotBuiltIn","'%s' (X11)",image_info->filename);
1879 return(DisplayUsage());