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-2011 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/string-private.h"
49 #include "MagickCore/xwindow-private.h"
52 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
56 + D i s p l a y I m a g e C o m m a n d %
60 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
62 % DisplayImageCommand() displays a sequence of images on any workstation
63 % display running an X server. Display first determines the hardware
64 % capabilities of the workstation. If the number of unique colors in an image
65 % is less than or equal to the number the workstation can support, the image
66 % is displayed in an X window. Otherwise the number of colors in the image is
67 % first reduced to match the color resolution of the workstation before it is
70 % This means that a continuous-tone 24 bits/pixel image can display on a 8
71 % bit pseudo-color device or monochrome device. In most instances the reduced
72 % color image closely resembles the original. Alternatively, a monochrome or
73 % pseudo-color image sequence can display on a continuous-tone 24 bits/pixels
76 % The format of the DisplayImageCommand method is:
78 % MagickBooleanType DisplayImageCommand(ImageInfo *image_info,int argc,
79 % char **argv,char **metadata,ExceptionInfo *exception)
81 % A description of each parameter follows:
83 % o image_info: the image info.
85 % o argc: the number of elements in the argument vector.
87 % o argv: A text array containing the command line arguments.
89 % o metadata: any metadata is returned here.
91 % o exception: return any errors or warnings in this structure.
95 static MagickBooleanType DisplayUsage(void)
103 "1 press to map or unmap the Command widget",
104 "2 press and drag to magnify a region of an image",
105 "3 press to load an image from a visual image directory",
110 "-debug events display copious debugging information",
111 "-help print program options",
112 "-list type print a list of supported option arguments",
113 "-log format format of debugging information",
114 "-version print version information",
119 "-auto-orient automagically orient image",
120 "-border geometry surround image with a border of color",
121 "-clip clip along the first path from the 8BIM profile",
122 "-clip-path id clip along a named path from the 8BIM profile",
123 "-colors value preferred number of colors in the image",
124 "-contrast enhance or reduce the image contrast",
125 "-crop geometry preferred size and location of the cropped image",
126 "-decipher filename convert cipher pixels to plain pixels",
127 "-deskew threshold straighten an image",
128 "-despeckle reduce the speckles within an image",
129 "-edge factor apply a filter to detect edges in the image",
130 "-enhance apply a digital filter to enhance a noisy image",
131 "-equalize perform histogram equalization to an image",
132 "-extract geometry extract area from image",
133 "-flip flip image in the vertical direction",
134 "-flop flop image in the horizontal direction",
135 "-frame geometry surround image with an ornamental border",
136 "-fuzz distance colors within this distance are considered equal",
137 "-gamma value level of gamma correction",
138 "-monochrome transform image to black and white",
139 "-negate replace every pixel with its complementary color",
140 "-normalize transform image to span the full range of colors",
141 "-raise value lighten/darken image edges to create a 3-D effect",
142 "-resample geometry change the resolution of an image",
143 "-resize geometry resize the image",
144 "-roll geometry roll an image vertically or horizontally",
145 "-rotate degrees apply Paeth rotation to the image",
146 "-sample geometry scale image with pixel sampling",
147 "-segment value segment an image",
148 "-sharpen geometry sharpen the image",
149 "-strip strip image of all profiles and comments",
150 "-threshold value threshold the image",
151 "-thumbnail geometry create a thumbnail of the image",
152 "-trim trim image edges",
157 "-alpha option on, activate, off, deactivate, set, opaque, copy",
158 " transparent, extract, background, or shape",
159 "-antialias remove pixel-aliasing",
160 "-authenticate password",
161 " decipher image with this password",
162 "-backdrop display image centered on a backdrop",
163 "-channel type apply option to select image channels",
164 "-colormap type Shared or Private",
165 "-colorspace type alternate image colorspace",
166 "-comment string annotate image with comment",
167 "-compress type type of pixel compression when writing the image",
168 "-define format:option",
169 " define one or more image format options",
170 "-delay value display the next image after pausing",
171 "-density geometry horizontal and vertical density of the image",
172 "-depth value image depth",
173 "-display server display image to this X server",
174 "-dispose method layer disposal method",
175 "-dither method apply error diffusion to image",
176 "-endian type endianness (MSB or LSB) of the image",
177 "-filter type use this filter when resizing an image",
178 "-format string output formatted image characteristics",
179 "-geometry geometry preferred size and location of the Image window",
180 "-gravity type horizontal and vertical backdrop placement",
181 "-identify identify the format and characteristics of the image",
182 "-immutable displayed image cannot be modified",
183 "-interlace type type of image interlacing scheme",
184 "-interpolate method pixel color interpolation method",
185 "-label string assign a label to an image",
186 "-limit type value pixel cache resource limit",
187 "-loop iterations loop images then exit",
188 "-map type display image using this Standard Colormap",
189 "-monitor monitor progress",
190 "-page geometry size and location of an image canvas",
191 "-profile filename add, delete, or apply an image profile",
192 "-quality value JPEG/MIFF/PNG compression level",
193 "-quantize colorspace reduce colors in this colorspace",
194 "-quiet suppress all warning messages",
195 "-regard-warnings pay attention to warning messages",
196 "-remote command execute a command in an remote display process",
197 "-repage geometry size and location of an image canvas (operator)",
198 "-respect-parentheses settings remain in effect until parenthesis boundary",
199 "-sampling-factor geometry",
200 " horizontal and vertical sampling factor",
201 "-seed value seed a new sequence of pseudo-random numbers",
202 "-set property value set an image property",
203 "-size geometry width and height of image",
204 "-texture filename name of texture to tile onto the image background",
205 "-transparent-color color",
206 " transparent color",
207 "-treedepth value color tree depth",
208 "-update seconds detect when image file is modified and redisplay",
209 "-verbose print detailed information about the image",
210 "-visual type display image using this visual type",
211 "-virtual-pixel method",
212 " virtual pixel access method",
213 "-window id display image to background of this window",
214 "-window-group id exit program when this window id is destroyed",
215 "-write filename write image to a file",
218 *sequence_operators[]=
220 "-coalesce merge a sequence of images",
221 "-flatten flatten a sequence of images",
225 (void) printf("Version: %s\n",GetMagickVersion((size_t *) NULL));
226 (void) printf("Copyright: %s\n",GetMagickCopyright());
227 (void) printf("Features: %s\n\n",GetMagickFeatures());
228 (void) printf("Usage: %s [options ...] file [ [options ...] file ...]\n",
230 (void) printf("\nImage Settings:\n");
231 for (p=settings; *p != (char *) NULL; p++)
232 (void) printf(" %s\n",*p);
233 (void) printf("\nImage Operators:\n");
234 for (p=operators; *p != (char *) NULL; p++)
235 (void) printf(" %s\n",*p);
236 (void) printf("\nImage Sequence Operators:\n");
237 for (p=sequence_operators; *p != (char *) NULL; p++)
238 (void) printf(" %s\n",*p);
239 (void) printf("\nMiscellaneous Options:\n");
240 for (p=miscellaneous; *p != (char *) NULL; p++)
241 (void) printf(" %s\n",*p);
243 "\nIn addition to those listed above, you can specify these standard X\n");
245 "resources as command line options: -background, -bordercolor,\n");
247 "-borderwidth, -font, -foreground, -iconGeometry, -iconic, -mattecolor,\n");
248 (void) printf("-name, -shared-memory, -usePixmap, or -title.\n");
250 "\nBy default, the image format of `file' is determined by its magic\n");
252 "number. To specify a particular image format, precede the filename\n");
254 "with an image format name and a colon (i.e. ps:image) or specify the\n");
256 "image type as the filename suffix (i.e. image.ps). Specify 'file' as\n");
257 (void) printf("'-' for standard input or output.\n");
258 (void) printf("\nButtons: \n");
259 for (p=buttons; *p != (char *) NULL; p++)
260 (void) printf(" %s\n",*p);
264 WandExport MagickBooleanType DisplayImageCommand(ImageInfo *image_info,
265 int argc,char **argv,char **wand_unused(metadata),ExceptionInfo *exception)
267 #if defined(MAGICKCORE_X11_DELEGATE)
268 #define DestroyDisplay() \
270 if ((state & ExitState) == 0) \
271 DestroyXResources(); \
272 if (display != (Display *) NULL) \
274 XCloseDisplay(display); \
275 display=(Display *) NULL; \
277 XDestroyResourceInfo(&resource_info); \
278 DestroyImageStack(); \
279 if (image_marker != (size_t *) NULL) \
280 image_marker=(size_t *) RelinquishMagickMemory(image_marker); \
281 for (i=0; i < (ssize_t) argc; i++) \
282 argv[i]=DestroyString(argv[i]); \
283 argv=(char **) RelinquishMagickMemory(argv); \
285 #define ThrowDisplayException(asperity,tag,option) \
287 (void) ThrowMagickException(exception,GetMagickModule(),asperity,tag,"`%s'", \
290 return(MagickFalse); \
292 #define ThrowDisplayInvalidArgumentException(option,argument) \
294 (void) ThrowMagickException(exception,GetMagickModule(),OptionError, \
295 "InvalidArgument","`%s': %s",option,argument); \
297 return(MagickFalse); \
314 image_stack[MaxImageStackDepth+1];
352 assert(image_info != (ImageInfo *) NULL);
353 assert(image_info->signature == MagickSignature);
354 if (image_info->debug != MagickFalse)
355 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");
356 assert(exception != (ExceptionInfo *) NULL);
360 if ((LocaleCompare("version",option+1) == 0) ||
361 (LocaleCompare("-version",option+1) == 0))
363 (void) FormatLocaleFile(stdout,"Version: %s\n",
364 GetMagickVersion((size_t *) NULL));
365 (void) FormatLocaleFile(stdout,"Copyright: %s\n",
366 GetMagickCopyright());
367 (void) FormatLocaleFile(stdout,"Features: %s\n\n",
368 GetMagickFeatures());
373 display=(Display *) NULL;
376 image_marker=(size_t *) NULL;
380 option=(char *) NULL;
382 respect_parenthesis=MagickFalse;
383 resource_database=(XrmDatabase) NULL;
384 (void) ResetMagickMemory(&resource_info,0,sizeof(resource_info));
385 server_name=(char *) NULL;
388 ReadCommandlLine(argc,&argv);
389 status=ExpandFilenames(&argc,&argv);
390 if (status == MagickFalse)
391 ThrowDisplayException(ResourceLimitError,"MemoryAllocationFailed",
392 GetExceptionMessage(errno));
393 image_marker=(size_t *) AcquireQuantumMemory((size_t) argc+1UL,
394 sizeof(*image_marker));
395 if (image_marker == (size_t *) NULL)
396 ThrowDisplayException(ResourceLimitError,"MemoryAllocationFailed",
397 GetExceptionMessage(errno));
398 for (i=0; i <= (ssize_t) argc; i++)
399 image_marker[i]=(size_t) argc;
401 Check for server name specified on the command line.
403 for (i=1; i < (ssize_t) argc; i++)
406 Check command line for server name.
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("help",option+1) == 0) ||
420 (LocaleCompare("-help",option+1) == 0))
421 return(DisplayUsage());
424 Get user defaults from X resource database.
426 display=XOpenDisplay(server_name);
427 if (display == (Display *) NULL)
428 ThrowDisplayException(XServerError,"UnableToOpenXServer",
429 XDisplayName(server_name));
430 (void) XSetErrorHandler(XError);
431 resource_database=XGetResourceDatabase(display,GetClientName());
432 XGetResourceInfo(image_info,resource_database,GetClientName(),
434 quantize_info=resource_info.quantize_info;
435 image_info->density=XGetResourceInstance(resource_database,GetClientName(),
436 "density",(char *) NULL);
437 if (image_info->density == (char *) NULL)
438 image_info->density=XGetScreenDensity(display);
439 resource_value=XGetResourceInstance(resource_database,GetClientName(),
441 image_info->interlace=(InterlaceType)
442 ParseCommandOption(MagickInterlaceOptions,MagickFalse,resource_value);
443 image_info->page=XGetResourceInstance(resource_database,GetClientName(),
444 "pageGeometry",(char *) NULL);
445 resource_value=XGetResourceInstance(resource_database,GetClientName(),
447 image_info->quality=StringToUnsignedLong(resource_value);
448 resource_value=XGetResourceInstance(resource_database,GetClientName(),
450 image_info->verbose=IsMagickTrue(resource_value);
451 resource_value=XGetResourceInstance(resource_database,GetClientName(),
453 quantize_info->dither=IsMagickTrue(resource_value);
458 for (i=1; ((i <= (ssize_t) argc) && ((state & ExitState) == 0)); i++)
460 if (i < (ssize_t) argc)
463 if (image != (Image *) NULL)
466 if (isatty(STDIN_FILENO) != MagickFalse)
482 if (LocaleCompare(option,"(") == 0)
484 FireImageStack(MagickFalse,MagickTrue,pend);
485 if (k == MaxImageStackDepth)
486 ThrowDisplayException(OptionError,"ParenthesisNestedTooDeeply",
491 if (LocaleCompare(option,")") == 0)
493 FireImageStack(MagickFalse,MagickTrue,MagickTrue);
495 ThrowDisplayException(OptionError,"UnableToParseExpression",option);
499 if (IsCommandOption(option) == MagickFalse)
509 Option is a file name.
511 FireImageStack(MagickFalse,MagickFalse,pend);
513 if ((LocaleCompare(filename,"--") == 0) && (i < (ssize_t) (argc-1)))
518 (void) CopyMagickString(image_info->filename,filename,MaxTextExtent);
519 images=ReadImage(image_info,exception);
520 CatchException(exception);
521 status&=(images != (Image *) NULL) &&
522 (exception->severity < ErrorException);
523 if (images == (Image *) NULL)
525 AppendImageStack(images);
526 FinalizeImageSettings(image_info,image,MagickFalse);
528 if (i == (ssize_t) (argc-1))
529 iterations=image->iterations;
530 display_image=CloneImageList(image,exception);
531 if (display_image == (Image *) NULL)
532 ThrowDisplayException(ResourceLimitError,"MemoryAllocationFailed",
533 GetExceptionMessage(errno));
537 Transmogrify image as defined by the image processing options.
539 resource_info.quantum=1;
540 if (resource_info.window_id != (char *) NULL)
543 Display image to a specified X window.
545 status=XDisplayBackgroundImage(display,&resource_info,
546 display_image,exception);
547 if (status != MagickFalse)
549 state|=RetainColorsState;
560 Display image to X server.
562 if (resource_info.delay != 1)
563 display_image->delay=resource_info.delay;
564 nexus=XDisplayImage(display,&resource_info,argv,argc,
565 &display_image,&state,exception);
566 status&=nexus != (Image *) NULL;
567 if (nexus == (Image *) NULL)
569 while ((nexus != (Image *) NULL) && ((state & ExitState) == 0))
574 if (nexus->montage != (char *) NULL)
577 User selected a visual directory image (montage).
582 next=XDisplayImage(display,&resource_info,argv,argc,&nexus,
584 if ((next == (Image *) NULL) &&
585 (GetNextImageInList(nexus) != (Image *) NULL))
587 display_image=GetNextImageInList(nexus);
588 nexus=NewImageList();
592 if (nexus != display_image)
593 nexus=DestroyImageList(nexus);
597 } while ((state & ExitState) == 0);
598 if (resource_info.write_filename != (char *) NULL)
603 (void) CopyMagickString(display_image->filename,
604 resource_info.write_filename,MaxTextExtent);
605 (void) SetImageInfo(image_info,1,&display_image->exception);
606 status&=WriteImage(image_info,display_image,
607 &display_image->exception);
608 GetImageException(display_image,exception);
611 Proceed to next/previous image.
613 if ((state & FormerImageState) != 0)
614 for (l=0; l < (ssize_t) resource_info.quantum; l++)
616 display_image=GetPreviousImageInList(display_image);
617 if (display_image == (Image *) NULL)
621 for (l=0; l < (ssize_t) resource_info.quantum; l++)
623 display_image=GetNextImageInList(display_image);
624 if (display_image == (Image *) NULL)
627 } while ((display_image != (Image *) NULL) && ((state & ExitState) == 0));
629 Free image resources.
631 display_image=DestroyImageList(display_image);
632 if ((state & FormerImageState) == 0)
634 last_image=(size_t) image_number;
635 image_marker[i]=(size_t) image_number++;
640 Proceed to previous image.
642 for (i--; i > 0; i--)
643 if (image_marker[i] == (size_t) (image_number-2))
647 if ((i == (ssize_t) (argc-1)) && ((state & ExitState) == 0))
649 if ((state & ExitState) != 0)
652 Determine if we should proceed to the first image.
654 if (image_number < 0)
656 if ((state & FormerImageState) != 0)
659 for (i=1; i < (ssize_t) (argc-2); i++)
660 if (last_image == image_marker[i])
662 image_number=(ssize_t) image_marker[i]+1;
666 if (resource_info.window_id != (char *) NULL)
668 if ((iterations != 0) && (++iteration == (ssize_t) iterations))
670 if (LocaleCompare(filename,"-") == 0)
674 pend=image != (Image *) NULL ? MagickTrue : MagickFalse;
679 if (LocaleCompare("alpha",option+1) == 0)
687 if (i == (ssize_t) argc)
688 ThrowDisplayException(OptionError,"MissingArgument",option);
689 type=ParseCommandOption(MagickAlphaOptions,MagickFalse,argv[i]);
691 ThrowDisplayException(OptionError,"UnrecognizedAlphaChannelType",
695 if (LocaleCompare("antialias",option+1) == 0)
697 if (LocaleCompare("authenticate",option+1) == 0)
702 if (i == (ssize_t) argc)
703 ThrowDisplayException(OptionError,"MissingArgument",option);
706 if (LocaleCompare("auto-orient",option+1) == 0)
708 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
712 if (LocaleCompare("backdrop",option+1) == 0)
714 resource_info.backdrop=(*option == '-') ? MagickTrue : MagickFalse;
717 if (LocaleCompare("background",option+1) == 0)
722 if (i == (ssize_t) argc)
723 ThrowDisplayException(OptionError,"MissingArgument",option);
724 resource_info.background_color=argv[i];
727 if (LocaleCompare("border",option+1) == 0)
732 if (i == (ssize_t) argc)
733 ThrowDisplayException(OptionError,"MissingArgument",option);
734 if (IsGeometry(argv[i]) == MagickFalse)
735 ThrowDisplayInvalidArgumentException(option,argv[i]);
738 if (LocaleCompare("bordercolor",option+1) == 0)
743 if (i == (ssize_t) argc)
744 ThrowDisplayException(OptionError,"MissingArgument",option);
745 resource_info.border_color=argv[i];
748 if (LocaleCompare("borderwidth",option+1) == 0)
750 resource_info.border_width=0;
754 if (i == (ssize_t) argc)
755 ThrowDisplayException(OptionError,"MissingArgument",option);
756 if (IsGeometry(argv[i]) == MagickFalse)
757 ThrowDisplayInvalidArgumentException(option,argv[i]);
758 resource_info.border_width=(unsigned int)
759 StringToUnsignedLong(argv[i]);
762 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
766 if (LocaleCompare("cache",option+1) == 0)
771 if (i == (ssize_t) argc)
772 ThrowDisplayException(OptionError,"MissingArgument",option);
773 if (IsGeometry(argv[i]) == MagickFalse)
774 ThrowDisplayInvalidArgumentException(option,argv[i]);
777 if (LocaleCompare("channel",option+1) == 0)
785 if (i == (ssize_t) (argc-1))
786 ThrowDisplayException(OptionError,"MissingArgument",option);
787 channel=ParseChannelOption(argv[i]);
789 ThrowDisplayException(OptionError,"UnrecognizedChannelType",
793 if (LocaleCompare("clip",option+1) == 0)
795 if (LocaleCompare("clip-path",option+1) == 0)
798 if (i == (ssize_t) argc)
799 ThrowDisplayException(OptionError,"MissingArgument",option);
802 if (LocaleCompare("coalesce",option+1) == 0)
804 if (LocaleCompare("colormap",option+1) == 0)
806 resource_info.colormap=PrivateColormap;
810 if (i == (ssize_t) argc)
811 ThrowDisplayException(OptionError,"MissingArgument",option);
812 resource_info.colormap=UndefinedColormap;
813 if (LocaleCompare("private",argv[i]) == 0)
814 resource_info.colormap=PrivateColormap;
815 if (LocaleCompare("shared",argv[i]) == 0)
816 resource_info.colormap=SharedColormap;
817 if (resource_info.colormap == UndefinedColormap)
818 ThrowDisplayException(OptionError,"UnrecognizedColormapType",
822 if (LocaleCompare("colors",option+1) == 0)
824 quantize_info->number_colors=0;
828 if (i == (ssize_t) argc)
829 ThrowDisplayException(OptionError,"MissingArgument",option);
830 if (IsGeometry(argv[i]) == MagickFalse)
831 ThrowDisplayInvalidArgumentException(option,argv[i]);
832 quantize_info->number_colors=StringToUnsignedLong(argv[i]);
835 if (LocaleCompare("colorspace",option+1) == 0)
843 if (i == (ssize_t) argc)
844 ThrowDisplayException(OptionError,"MissingArgument",option);
845 colorspace=ParseCommandOption(MagickColorspaceOptions,
846 MagickFalse,argv[i]);
848 ThrowDisplayException(OptionError,"UnrecognizedColorspace",
852 if (LocaleCompare("comment",option+1) == 0)
857 if (i == (ssize_t) argc)
858 ThrowDisplayException(OptionError,"MissingArgument",option);
861 if (LocaleCompare("compress",option+1) == 0)
869 if (i == (ssize_t) argc)
870 ThrowDisplayException(OptionError,"MissingArgument",option);
871 compress=ParseCommandOption(MagickCompressOptions,MagickFalse,
874 ThrowDisplayException(OptionError,"UnrecognizedImageCompression",
878 if (LocaleCompare("concurrent",option+1) == 0)
880 if (LocaleCompare("contrast",option+1) == 0)
882 if (LocaleCompare("crop",option+1) == 0)
887 if (i == (ssize_t) argc)
888 ThrowDisplayException(OptionError,"MissingArgument",option);
889 if (IsGeometry(argv[i]) == MagickFalse)
890 ThrowDisplayInvalidArgumentException(option,argv[i]);
893 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
897 if (LocaleCompare("debug",option+1) == 0)
905 if (i == (ssize_t) argc)
906 ThrowDisplayException(OptionError,"MissingArgument",option);
907 event=ParseCommandOption(MagickLogEventOptions,MagickFalse,argv[i]);
909 ThrowDisplayException(OptionError,"UnrecognizedEventType",
911 (void) SetLogEventMask(argv[i]);
914 if (LocaleCompare("decipher",option+1) == 0)
919 if (i == (ssize_t) (argc-1))
920 ThrowDisplayException(OptionError,"MissingArgument",option);
923 if (LocaleCompare("define",option+1) == 0)
926 if (i == (ssize_t) argc)
927 ThrowDisplayException(OptionError,"MissingArgument",option);
933 define=GetImageOption(image_info,argv[i]);
934 if (define == (const char *) NULL)
935 ThrowDisplayException(OptionError,"NoSuchOption",argv[i]);
940 if (LocaleCompare("delay",option+1) == 0)
945 if (i == (ssize_t) argc)
946 ThrowDisplayException(OptionError,"MissingArgument",option);
947 if (IsGeometry(argv[i]) == MagickFalse)
948 ThrowDisplayInvalidArgumentException(option,argv[i]);
951 if (LocaleCompare("density",option+1) == 0)
956 if (i == (ssize_t) argc)
957 ThrowDisplayException(OptionError,"MissingArgument",option);
958 if (IsGeometry(argv[i]) == MagickFalse)
959 ThrowDisplayInvalidArgumentException(option,argv[i]);
962 if (LocaleCompare("depth",option+1) == 0)
967 if (i == (ssize_t) argc)
968 ThrowDisplayException(OptionError,"MissingArgument",option);
969 if (IsGeometry(argv[i]) == MagickFalse)
970 ThrowDisplayInvalidArgumentException(option,argv[i]);
973 if (LocaleCompare("deskew",option+1) == 0)
978 if (i == (ssize_t) (argc-1))
979 ThrowDisplayException(OptionError,"MissingArgument",option);
980 if (IsGeometry(argv[i]) == MagickFalse)
981 ThrowDisplayInvalidArgumentException(option,argv[i]);
984 if (LocaleCompare("despeckle",option+1) == 0)
986 if (LocaleCompare("display",option+1) == 0)
991 if (i == (ssize_t) argc)
992 ThrowDisplayException(OptionError,"MissingArgument",option);
995 if (LocaleCompare("dispose",option+1) == 0)
1003 if (i == (ssize_t) argc)
1004 ThrowDisplayException(OptionError,"MissingArgument",option);
1005 dispose=ParseCommandOption(MagickDisposeOptions,MagickFalse,argv[i]);
1007 ThrowDisplayException(OptionError,"UnrecognizedDisposeMethod",
1011 if (LocaleCompare("dither",option+1) == 0)
1016 quantize_info->dither=MagickFalse;
1020 if (i == (ssize_t) argc)
1021 ThrowDisplayException(OptionError,"MissingArgument",option);
1022 method=ParseCommandOption(MagickDitherOptions,MagickFalse,argv[i]);
1024 ThrowDisplayException(OptionError,"UnrecognizedDitherMethod",
1026 quantize_info->dither=MagickTrue;
1027 quantize_info->dither_method=(DitherMethod) method;
1030 if (LocaleCompare("duration",option+1) == 0)
1035 if (i == (ssize_t) (argc-1))
1036 ThrowDisplayException(OptionError,"MissingArgument",option);
1037 if (IsGeometry(argv[i]) == MagickFalse)
1038 ThrowDisplayInvalidArgumentException(option,argv[i]);
1041 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
1045 if (LocaleCompare("edge",option+1) == 0)
1050 if (i == (ssize_t) argc)
1051 ThrowDisplayException(OptionError,"MissingArgument",option);
1052 if (IsGeometry(argv[i]) == MagickFalse)
1053 ThrowDisplayInvalidArgumentException(option,argv[i]);
1056 if (LocaleCompare("endian",option+1) == 0)
1064 if (i == (ssize_t) argc)
1065 ThrowDisplayException(OptionError,"MissingArgument",option);
1066 endian=ParseCommandOption(MagickEndianOptions,MagickFalse,
1069 ThrowDisplayException(OptionError,"UnrecognizedEndianType",
1073 if (LocaleCompare("enhance",option+1) == 0)
1075 if (LocaleCompare("equalize",option+1) == 0)
1077 if (LocaleCompare("extract",option+1) == 0)
1082 if (i == (ssize_t) argc)
1083 ThrowDisplayException(OptionError,"MissingArgument",option);
1084 if (IsGeometry(argv[i]) == MagickFalse)
1085 ThrowDisplayInvalidArgumentException(option,argv[i]);
1088 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
1092 if (LocaleCompare("filter",option+1) == 0)
1100 if (i == (ssize_t) argc)
1101 ThrowDisplayException(OptionError,"MissingArgument",option);
1102 filter=ParseCommandOption(MagickFilterOptions,MagickFalse,argv[i]);
1104 ThrowDisplayException(OptionError,"UnrecognizedImageFilter",
1108 if (LocaleCompare("flatten",option+1) == 0)
1110 if (LocaleCompare("flip",option+1) == 0)
1112 if (LocaleCompare("flop",option+1) == 0)
1114 if (LocaleCompare("font",option+1) == 0)
1119 if (i == (ssize_t) argc)
1120 ThrowDisplayException(OptionError,"MissingArgument",option);
1121 resource_info.font=XGetResourceClass(resource_database,
1122 GetClientName(),"font",argv[i]);
1125 if (LocaleCompare("foreground",option+1) == 0)
1130 if (i == (ssize_t) argc)
1131 ThrowDisplayException(OptionError,"MissingArgument",option);
1132 resource_info.foreground_color=argv[i];
1135 if (LocaleCompare("format",option+1) == 0)
1140 if (i == (ssize_t) (argc-1))
1141 ThrowDisplayException(OptionError,"MissingArgument",option);
1144 if (LocaleCompare("frame",option+1) == 0)
1149 if (i == (ssize_t) argc)
1150 ThrowDisplayException(OptionError,"MissingArgument",option);
1151 if (IsGeometry(argv[i]) == MagickFalse)
1152 ThrowDisplayInvalidArgumentException(option,argv[i]);
1155 if (LocaleCompare("fuzz",option+1) == 0)
1160 if (i == (ssize_t) (argc-1))
1161 ThrowDisplayException(OptionError,"MissingArgument",option);
1162 if (IsGeometry(argv[i]) == MagickFalse)
1163 ThrowDisplayInvalidArgumentException(option,argv[i]);
1166 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
1170 if (LocaleCompare("gamma",option+1) == 0)
1173 if (i == (ssize_t) argc)
1174 ThrowDisplayException(OptionError,"MissingArgument",option);
1175 if (IsGeometry(argv[i]) == MagickFalse)
1176 ThrowDisplayInvalidArgumentException(option,argv[i]);
1179 if (LocaleCompare("geometry",option+1) == 0)
1181 resource_info.image_geometry=(char *) NULL;
1184 (void) CopyMagickString(argv[i]+1,"sans",MaxTextExtent);
1186 if (i == (ssize_t) argc)
1187 ThrowDisplayException(OptionError,"MissingArgument",option);
1188 if (IsGeometry(argv[i]) == MagickFalse)
1189 ThrowDisplayInvalidArgumentException(option,argv[i]);
1190 resource_info.image_geometry=ConstantString(argv[i]);
1193 if (LocaleCompare("gravity",option+1) == 0)
1201 if (i == (ssize_t) (argc-1))
1202 ThrowDisplayException(OptionError,"MissingArgument",option);
1203 gravity=ParseCommandOption(MagickGravityOptions,MagickFalse,
1206 ThrowDisplayException(OptionError,"UnrecognizedGravityType",
1210 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
1214 if ((LocaleCompare("help",option+1) == 0) ||
1215 (LocaleCompare("-help",option+1) == 0))
1217 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
1221 if (LocaleCompare("identify",option+1) == 0)
1223 if (LocaleCompare("iconGeometry",option+1) == 0)
1225 resource_info.icon_geometry=(char *) NULL;
1229 if (i == (ssize_t) argc)
1230 ThrowDisplayException(OptionError,"MissingArgument",option);
1231 if (IsGeometry(argv[i]) == MagickFalse)
1232 ThrowDisplayInvalidArgumentException(option,argv[i]);
1233 resource_info.icon_geometry=argv[i];
1236 if (LocaleCompare("iconic",option+1) == 0)
1238 resource_info.iconic=(*option == '-') ? MagickTrue : MagickFalse;
1241 if (LocaleCompare("immutable",option+1) == 0)
1243 resource_info.immutable=(*option == '-') ? MagickTrue : MagickFalse;
1246 if (LocaleCompare("interlace",option+1) == 0)
1254 if (i == (ssize_t) argc)
1255 ThrowDisplayException(OptionError,"MissingArgument",option);
1256 interlace=ParseCommandOption(MagickInterlaceOptions,MagickFalse,
1259 ThrowDisplayException(OptionError,"UnrecognizedInterlaceType",
1263 if (LocaleCompare("interpolate",option+1) == 0)
1271 if (i == (ssize_t) argc)
1272 ThrowDisplayException(OptionError,"MissingArgument",option);
1273 interpolate=ParseCommandOption(MagickInterpolateOptions,MagickFalse,
1275 if (interpolate < 0)
1276 ThrowDisplayException(OptionError,"UnrecognizedInterpolateMethod",
1280 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
1284 if (LocaleCompare("label",option+1) == 0)
1289 if (i == (ssize_t) argc)
1290 ThrowDisplayException(OptionError,"MissingArgument",option);
1293 if (LocaleCompare("limit",option+1) == 0)
1307 if (i == (ssize_t) argc)
1308 ThrowDisplayException(OptionError,"MissingArgument",option);
1309 resource=ParseCommandOption(MagickResourceOptions,MagickFalse,
1312 ThrowDisplayException(OptionError,"UnrecognizedResourceType",
1315 if (i == (ssize_t) argc)
1316 ThrowDisplayException(OptionError,"MissingArgument",option);
1317 value=InterpretLocaleValue(argv[i],&p);
1319 if ((p == argv[i]) && (LocaleCompare("unlimited",argv[i]) != 0))
1320 ThrowDisplayInvalidArgumentException(option,argv[i]);
1323 if (LocaleCompare("list",option+1) == 0)
1331 if (i == (ssize_t) argc)
1332 ThrowDisplayException(OptionError,"MissingArgument",option);
1333 list=ParseCommandOption(MagickListOptions,MagickFalse,argv[i]);
1335 ThrowDisplayException(OptionError,"UnrecognizedListType",argv[i]);
1336 status=MogrifyImageInfo(image_info,(int) (i-j+1),(const char **)
1339 return(status != 0 ? MagickFalse : MagickTrue);
1341 if (LocaleCompare("log",option+1) == 0)
1346 if ((i == (ssize_t) argc) ||
1347 (strchr(argv[i],'%') == (char *) NULL))
1348 ThrowDisplayException(OptionError,"MissingArgument",option);
1351 if (LocaleCompare("loop",option+1) == 0)
1356 if (i == (ssize_t) (argc-1))
1357 ThrowDisplayException(OptionError,"MissingArgument",option);
1358 if (IsGeometry(argv[i]) == MagickFalse)
1359 ThrowDisplayInvalidArgumentException(option,argv[i]);
1360 iterations=StringToUnsignedLong(argv[i]);
1363 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
1367 if (LocaleCompare("magnify",option+1) == 0)
1369 resource_info.magnify=2;
1373 if (i == (ssize_t) argc)
1374 ThrowDisplayException(OptionError,"MissingArgument",option);
1375 if (IsGeometry(argv[i]) == MagickFalse)
1376 ThrowDisplayInvalidArgumentException(option,argv[i]);
1377 resource_info.magnify=(unsigned int) StringToUnsignedLong(argv[i]);
1380 if (LocaleCompare("map",option+1) == 0)
1382 resource_info.map_type=(char *) NULL;
1385 (void) strcpy(argv[i]+1,"san");
1387 if (i == (ssize_t) argc)
1388 ThrowDisplayException(OptionError,"MissingArgument",option);
1389 resource_info.map_type=argv[i];
1392 if (LocaleCompare("matte",option+1) == 0)
1394 if (LocaleCompare("mattecolor",option+1) == 0)
1399 if (i == (ssize_t) argc)
1400 ThrowDisplayException(OptionError,"MissingArgument",option);
1401 resource_info.matte_color=argv[i];
1404 if (LocaleCompare("monitor",option+1) == 0)
1406 if (LocaleCompare("monochrome",option+1) == 0)
1410 quantize_info->number_colors=2;
1411 quantize_info->colorspace=GRAYColorspace;
1414 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
1418 if (LocaleCompare("name",option+1) == 0)
1420 resource_info.name=(char *) NULL;
1424 if (i == (ssize_t) argc)
1425 ThrowDisplayException(OptionError,"MissingArgument",option);
1426 resource_info.name=ConstantString(argv[i]);
1429 if (LocaleCompare("negate",option+1) == 0)
1431 if (LocaleCompare("noop",option+1) == 0)
1433 if (LocaleCompare("normalize",option+1) == 0)
1435 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
1439 if (LocaleCompare("page",option+1) == 0)
1441 resource_info.image_geometry=(char *) NULL;
1445 if (i == (ssize_t) argc)
1446 ThrowDisplayException(OptionError,"MissingArgument",option);
1447 resource_info.image_geometry=ConstantString(argv[i]);
1450 if (LocaleCompare("profile",option+1) == 0)
1453 if (i == (ssize_t) argc)
1454 ThrowDisplayException(OptionError,"MissingArgument",option);
1457 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
1461 if (LocaleCompare("quality",option+1) == 0)
1466 if (i == (ssize_t) argc)
1467 ThrowDisplayException(OptionError,"MissingArgument",option);
1468 if (IsGeometry(argv[i]) == MagickFalse)
1469 ThrowDisplayInvalidArgumentException(option,argv[i]);
1472 if (LocaleCompare("quantize",option+1) == 0)
1480 if (i == (ssize_t) (argc-1))
1481 ThrowDisplayException(OptionError,"MissingArgument",option);
1482 colorspace=ParseCommandOption(MagickColorspaceOptions,
1483 MagickFalse,argv[i]);
1485 ThrowDisplayException(OptionError,"UnrecognizedColorspace",
1489 if (LocaleCompare("quiet",option+1) == 0)
1491 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
1495 if (LocaleCompare("raise",option+1) == 0)
1498 if (i == (ssize_t) argc)
1499 ThrowDisplayException(OptionError,"MissingArgument",option);
1500 if (IsGeometry(argv[i]) == MagickFalse)
1501 ThrowDisplayInvalidArgumentException(option,argv[i]);
1504 if (LocaleCompare("regard-warnings",option+1) == 0)
1506 if (LocaleCompare("remote",option+1) == 0)
1509 if (i == (ssize_t) argc)
1510 ThrowDisplayException(OptionError,"MissingArgument",option);
1511 if (XRemoteCommand(display,resource_info.window_id,argv[i]) != 0)
1512 return(MagickFalse);
1516 if (LocaleCompare("repage",option+1) == 0)
1521 if (i == (ssize_t) argc)
1522 ThrowDisplayException(OptionError,"MissingArgument",option);
1523 if (IsGeometry(argv[i]) == MagickFalse)
1524 ThrowDisplayInvalidArgumentException(option,argv[i]);
1527 if (LocaleCompare("resample",option+1) == 0)
1532 if (i == (ssize_t) (argc-1))
1533 ThrowDisplayException(OptionError,"MissingArgument",option);
1534 if (IsGeometry(argv[i]) == MagickFalse)
1535 ThrowDisplayInvalidArgumentException(option,argv[i]);
1538 if (LocaleCompare("resize",option+1) == 0)
1543 if (i == (ssize_t) argc)
1544 ThrowDisplayException(OptionError,"MissingArgument",option);
1545 if (IsGeometry(argv[i]) == MagickFalse)
1546 ThrowDisplayInvalidArgumentException(option,argv[i]);
1549 if (LocaleNCompare("respect-parentheses",option+1,17) == 0)
1551 respect_parenthesis=(*option == '-') ? MagickTrue : MagickFalse;
1554 if (LocaleCompare("roll",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("rotate",option+1) == 0)
1568 if (i == (ssize_t) argc)
1569 ThrowDisplayException(OptionError,"MissingArgument",option);
1570 if (IsGeometry(argv[i]) == MagickFalse)
1571 ThrowDisplayInvalidArgumentException(option,argv[i]);
1574 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
1578 if (LocaleCompare("sample",option+1) == 0)
1583 if (i == (ssize_t) argc)
1584 ThrowDisplayException(OptionError,"MissingArgument",option);
1585 if (IsGeometry(argv[i]) == MagickFalse)
1586 ThrowDisplayInvalidArgumentException(option,argv[i]);
1589 if (LocaleCompare("sampling-factor",option+1) == 0)
1594 if (i == (ssize_t) argc)
1595 ThrowDisplayException(OptionError,"MissingArgument",option);
1596 if (IsGeometry(argv[i]) == MagickFalse)
1597 ThrowDisplayInvalidArgumentException(option,argv[i]);
1600 if (LocaleCompare("scenes",option+1) == 0)
1605 if (i == (ssize_t) argc)
1606 ThrowDisplayException(OptionError,"MissingArgument",option);
1607 if (IsSceneGeometry(argv[i],MagickFalse) == MagickFalse)
1608 ThrowDisplayInvalidArgumentException(option,argv[i]);
1611 if (LocaleCompare("seed",option+1) == 0)
1616 if (i == (ssize_t) (argc-1))
1617 ThrowDisplayException(OptionError,"MissingArgument",option);
1618 if (IsGeometry(argv[i]) == MagickFalse)
1619 ThrowDisplayInvalidArgumentException(option,argv[i]);
1622 if (LocaleCompare("segment",option+1) == 0)
1627 if (i == (ssize_t) argc)
1628 ThrowDisplayException(OptionError,"MissingArgument",option);
1629 if (IsGeometry(argv[i]) == MagickFalse)
1630 ThrowDisplayInvalidArgumentException(option,argv[i]);
1633 if (LocaleCompare("set",option+1) == 0)
1636 if (i == (ssize_t) argc)
1637 ThrowDisplayException(OptionError,"MissingArgument",option);
1641 if (i == (ssize_t) argc)
1642 ThrowDisplayException(OptionError,"MissingArgument",option);
1645 if (LocaleCompare("sharpen",option+1) == 0)
1650 if (i == (ssize_t) argc)
1651 ThrowDisplayException(OptionError,"MissingArgument",option);
1652 if (IsGeometry(argv[i]) == MagickFalse)
1653 ThrowDisplayInvalidArgumentException(option,argv[i]);
1656 if (LocaleCompare("shared-memory",option+1) == 0)
1658 resource_info.use_shared_memory= (*option == '-') ? MagickTrue :
1662 if (LocaleCompare("size",option+1) == 0)
1667 if (i == (ssize_t) argc)
1668 ThrowDisplayException(OptionError,"MissingArgument",option);
1669 if (IsGeometry(argv[i]) == MagickFalse)
1670 ThrowDisplayInvalidArgumentException(option,argv[i]);
1673 if (LocaleCompare("strip",option+1) == 0)
1675 if (LocaleCompare("support",option+1) == 0)
1677 i++; /* deprecated */
1680 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
1684 if (LocaleCompare("text-font",option+1) == 0)
1686 resource_info.text_font=(char *) NULL;
1690 if (i == (ssize_t) argc)
1691 ThrowDisplayException(OptionError,"MissingArgument",option);
1692 resource_info.text_font=XGetResourceClass(resource_database,
1693 GetClientName(),"font",argv[i]);
1696 if (LocaleCompare("texture",option+1) == 0)
1701 if (i == (ssize_t) argc)
1702 ThrowDisplayException(OptionError,"MissingArgument",option);
1705 if (LocaleCompare("threshold",option+1) == 0)
1710 if (i == (ssize_t) argc)
1711 ThrowDisplayException(OptionError,"MissingArgument",option);
1712 if (IsGeometry(argv[i]) == MagickFalse)
1713 ThrowDisplayInvalidArgumentException(option,argv[i]);
1716 if (LocaleCompare("thumbnail",option+1) == 0)
1721 if (i == (ssize_t) argc)
1722 ThrowDisplayException(OptionError,"MissingArgument",option);
1723 if (IsGeometry(argv[i]) == MagickFalse)
1724 ThrowDisplayInvalidArgumentException(option,argv[i]);
1727 if (LocaleCompare("title",option+1) == 0)
1729 resource_info.title=(char *) NULL;
1733 if (i == (ssize_t) argc)
1734 ThrowDisplayException(OptionError,"MissingArgument",option);
1735 resource_info.title=argv[i];
1738 if (LocaleCompare("transparent-color",option+1) == 0)
1743 if (i == (ssize_t) (argc-1))
1744 ThrowDisplayException(OptionError,"MissingArgument",option);
1747 if (LocaleCompare("treedepth",option+1) == 0)
1749 quantize_info->tree_depth=0;
1753 if (i == (ssize_t) argc)
1754 ThrowDisplayException(OptionError,"MissingArgument",option);
1755 if (IsGeometry(argv[i]) == MagickFalse)
1756 ThrowDisplayInvalidArgumentException(option,argv[i]);
1757 quantize_info->tree_depth=StringToUnsignedLong(argv[i]);
1760 if (LocaleCompare("trim",option+1) == 0)
1762 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
1766 if (LocaleCompare("update",option+1) == 0)
1768 resource_info.update=(unsigned int) (*option == '-');
1772 if (i == (ssize_t) argc)
1773 ThrowDisplayException(OptionError,"MissingArgument",option);
1774 if (IsGeometry(argv[i]) == MagickFalse)
1775 ThrowDisplayInvalidArgumentException(option,argv[i]);
1776 resource_info.update=(unsigned int) StringToUnsignedLong(argv[i]);
1779 if (LocaleCompare("use-pixmap",option+1) == 0)
1781 resource_info.use_pixmap=(*option == '-') ? MagickTrue :
1785 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
1789 if (LocaleCompare("verbose",option+1) == 0)
1791 if ((LocaleCompare("version",option+1) == 0) ||
1792 (LocaleCompare("-version",option+1) == 0))
1794 (void) FormatLocaleFile(stdout,"Version: %s\n",
1795 GetMagickVersion((size_t *) NULL));
1796 (void) FormatLocaleFile(stdout,"Copyright: %s\n",
1797 GetMagickCopyright());
1798 (void) FormatLocaleFile(stdout,"Features: %s\n\n",
1799 GetMagickFeatures());
1802 if (LocaleCompare("visual",option+1) == 0)
1804 resource_info.visual_type=(char *) NULL;
1808 if (i == (ssize_t) argc)
1809 ThrowDisplayException(OptionError,"MissingArgument",option);
1810 resource_info.visual_type=argv[i];
1813 if (LocaleCompare("virtual-pixel",option+1) == 0)
1821 if (i == (ssize_t) (argc-1))
1822 ThrowDisplayException(OptionError,"MissingArgument",option);
1823 method=ParseCommandOption(MagickVirtualPixelOptions,MagickFalse,
1826 ThrowDisplayException(OptionError,
1827 "UnrecognizedVirtualPixelMethod",argv[i]);
1830 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
1834 if (LocaleCompare("window",option+1) == 0)
1836 resource_info.window_id=(char *) NULL;
1840 if (i == (ssize_t) argc)
1841 ThrowDisplayException(OptionError,"MissingArgument",option);
1842 resource_info.window_id=argv[i];
1845 if (LocaleCompare("window-group",option+1) == 0)
1847 resource_info.window_group=(char *) NULL;
1851 if (i == (ssize_t) argc)
1852 ThrowDisplayException(OptionError,"MissingArgument",option);
1853 if (InterpretLocaleValue(argv[i],(char **) NULL) != 0)
1854 resource_info.window_group=argv[i];
1857 if (LocaleCompare("write",option+1) == 0)
1859 resource_info.write_filename=(char *) NULL;
1863 if (i == (ssize_t) argc)
1864 ThrowDisplayException(OptionError,"MissingArgument",option);
1865 resource_info.write_filename=argv[i];
1866 if (IsPathAccessible(resource_info.write_filename) != MagickFalse)
1872 (void) FormatLocaleFile(stderr,"Overwrite %s? ",
1873 resource_info.write_filename);
1874 p=fgets(answer,(int) sizeof(answer),stdin);
1876 if (((*answer != 'y') && (*answer != 'Y')))
1877 return(MagickFalse);
1881 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
1886 ThrowDisplayException(OptionError,"UnrecognizedOption",option);
1888 fire=(GetCommandOptionFlags(MagickCommandOptions,MagickFalse,option) &
1889 FireOptionFlag) == 0 ? MagickFalse : MagickTrue;
1890 if (fire != MagickFalse)
1891 FireImageStack(MagickFalse,MagickTrue,MagickTrue);
1894 ThrowDisplayException(OptionError,"UnbalancedParenthesis",argv[i]);
1895 if (state & RetainColorsState)
1897 XRetainWindowColors(display,XRootWindow(display,XDefaultScreen(display)));
1898 (void) XSync(display,MagickFalse);
1901 return(status != 0 ? MagickTrue : MagickFalse);
1905 (void) ThrowMagickException(exception,GetMagickModule(),MissingDelegateError,
1906 "DelegateLibrarySupportNotBuiltIn","`%s' (X11)",image_info->filename);
1907 return(DisplayUsage());