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-2012 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 % http://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/nt-base-private.h"
49 #include "MagickCore/string-private.h"
50 #include "MagickCore/xwindow-private.h"
53 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
57 + D i s p l a y I m a g e C o m m a n d %
61 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
63 % DisplayImageCommand() displays a sequence of images on any workstation
64 % display running an X server. Display first determines the hardware
65 % capabilities of the workstation. If the number of unique colors in an image
66 % is less than or equal to the number the workstation can support, the image
67 % is displayed in an X window. Otherwise the number of colors in the image is
68 % first reduced to match the color resolution of the workstation before it is
71 % This means that a continuous-tone 24 bits/pixel image can display on a 8
72 % bit pseudo-color device or monochrome device. In most instances the reduced
73 % color image closely resembles the original. Alternatively, a monochrome or
74 % pseudo-color image sequence can display on a continuous-tone 24 bits/pixels
77 % The format of the DisplayImageCommand method is:
79 % MagickBooleanType DisplayImageCommand(ImageInfo *image_info,int argc,
80 % char **argv,char **metadata,ExceptionInfo *exception)
82 % A description of each parameter follows:
84 % o image_info: the image info.
86 % o argc: the number of elements in the argument vector.
88 % o argv: A text array containing the command line arguments.
90 % o metadata: any metadata is returned here.
92 % o exception: return any errors or warnings in this structure.
96 static MagickBooleanType DisplayUsage(void)
104 "1 press to map or unmap the Command widget",
105 "2 press and drag to magnify a region of an image",
106 "3 press to load an image from a visual image directory",
111 "-debug events display copious debugging information",
112 "-help print program options",
113 "-list type print a list of supported option arguments",
114 "-log format format of debugging information",
115 "-version print version information",
120 "-auto-orient automagically orient image",
121 "-border geometry surround image with a border of color",
122 "-clip clip along the first path from the 8BIM profile",
123 "-clip-path id clip along a named path from the 8BIM profile",
124 "-colors value preferred number of colors in the image",
125 "-contrast enhance or reduce the image contrast",
126 "-crop geometry preferred size and location of the cropped image",
127 "-decipher filename convert cipher pixels to plain pixels",
128 "-deskew threshold straighten an image",
129 "-despeckle reduce the speckles within an image",
130 "-edge factor apply a filter to detect edges in the image",
131 "-enhance apply a digital filter to enhance a noisy image",
132 "-equalize perform histogram equalization to an image",
133 "-extract geometry extract area from image",
134 "-flip flip image in the vertical direction",
135 "-flop flop image in the horizontal direction",
136 "-frame geometry surround image with an ornamental border",
137 "-fuzz distance colors within this distance are considered equal",
138 "-gamma value level of gamma correction",
139 "-monochrome transform image to black and white",
140 "-negate replace every pixel with its complementary color",
141 "-normalize transform image to span the full range of colors",
142 "-raise value lighten/darken image edges to create a 3-D effect",
143 "-resample geometry change the resolution of an image",
144 "-resize geometry resize the image",
145 "-roll geometry roll an image vertically or horizontally",
146 "-rotate degrees apply Paeth rotation to the image",
147 "-sample geometry scale image with pixel sampling",
148 "-segment value segment an image",
149 "-sharpen geometry sharpen the image",
150 "-strip strip image of all profiles and comments",
151 "-threshold value threshold the image",
152 "-thumbnail geometry create a thumbnail of the image",
153 "-trim trim image edges",
158 "-alpha option on, activate, off, deactivate, set, opaque, copy",
159 " transparent, extract, background, or shape",
160 "-antialias remove pixel-aliasing",
161 "-authenticate password",
162 " decipher image with this password",
163 "-backdrop display image centered on a backdrop",
164 "-channel type apply option to select image channels",
165 "-colormap type Shared or Private",
166 "-colorspace type alternate image colorspace",
167 "-comment string annotate image with comment",
168 "-compress type type of pixel compression when writing the image",
169 "-define format:option",
170 " define one or more image format options",
171 "-delay value display the next image after pausing",
172 "-density geometry horizontal and vertical density of the image",
173 "-depth value image depth",
174 "-display server display image to this X server",
175 "-dispose method layer disposal method",
176 "-dither method apply error diffusion to image",
177 "-endian type endianness (MSB or LSB) of the image",
178 "-filter type use this filter when resizing an image",
179 "-format string output formatted image characteristics",
180 "-geometry geometry preferred size and location of the Image window",
181 "-gravity type horizontal and vertical backdrop placement",
182 "-identify identify the format and characteristics of the image",
183 "-immutable displayed image cannot be modified",
184 "-interlace type type of image interlacing scheme",
185 "-interpolate method pixel color interpolation method",
186 "-label string assign a label to an image",
187 "-limit type value pixel cache resource limit",
188 "-loop iterations loop images then exit",
189 "-map type display image using this Standard Colormap",
190 "-monitor monitor progress",
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 "-seed value seed a new sequence of pseudo-random numbers",
203 "-set property value set an image property",
204 "-size geometry width and height of image",
205 "-texture filename name of texture to tile onto the image background",
206 "-transparent-color color",
207 " transparent color",
208 "-treedepth value color tree depth",
209 "-update seconds detect when image file is modified and redisplay",
210 "-verbose print detailed information about the image",
211 "-visual type display image using this visual type",
212 "-virtual-pixel method",
213 " virtual pixel access method",
214 "-window id display image to background of this window",
215 "-window-group id exit program when this window id is destroyed",
216 "-write filename write image to a file",
219 *sequence_operators[]=
221 "-coalesce merge a sequence of images",
222 "-flatten flatten a sequence of images",
226 (void) printf("Version: %s\n",GetMagickVersion((size_t *) NULL));
227 (void) printf("Copyright: %s\n",GetMagickCopyright());
228 (void) printf("Features: %s\n\n",GetMagickFeatures());
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 "-borderwidth, -font, -foreground, -iconGeometry, -iconic, -mattecolor,\n");
249 (void) printf("-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];
353 assert(image_info != (ImageInfo *) NULL);
354 assert(image_info->signature == MagickSignature);
355 if (image_info->debug != MagickFalse)
356 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");
357 assert(exception != (ExceptionInfo *) NULL);
361 if ((LocaleCompare("version",option+1) == 0) ||
362 (LocaleCompare("-version",option+1) == 0))
364 (void) FormatLocaleFile(stdout,"Version: %s\n",
365 GetMagickVersion((size_t *) NULL));
366 (void) FormatLocaleFile(stdout,"Copyright: %s\n",
367 GetMagickCopyright());
368 (void) FormatLocaleFile(stdout,"Features: %s\n\n",
369 GetMagickFeatures());
374 display=(Display *) NULL;
377 image_marker=(size_t *) NULL;
381 option=(char *) NULL;
383 respect_parenthesis=MagickFalse;
384 resource_database=(XrmDatabase) NULL;
385 (void) ResetMagickMemory(&resource_info,0,sizeof(resource_info));
386 server_name=(char *) NULL;
389 ReadCommandlLine(argc,&argv);
390 status=ExpandFilenames(&argc,&argv);
391 if (status == MagickFalse)
392 ThrowDisplayException(ResourceLimitError,"MemoryAllocationFailed",
393 GetExceptionMessage(errno));
394 image_marker=(size_t *) AcquireQuantumMemory((size_t) argc+1UL,
395 sizeof(*image_marker));
396 if (image_marker == (size_t *) NULL)
397 ThrowDisplayException(ResourceLimitError,"MemoryAllocationFailed",
398 GetExceptionMessage(errno));
399 for (i=0; i <= (ssize_t) argc; i++)
400 image_marker[i]=(size_t) argc;
402 Check for server name specified on the command line.
404 for (i=1; i < (ssize_t) argc; i++)
407 Check command line for server name.
410 if (LocaleCompare("display",option+1) == 0)
413 User specified server name.
416 if (i == (ssize_t) argc)
417 ThrowDisplayException(OptionError,"MissingArgument",option);
420 if ((LocaleCompare("help",option+1) == 0) ||
421 (LocaleCompare("-help",option+1) == 0))
422 return(DisplayUsage());
425 Get user defaults from X resource database.
427 display=XOpenDisplay(server_name);
428 if (display == (Display *) NULL)
429 ThrowDisplayException(XServerError,"UnableToOpenXServer",
430 XDisplayName(server_name));
431 (void) XSetErrorHandler(XError);
432 resource_database=XGetResourceDatabase(display,GetClientName());
433 XGetResourceInfo(image_info,resource_database,GetClientName(),
435 quantize_info=resource_info.quantize_info;
436 image_info->density=XGetResourceInstance(resource_database,GetClientName(),
437 "density",(char *) NULL);
438 if (image_info->density == (char *) NULL)
439 image_info->density=XGetScreenDensity(display);
440 resource_value=XGetResourceInstance(resource_database,GetClientName(),
442 image_info->interlace=(InterlaceType)
443 ParseCommandOption(MagickInterlaceOptions,MagickFalse,resource_value);
444 image_info->page=XGetResourceInstance(resource_database,GetClientName(),
445 "pageGeometry",(char *) NULL);
446 resource_value=XGetResourceInstance(resource_database,GetClientName(),
448 image_info->quality=StringToUnsignedLong(resource_value);
449 resource_value=XGetResourceInstance(resource_database,GetClientName(),
451 image_info->verbose=IsStringTrue(resource_value);
452 resource_value=XGetResourceInstance(resource_database,GetClientName(),
454 quantize_info->dither=IsStringTrue(resource_value);
459 for (i=1; ((i <= (ssize_t) argc) && ((state & ExitState) == 0)); i++)
461 if (i < (ssize_t) argc)
464 if (image != (Image *) NULL)
467 if (isatty(STDIN_FILENO) != MagickFalse)
483 if (LocaleCompare(option,"(") == 0)
485 FireImageStack(MagickFalse,MagickTrue,pend);
486 if (k == MaxImageStackDepth)
487 ThrowDisplayException(OptionError,"ParenthesisNestedTooDeeply",
492 if (LocaleCompare(option,")") == 0)
494 FireImageStack(MagickFalse,MagickTrue,MagickTrue);
496 ThrowDisplayException(OptionError,"UnableToParseExpression",option);
500 if (IsCommandOption(option) == MagickFalse)
511 Option is a file name.
513 FireImageStack(MagickFalse,MagickFalse,pend);
515 if ((LocaleCompare(filename,"--") == 0) && (i < (ssize_t) (argc-1)))
520 (void) CopyMagickString(image_info->filename,filename,MaxTextExtent);
521 images=ReadImage(image_info,exception);
522 CatchException(exception);
523 status&=(images != (Image *) NULL) &&
524 (exception->severity < ErrorException);
525 if (images == (Image *) NULL)
527 AppendImageStack(images);
528 FinalizeImageSettings(image_info,image,MagickFalse);
530 if (i == (ssize_t) (argc-1))
531 iterations=image->iterations;
532 image_list=CloneImageList(image,exception);
533 if (image_list == (Image *) NULL)
534 ThrowDisplayException(ResourceLimitError,"MemoryAllocationFailed",
535 GetExceptionMessage(errno));
536 display_image=image_list;
540 Transmogrify image as defined by the image processing options.
542 resource_info.quantum=1;
543 if (resource_info.window_id != (char *) NULL)
546 Display image to a specified X window.
548 status=XDisplayBackgroundImage(display,&resource_info,
549 display_image,exception);
550 if (status != MagickFalse)
552 state|=RetainColorsState;
563 Display image to X server.
565 if (resource_info.delay != 1)
566 display_image->delay=resource_info.delay;
567 nexus=XDisplayImage(display,&resource_info,argv,argc,
568 &display_image,&state,exception);
569 status&=nexus != (Image *) NULL;
570 if (nexus == (Image *) NULL)
572 while ((nexus != (Image *) NULL) && ((state & ExitState) == 0))
577 if (nexus->montage != (char *) NULL)
580 User selected a visual directory image (montage).
585 next=XDisplayImage(display,&resource_info,argv,argc,&nexus,
587 if ((next == (Image *) NULL) &&
588 (GetNextImageInList(nexus) != (Image *) NULL))
590 display_image=GetNextImageInList(nexus);
591 nexus=NewImageList();
595 if (nexus != display_image)
596 nexus=DestroyImageList(nexus);
600 } while ((state & ExitState) == 0);
601 if (resource_info.write_filename != (char *) NULL)
606 (void) CopyMagickString(display_image->filename,
607 resource_info.write_filename,MaxTextExtent);
608 (void) SetImageInfo(image_info,1,exception);
609 status&=WriteImage(image_info,display_image,exception);
612 Proceed to next/previous image.
614 if ((state & FormerImageState) != 0)
615 for (l=0; l < (ssize_t) resource_info.quantum; l++)
617 display_image=GetPreviousImageInList(display_image);
618 if (display_image == (Image *) NULL)
622 for (l=0; l < (ssize_t) resource_info.quantum; l++)
624 display_image=GetNextImageInList(display_image);
625 if (display_image == (Image *) NULL)
628 } while ((display_image != (Image *) NULL) && ((state & ExitState) == 0));
630 Free image resources.
632 display_image=DestroyImageList(display_image);
633 if (image_list != display_image)
634 image_list=DestroyImageList(image_list);
635 if ((state & FormerImageState) == 0)
637 last_image=(size_t) image_number;
638 image_marker[i]=(size_t) image_number++;
643 Proceed to previous image.
645 for (i--; i > 0; i--)
646 if (image_marker[i] == (size_t) (image_number-2))
650 if ((i == (ssize_t) (argc-1)) && ((state & ExitState) == 0))
652 if ((state & ExitState) != 0)
655 Determine if we should proceed to the first image.
657 if (image_number < 0)
659 if ((state & FormerImageState) != 0)
662 for (i=1; i < (ssize_t) (argc-2); i++)
663 if (last_image == image_marker[i])
665 image_number=(ssize_t) image_marker[i]+1;
669 if (resource_info.window_id != (char *) NULL)
671 if ((iterations != 0) && (++iteration == (ssize_t) iterations))
673 if (LocaleCompare(filename,"-") == 0)
675 RemoveAllImageStack();
678 pend=image != (Image *) NULL ? MagickTrue : MagickFalse;
683 if (LocaleCompare("alpha",option+1) == 0)
691 if (i == (ssize_t) argc)
692 ThrowDisplayException(OptionError,"MissingArgument",option);
693 type=ParseCommandOption(MagickAlphaOptions,MagickFalse,argv[i]);
695 ThrowDisplayException(OptionError,"UnrecognizedAlphaChannelType",
699 if (LocaleCompare("antialias",option+1) == 0)
701 if (LocaleCompare("authenticate",option+1) == 0)
706 if (i == (ssize_t) argc)
707 ThrowDisplayException(OptionError,"MissingArgument",option);
710 if (LocaleCompare("auto-orient",option+1) == 0)
712 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
716 if (LocaleCompare("backdrop",option+1) == 0)
718 resource_info.backdrop=(*option == '-') ? MagickTrue : MagickFalse;
721 if (LocaleCompare("background",option+1) == 0)
726 if (i == (ssize_t) argc)
727 ThrowDisplayException(OptionError,"MissingArgument",option);
728 resource_info.background_color=argv[i];
731 if (LocaleCompare("border",option+1) == 0)
736 if (i == (ssize_t) argc)
737 ThrowDisplayException(OptionError,"MissingArgument",option);
738 if (IsGeometry(argv[i]) == MagickFalse)
739 ThrowDisplayInvalidArgumentException(option,argv[i]);
742 if (LocaleCompare("bordercolor",option+1) == 0)
747 if (i == (ssize_t) argc)
748 ThrowDisplayException(OptionError,"MissingArgument",option);
749 resource_info.border_color=argv[i];
752 if (LocaleCompare("borderwidth",option+1) == 0)
754 resource_info.border_width=0;
758 if (i == (ssize_t) argc)
759 ThrowDisplayException(OptionError,"MissingArgument",option);
760 if (IsGeometry(argv[i]) == MagickFalse)
761 ThrowDisplayInvalidArgumentException(option,argv[i]);
762 resource_info.border_width=(unsigned int)
763 StringToUnsignedLong(argv[i]);
766 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
770 if (LocaleCompare("cache",option+1) == 0)
775 if (i == (ssize_t) argc)
776 ThrowDisplayException(OptionError,"MissingArgument",option);
777 if (IsGeometry(argv[i]) == MagickFalse)
778 ThrowDisplayInvalidArgumentException(option,argv[i]);
781 if (LocaleCompare("channel",option+1) == 0)
789 if (i == (ssize_t) (argc-1))
790 ThrowDisplayException(OptionError,"MissingArgument",option);
791 channel=ParseChannelOption(argv[i]);
793 ThrowDisplayException(OptionError,"UnrecognizedChannelType",
797 if (LocaleCompare("clip",option+1) == 0)
799 if (LocaleCompare("clip-path",option+1) == 0)
802 if (i == (ssize_t) argc)
803 ThrowDisplayException(OptionError,"MissingArgument",option);
806 if (LocaleCompare("coalesce",option+1) == 0)
808 if (LocaleCompare("colormap",option+1) == 0)
810 resource_info.colormap=PrivateColormap;
814 if (i == (ssize_t) argc)
815 ThrowDisplayException(OptionError,"MissingArgument",option);
816 resource_info.colormap=UndefinedColormap;
817 if (LocaleCompare("private",argv[i]) == 0)
818 resource_info.colormap=PrivateColormap;
819 if (LocaleCompare("shared",argv[i]) == 0)
820 resource_info.colormap=SharedColormap;
821 if (resource_info.colormap == UndefinedColormap)
822 ThrowDisplayException(OptionError,"UnrecognizedColormapType",
826 if (LocaleCompare("colors",option+1) == 0)
828 quantize_info->number_colors=0;
832 if (i == (ssize_t) argc)
833 ThrowDisplayException(OptionError,"MissingArgument",option);
834 if (IsGeometry(argv[i]) == MagickFalse)
835 ThrowDisplayInvalidArgumentException(option,argv[i]);
836 quantize_info->number_colors=StringToUnsignedLong(argv[i]);
839 if (LocaleCompare("colorspace",option+1) == 0)
847 if (i == (ssize_t) argc)
848 ThrowDisplayException(OptionError,"MissingArgument",option);
849 colorspace=ParseCommandOption(MagickColorspaceOptions,
850 MagickFalse,argv[i]);
852 ThrowDisplayException(OptionError,"UnrecognizedColorspace",
856 if (LocaleCompare("comment",option+1) == 0)
861 if (i == (ssize_t) argc)
862 ThrowDisplayException(OptionError,"MissingArgument",option);
865 if (LocaleCompare("compress",option+1) == 0)
873 if (i == (ssize_t) argc)
874 ThrowDisplayException(OptionError,"MissingArgument",option);
875 compress=ParseCommandOption(MagickCompressOptions,MagickFalse,
878 ThrowDisplayException(OptionError,"UnrecognizedImageCompression",
882 if (LocaleCompare("concurrent",option+1) == 0)
884 if (LocaleCompare("contrast",option+1) == 0)
886 if (LocaleCompare("crop",option+1) == 0)
891 if (i == (ssize_t) argc)
892 ThrowDisplayException(OptionError,"MissingArgument",option);
893 if (IsGeometry(argv[i]) == MagickFalse)
894 ThrowDisplayInvalidArgumentException(option,argv[i]);
897 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
901 if (LocaleCompare("debug",option+1) == 0)
909 if (i == (ssize_t) argc)
910 ThrowDisplayException(OptionError,"MissingArgument",option);
911 event=ParseCommandOption(MagickLogEventOptions,MagickFalse,argv[i]);
913 ThrowDisplayException(OptionError,"UnrecognizedEventType",
915 (void) SetLogEventMask(argv[i]);
918 if (LocaleCompare("decipher",option+1) == 0)
923 if (i == (ssize_t) (argc-1))
924 ThrowDisplayException(OptionError,"MissingArgument",option);
927 if (LocaleCompare("define",option+1) == 0)
930 if (i == (ssize_t) argc)
931 ThrowDisplayException(OptionError,"MissingArgument",option);
937 define=GetImageOption(image_info,argv[i]);
938 if (define == (const char *) NULL)
939 ThrowDisplayException(OptionError,"NoSuchOption",argv[i]);
944 if (LocaleCompare("delay",option+1) == 0)
949 if (i == (ssize_t) argc)
950 ThrowDisplayException(OptionError,"MissingArgument",option);
951 if (IsGeometry(argv[i]) == MagickFalse)
952 ThrowDisplayInvalidArgumentException(option,argv[i]);
955 if (LocaleCompare("density",option+1) == 0)
960 if (i == (ssize_t) argc)
961 ThrowDisplayException(OptionError,"MissingArgument",option);
962 if (IsGeometry(argv[i]) == MagickFalse)
963 ThrowDisplayInvalidArgumentException(option,argv[i]);
966 if (LocaleCompare("depth",option+1) == 0)
971 if (i == (ssize_t) argc)
972 ThrowDisplayException(OptionError,"MissingArgument",option);
973 if (IsGeometry(argv[i]) == MagickFalse)
974 ThrowDisplayInvalidArgumentException(option,argv[i]);
977 if (LocaleCompare("deskew",option+1) == 0)
982 if (i == (ssize_t) (argc-1))
983 ThrowDisplayException(OptionError,"MissingArgument",option);
984 if (IsGeometry(argv[i]) == MagickFalse)
985 ThrowDisplayInvalidArgumentException(option,argv[i]);
988 if (LocaleCompare("despeckle",option+1) == 0)
990 if (LocaleCompare("display",option+1) == 0)
995 if (i == (ssize_t) argc)
996 ThrowDisplayException(OptionError,"MissingArgument",option);
999 if (LocaleCompare("dispose",option+1) == 0)
1007 if (i == (ssize_t) argc)
1008 ThrowDisplayException(OptionError,"MissingArgument",option);
1009 dispose=ParseCommandOption(MagickDisposeOptions,MagickFalse,argv[i]);
1011 ThrowDisplayException(OptionError,"UnrecognizedDisposeMethod",
1015 if (LocaleCompare("dither",option+1) == 0)
1020 quantize_info->dither=MagickFalse;
1024 if (i == (ssize_t) argc)
1025 ThrowDisplayException(OptionError,"MissingArgument",option);
1026 method=ParseCommandOption(MagickDitherOptions,MagickFalse,argv[i]);
1028 ThrowDisplayException(OptionError,"UnrecognizedDitherMethod",
1030 quantize_info->dither=MagickTrue;
1031 quantize_info->dither_method=(DitherMethod) method;
1034 if (LocaleCompare("duration",option+1) == 0)
1039 if (i == (ssize_t) (argc-1))
1040 ThrowDisplayException(OptionError,"MissingArgument",option);
1041 if (IsGeometry(argv[i]) == MagickFalse)
1042 ThrowDisplayInvalidArgumentException(option,argv[i]);
1045 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
1049 if (LocaleCompare("edge",option+1) == 0)
1054 if (i == (ssize_t) argc)
1055 ThrowDisplayException(OptionError,"MissingArgument",option);
1056 if (IsGeometry(argv[i]) == MagickFalse)
1057 ThrowDisplayInvalidArgumentException(option,argv[i]);
1060 if (LocaleCompare("endian",option+1) == 0)
1068 if (i == (ssize_t) argc)
1069 ThrowDisplayException(OptionError,"MissingArgument",option);
1070 endian=ParseCommandOption(MagickEndianOptions,MagickFalse,
1073 ThrowDisplayException(OptionError,"UnrecognizedEndianType",
1077 if (LocaleCompare("enhance",option+1) == 0)
1079 if (LocaleCompare("equalize",option+1) == 0)
1081 if (LocaleCompare("extract",option+1) == 0)
1086 if (i == (ssize_t) argc)
1087 ThrowDisplayException(OptionError,"MissingArgument",option);
1088 if (IsGeometry(argv[i]) == MagickFalse)
1089 ThrowDisplayInvalidArgumentException(option,argv[i]);
1092 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
1096 if (LocaleCompare("filter",option+1) == 0)
1104 if (i == (ssize_t) argc)
1105 ThrowDisplayException(OptionError,"MissingArgument",option);
1106 filter=ParseCommandOption(MagickFilterOptions,MagickFalse,argv[i]);
1108 ThrowDisplayException(OptionError,"UnrecognizedImageFilter",
1112 if (LocaleCompare("flatten",option+1) == 0)
1114 if (LocaleCompare("flip",option+1) == 0)
1116 if (LocaleCompare("flop",option+1) == 0)
1118 if (LocaleCompare("font",option+1) == 0)
1123 if (i == (ssize_t) argc)
1124 ThrowDisplayException(OptionError,"MissingArgument",option);
1125 resource_info.font=XGetResourceClass(resource_database,
1126 GetClientName(),"font",argv[i]);
1129 if (LocaleCompare("foreground",option+1) == 0)
1134 if (i == (ssize_t) argc)
1135 ThrowDisplayException(OptionError,"MissingArgument",option);
1136 resource_info.foreground_color=argv[i];
1139 if (LocaleCompare("format",option+1) == 0)
1144 if (i == (ssize_t) (argc-1))
1145 ThrowDisplayException(OptionError,"MissingArgument",option);
1148 if (LocaleCompare("frame",option+1) == 0)
1153 if (i == (ssize_t) argc)
1154 ThrowDisplayException(OptionError,"MissingArgument",option);
1155 if (IsGeometry(argv[i]) == MagickFalse)
1156 ThrowDisplayInvalidArgumentException(option,argv[i]);
1159 if (LocaleCompare("fuzz",option+1) == 0)
1164 if (i == (ssize_t) (argc-1))
1165 ThrowDisplayException(OptionError,"MissingArgument",option);
1166 if (IsGeometry(argv[i]) == MagickFalse)
1167 ThrowDisplayInvalidArgumentException(option,argv[i]);
1170 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
1174 if (LocaleCompare("gamma",option+1) == 0)
1177 if (i == (ssize_t) argc)
1178 ThrowDisplayException(OptionError,"MissingArgument",option);
1179 if (IsGeometry(argv[i]) == MagickFalse)
1180 ThrowDisplayInvalidArgumentException(option,argv[i]);
1183 if (LocaleCompare("geometry",option+1) == 0)
1185 resource_info.image_geometry=(char *) NULL;
1188 (void) CopyMagickString(argv[i]+1,"sans",MaxTextExtent);
1190 if (i == (ssize_t) argc)
1191 ThrowDisplayException(OptionError,"MissingArgument",option);
1192 if (IsGeometry(argv[i]) == MagickFalse)
1193 ThrowDisplayInvalidArgumentException(option,argv[i]);
1194 resource_info.image_geometry=ConstantString(argv[i]);
1197 if (LocaleCompare("gravity",option+1) == 0)
1205 if (i == (ssize_t) (argc-1))
1206 ThrowDisplayException(OptionError,"MissingArgument",option);
1207 gravity=ParseCommandOption(MagickGravityOptions,MagickFalse,
1210 ThrowDisplayException(OptionError,"UnrecognizedGravityType",
1214 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
1218 if ((LocaleCompare("help",option+1) == 0) ||
1219 (LocaleCompare("-help",option+1) == 0))
1221 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
1225 if (LocaleCompare("identify",option+1) == 0)
1227 if (LocaleCompare("iconGeometry",option+1) == 0)
1229 resource_info.icon_geometry=(char *) NULL;
1233 if (i == (ssize_t) argc)
1234 ThrowDisplayException(OptionError,"MissingArgument",option);
1235 if (IsGeometry(argv[i]) == MagickFalse)
1236 ThrowDisplayInvalidArgumentException(option,argv[i]);
1237 resource_info.icon_geometry=argv[i];
1240 if (LocaleCompare("iconic",option+1) == 0)
1242 resource_info.iconic=(*option == '-') ? MagickTrue : MagickFalse;
1245 if (LocaleCompare("immutable",option+1) == 0)
1247 resource_info.immutable=(*option == '-') ? MagickTrue : MagickFalse;
1250 if (LocaleCompare("interlace",option+1) == 0)
1258 if (i == (ssize_t) argc)
1259 ThrowDisplayException(OptionError,"MissingArgument",option);
1260 interlace=ParseCommandOption(MagickInterlaceOptions,MagickFalse,
1263 ThrowDisplayException(OptionError,"UnrecognizedInterlaceType",
1267 if (LocaleCompare("interpolate",option+1) == 0)
1275 if (i == (ssize_t) argc)
1276 ThrowDisplayException(OptionError,"MissingArgument",option);
1277 interpolate=ParseCommandOption(MagickInterpolateOptions,MagickFalse,
1279 if (interpolate < 0)
1280 ThrowDisplayException(OptionError,"UnrecognizedInterpolateMethod",
1284 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
1288 if (LocaleCompare("label",option+1) == 0)
1293 if (i == (ssize_t) argc)
1294 ThrowDisplayException(OptionError,"MissingArgument",option);
1297 if (LocaleCompare("limit",option+1) == 0)
1311 if (i == (ssize_t) argc)
1312 ThrowDisplayException(OptionError,"MissingArgument",option);
1313 resource=ParseCommandOption(MagickResourceOptions,MagickFalse,
1316 ThrowDisplayException(OptionError,"UnrecognizedResourceType",
1319 if (i == (ssize_t) argc)
1320 ThrowDisplayException(OptionError,"MissingArgument",option);
1321 value=StringToDouble(argv[i],&p);
1323 if ((p == argv[i]) && (LocaleCompare("unlimited",argv[i]) != 0))
1324 ThrowDisplayInvalidArgumentException(option,argv[i]);
1327 if (LocaleCompare("list",option+1) == 0)
1335 if (i == (ssize_t) argc)
1336 ThrowDisplayException(OptionError,"MissingArgument",option);
1337 list=ParseCommandOption(MagickListOptions,MagickFalse,argv[i]);
1339 ThrowDisplayException(OptionError,"UnrecognizedListType",argv[i]);
1340 status=MogrifyImageInfo(image_info,(int) (i-j+1),(const char **)
1343 return(status != 0 ? MagickFalse : MagickTrue);
1345 if (LocaleCompare("log",option+1) == 0)
1350 if ((i == (ssize_t) argc) ||
1351 (strchr(argv[i],'%') == (char *) NULL))
1352 ThrowDisplayException(OptionError,"MissingArgument",option);
1355 if (LocaleCompare("loop",option+1) == 0)
1360 if (i == (ssize_t) (argc-1))
1361 ThrowDisplayException(OptionError,"MissingArgument",option);
1362 if (IsGeometry(argv[i]) == MagickFalse)
1363 ThrowDisplayInvalidArgumentException(option,argv[i]);
1364 iterations=StringToUnsignedLong(argv[i]);
1367 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
1371 if (LocaleCompare("magnify",option+1) == 0)
1373 resource_info.magnify=2;
1377 if (i == (ssize_t) argc)
1378 ThrowDisplayException(OptionError,"MissingArgument",option);
1379 if (IsGeometry(argv[i]) == MagickFalse)
1380 ThrowDisplayInvalidArgumentException(option,argv[i]);
1381 resource_info.magnify=(unsigned int) StringToUnsignedLong(argv[i]);
1384 if (LocaleCompare("map",option+1) == 0)
1386 resource_info.map_type=(char *) NULL;
1389 (void) strcpy(argv[i]+1,"san");
1391 if (i == (ssize_t) argc)
1392 ThrowDisplayException(OptionError,"MissingArgument",option);
1393 resource_info.map_type=argv[i];
1396 if (LocaleCompare("matte",option+1) == 0)
1398 if (LocaleCompare("mattecolor",option+1) == 0)
1403 if (i == (ssize_t) argc)
1404 ThrowDisplayException(OptionError,"MissingArgument",option);
1405 resource_info.matte_color=argv[i];
1408 if (LocaleCompare("monitor",option+1) == 0)
1410 if (LocaleCompare("monochrome",option+1) == 0)
1414 quantize_info->number_colors=2;
1415 quantize_info->colorspace=GRAYColorspace;
1418 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
1422 if (LocaleCompare("name",option+1) == 0)
1424 resource_info.name=(char *) NULL;
1428 if (i == (ssize_t) argc)
1429 ThrowDisplayException(OptionError,"MissingArgument",option);
1430 resource_info.name=ConstantString(argv[i]);
1433 if (LocaleCompare("negate",option+1) == 0)
1435 if (LocaleCompare("noop",option+1) == 0)
1437 if (LocaleCompare("normalize",option+1) == 0)
1439 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
1443 if (LocaleCompare("page",option+1) == 0)
1445 resource_info.image_geometry=(char *) NULL;
1449 if (i == (ssize_t) argc)
1450 ThrowDisplayException(OptionError,"MissingArgument",option);
1451 resource_info.image_geometry=ConstantString(argv[i]);
1454 if (LocaleCompare("profile",option+1) == 0)
1457 if (i == (ssize_t) argc)
1458 ThrowDisplayException(OptionError,"MissingArgument",option);
1461 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
1465 if (LocaleCompare("quality",option+1) == 0)
1470 if (i == (ssize_t) argc)
1471 ThrowDisplayException(OptionError,"MissingArgument",option);
1472 if (IsGeometry(argv[i]) == MagickFalse)
1473 ThrowDisplayInvalidArgumentException(option,argv[i]);
1476 if (LocaleCompare("quantize",option+1) == 0)
1484 if (i == (ssize_t) (argc-1))
1485 ThrowDisplayException(OptionError,"MissingArgument",option);
1486 colorspace=ParseCommandOption(MagickColorspaceOptions,
1487 MagickFalse,argv[i]);
1489 ThrowDisplayException(OptionError,"UnrecognizedColorspace",
1493 if (LocaleCompare("quiet",option+1) == 0)
1495 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
1499 if (LocaleCompare("raise",option+1) == 0)
1502 if (i == (ssize_t) argc)
1503 ThrowDisplayException(OptionError,"MissingArgument",option);
1504 if (IsGeometry(argv[i]) == MagickFalse)
1505 ThrowDisplayInvalidArgumentException(option,argv[i]);
1508 if (LocaleCompare("regard-warnings",option+1) == 0)
1510 if (LocaleCompare("remote",option+1) == 0)
1513 if (i == (ssize_t) argc)
1514 ThrowDisplayException(OptionError,"MissingArgument",option);
1515 if (XRemoteCommand(display,resource_info.window_id,argv[i]) != 0)
1516 return(MagickFalse);
1520 if (LocaleCompare("repage",option+1) == 0)
1525 if (i == (ssize_t) argc)
1526 ThrowDisplayException(OptionError,"MissingArgument",option);
1527 if (IsGeometry(argv[i]) == MagickFalse)
1528 ThrowDisplayInvalidArgumentException(option,argv[i]);
1531 if (LocaleCompare("resample",option+1) == 0)
1536 if (i == (ssize_t) (argc-1))
1537 ThrowDisplayException(OptionError,"MissingArgument",option);
1538 if (IsGeometry(argv[i]) == MagickFalse)
1539 ThrowDisplayInvalidArgumentException(option,argv[i]);
1542 if (LocaleCompare("resize",option+1) == 0)
1547 if (i == (ssize_t) argc)
1548 ThrowDisplayException(OptionError,"MissingArgument",option);
1549 if (IsGeometry(argv[i]) == MagickFalse)
1550 ThrowDisplayInvalidArgumentException(option,argv[i]);
1553 if (LocaleNCompare("respect-parentheses",option+1,17) == 0)
1555 respect_parenthesis=(*option == '-') ? MagickTrue : MagickFalse;
1558 if (LocaleCompare("roll",option+1) == 0)
1563 if (i == (ssize_t) argc)
1564 ThrowDisplayException(OptionError,"MissingArgument",option);
1565 if (IsGeometry(argv[i]) == MagickFalse)
1566 ThrowDisplayInvalidArgumentException(option,argv[i]);
1569 if (LocaleCompare("rotate",option+1) == 0)
1572 if (i == (ssize_t) argc)
1573 ThrowDisplayException(OptionError,"MissingArgument",option);
1574 if (IsGeometry(argv[i]) == MagickFalse)
1575 ThrowDisplayInvalidArgumentException(option,argv[i]);
1578 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
1582 if (LocaleCompare("sample",option+1) == 0)
1587 if (i == (ssize_t) argc)
1588 ThrowDisplayException(OptionError,"MissingArgument",option);
1589 if (IsGeometry(argv[i]) == MagickFalse)
1590 ThrowDisplayInvalidArgumentException(option,argv[i]);
1593 if (LocaleCompare("sampling-factor",option+1) == 0)
1598 if (i == (ssize_t) argc)
1599 ThrowDisplayException(OptionError,"MissingArgument",option);
1600 if (IsGeometry(argv[i]) == MagickFalse)
1601 ThrowDisplayInvalidArgumentException(option,argv[i]);
1604 if (LocaleCompare("scenes",option+1) == 0)
1609 if (i == (ssize_t) argc)
1610 ThrowDisplayException(OptionError,"MissingArgument",option);
1611 if (IsSceneGeometry(argv[i],MagickFalse) == MagickFalse)
1612 ThrowDisplayInvalidArgumentException(option,argv[i]);
1615 if (LocaleCompare("seed",option+1) == 0)
1620 if (i == (ssize_t) (argc-1))
1621 ThrowDisplayException(OptionError,"MissingArgument",option);
1622 if (IsGeometry(argv[i]) == MagickFalse)
1623 ThrowDisplayInvalidArgumentException(option,argv[i]);
1626 if (LocaleCompare("segment",option+1) == 0)
1631 if (i == (ssize_t) argc)
1632 ThrowDisplayException(OptionError,"MissingArgument",option);
1633 if (IsGeometry(argv[i]) == MagickFalse)
1634 ThrowDisplayInvalidArgumentException(option,argv[i]);
1637 if (LocaleCompare("set",option+1) == 0)
1640 if (i == (ssize_t) argc)
1641 ThrowDisplayException(OptionError,"MissingArgument",option);
1645 if (i == (ssize_t) argc)
1646 ThrowDisplayException(OptionError,"MissingArgument",option);
1649 if (LocaleCompare("sharpen",option+1) == 0)
1654 if (i == (ssize_t) argc)
1655 ThrowDisplayException(OptionError,"MissingArgument",option);
1656 if (IsGeometry(argv[i]) == MagickFalse)
1657 ThrowDisplayInvalidArgumentException(option,argv[i]);
1660 if (LocaleCompare("shared-memory",option+1) == 0)
1662 resource_info.use_shared_memory= (*option == '-') ? MagickTrue :
1666 if (LocaleCompare("size",option+1) == 0)
1671 if (i == (ssize_t) argc)
1672 ThrowDisplayException(OptionError,"MissingArgument",option);
1673 if (IsGeometry(argv[i]) == MagickFalse)
1674 ThrowDisplayInvalidArgumentException(option,argv[i]);
1677 if (LocaleCompare("strip",option+1) == 0)
1679 if (LocaleCompare("support",option+1) == 0)
1681 i++; /* deprecated */
1684 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
1688 if (LocaleCompare("text-font",option+1) == 0)
1690 resource_info.text_font=(char *) NULL;
1694 if (i == (ssize_t) argc)
1695 ThrowDisplayException(OptionError,"MissingArgument",option);
1696 resource_info.text_font=XGetResourceClass(resource_database,
1697 GetClientName(),"font",argv[i]);
1700 if (LocaleCompare("texture",option+1) == 0)
1705 if (i == (ssize_t) argc)
1706 ThrowDisplayException(OptionError,"MissingArgument",option);
1709 if (LocaleCompare("threshold",option+1) == 0)
1714 if (i == (ssize_t) argc)
1715 ThrowDisplayException(OptionError,"MissingArgument",option);
1716 if (IsGeometry(argv[i]) == MagickFalse)
1717 ThrowDisplayInvalidArgumentException(option,argv[i]);
1720 if (LocaleCompare("thumbnail",option+1) == 0)
1725 if (i == (ssize_t) argc)
1726 ThrowDisplayException(OptionError,"MissingArgument",option);
1727 if (IsGeometry(argv[i]) == MagickFalse)
1728 ThrowDisplayInvalidArgumentException(option,argv[i]);
1731 if (LocaleCompare("title",option+1) == 0)
1733 resource_info.title=(char *) NULL;
1737 if (i == (ssize_t) argc)
1738 ThrowDisplayException(OptionError,"MissingArgument",option);
1739 resource_info.title=argv[i];
1742 if (LocaleCompare("transparent-color",option+1) == 0)
1747 if (i == (ssize_t) (argc-1))
1748 ThrowDisplayException(OptionError,"MissingArgument",option);
1751 if (LocaleCompare("treedepth",option+1) == 0)
1753 quantize_info->tree_depth=0;
1757 if (i == (ssize_t) argc)
1758 ThrowDisplayException(OptionError,"MissingArgument",option);
1759 if (IsGeometry(argv[i]) == MagickFalse)
1760 ThrowDisplayInvalidArgumentException(option,argv[i]);
1761 quantize_info->tree_depth=StringToUnsignedLong(argv[i]);
1764 if (LocaleCompare("trim",option+1) == 0)
1766 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
1770 if (LocaleCompare("update",option+1) == 0)
1772 resource_info.update=(unsigned int) (*option == '-');
1776 if (i == (ssize_t) argc)
1777 ThrowDisplayException(OptionError,"MissingArgument",option);
1778 if (IsGeometry(argv[i]) == MagickFalse)
1779 ThrowDisplayInvalidArgumentException(option,argv[i]);
1780 resource_info.update=(unsigned int) StringToUnsignedLong(argv[i]);
1783 if (LocaleCompare("use-pixmap",option+1) == 0)
1785 resource_info.use_pixmap=(*option == '-') ? MagickTrue :
1789 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
1793 if (LocaleCompare("verbose",option+1) == 0)
1795 if ((LocaleCompare("version",option+1) == 0) ||
1796 (LocaleCompare("-version",option+1) == 0))
1798 (void) FormatLocaleFile(stdout,"Version: %s\n",
1799 GetMagickVersion((size_t *) NULL));
1800 (void) FormatLocaleFile(stdout,"Copyright: %s\n",
1801 GetMagickCopyright());
1802 (void) FormatLocaleFile(stdout,"Features: %s\n\n",
1803 GetMagickFeatures());
1806 if (LocaleCompare("visual",option+1) == 0)
1808 resource_info.visual_type=(char *) NULL;
1812 if (i == (ssize_t) argc)
1813 ThrowDisplayException(OptionError,"MissingArgument",option);
1814 resource_info.visual_type=argv[i];
1817 if (LocaleCompare("virtual-pixel",option+1) == 0)
1825 if (i == (ssize_t) (argc-1))
1826 ThrowDisplayException(OptionError,"MissingArgument",option);
1827 method=ParseCommandOption(MagickVirtualPixelOptions,MagickFalse,
1830 ThrowDisplayException(OptionError,
1831 "UnrecognizedVirtualPixelMethod",argv[i]);
1834 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
1838 if (LocaleCompare("window",option+1) == 0)
1840 resource_info.window_id=(char *) NULL;
1844 if (i == (ssize_t) argc)
1845 ThrowDisplayException(OptionError,"MissingArgument",option);
1846 resource_info.window_id=argv[i];
1849 if (LocaleCompare("window-group",option+1) == 0)
1851 resource_info.window_group=(char *) NULL;
1855 if (i == (ssize_t) argc)
1856 ThrowDisplayException(OptionError,"MissingArgument",option);
1857 if (StringToDouble(argv[i],(char **) NULL) != 0)
1858 resource_info.window_group=argv[i];
1861 if (LocaleCompare("write",option+1) == 0)
1863 resource_info.write_filename=(char *) NULL;
1867 if (i == (ssize_t) argc)
1868 ThrowDisplayException(OptionError,"MissingArgument",option);
1869 resource_info.write_filename=argv[i];
1870 if (IsPathAccessible(resource_info.write_filename) != MagickFalse)
1876 (void) FormatLocaleFile(stderr,"Overwrite %s? ",
1877 resource_info.write_filename);
1878 p=fgets(answer,(int) sizeof(answer),stdin);
1880 if (((*answer != 'y') && (*answer != 'Y')))
1881 return(MagickFalse);
1885 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
1890 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
1892 fire=(GetCommandOptionFlags(MagickCommandOptions,MagickFalse,option) &
1893 FireOptionFlag) == 0 ? MagickFalse : MagickTrue;
1894 if (fire != MagickFalse)
1895 FireImageStack(MagickFalse,MagickTrue,MagickTrue);
1898 ThrowDisplayException(OptionError,"UnbalancedParenthesis",argv[i]);
1899 if (state & RetainColorsState)
1901 XRetainWindowColors(display,XRootWindow(display,XDefaultScreen(display)));
1902 (void) XSync(display,MagickFalse);
1905 return(status != 0 ? MagickTrue : MagickFalse);
1909 (void) ThrowMagickException(exception,GetMagickModule(),MissingDelegateError,
1910 "DelegateLibrarySupportNotBuiltIn","'%s' (X11)",image_info->filename);
1911 return(DisplayUsage());