PageRenderTime 53ms CodeModel.GetById 15ms RepoModel.GetById 1ms app.codeStats 0ms

/ImageMagick-6.7.7-5/wand/animate.c

#
C | 1476 lines | 1329 code | 39 blank | 108 comment | 593 complexity | 0ad81ff66f02d4708f4c7958b5e731f8 MD5 | raw file
Possible License(s): MPL-2.0-no-copyleft-exception

Large files files are truncated, but you can click here to view the full file

  1. /*
  2. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  3. % %
  4. % %
  5. % %
  6. % AAA N N IIIII M M AAA TTTTT EEEEE %
  7. % A A NN N I MM MM A A T E %
  8. % AAAAA N N N I M M M AAAAA T EEE %
  9. % A A N NN I M M A A T E %
  10. % A A N N IIIII M M A A T EEEEE %
  11. % %
  12. % %
  13. % Methods to Interactively Animate an Image Sequence %
  14. % %
  15. % Software Design %
  16. % John Cristy %
  17. % July 1992 %
  18. % %
  19. % %
  20. % Copyright 1999-2012 ImageMagick Studio LLC, a non-profit organization %
  21. % dedicated to making software imaging solutions freely available. %
  22. % %
  23. % You may not use this file except in compliance with the License. You may %
  24. % obtain a copy of the License at %
  25. % %
  26. % http://www.imagemagick.org/script/license.php %
  27. % %
  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. %
  33. % %
  34. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  35. %
  36. % Use the animate program to animate an image sequence on any X server.
  37. %
  38. */
  39. /*
  40. Include declarations.
  41. */
  42. #include "wand/studio.h"
  43. #include "wand/MagickWand.h"
  44. #include "wand/mogrify-private.h"
  45. #include "magick/animate-private.h"
  46. #include "magick/string-private.h"
  47. /*
  48. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  49. % %
  50. % %
  51. % %
  52. + A n i m a t e I m a g e C o m m a n d %
  53. % %
  54. % %
  55. % %
  56. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  57. %
  58. % AnimateImageCommand() displays a sequence of images on any workstation
  59. % display running an X server. Animate first determines the hardware
  60. % capabilities of the workstation. If the number of unique colors in an image
  61. % is less than or equal to the number the workstation can support, the image
  62. % is displayed in an X window. Otherwise the number of colors in the image is
  63. % first reduced to match the color resolution of the workstation before it is
  64. % displayed.
  65. %
  66. % This means that a continuous-tone 24 bits/pixel image can display on a 8
  67. % bit pseudo-color device or monochrome device. In most instances the reduced
  68. % color image closely resembles the original. Alternatively, a monochrome or
  69. % pseudo-color image sequence can display on a continuous-tone 24 bits/pixels
  70. % device.
  71. %
  72. % The format of the AnimateImageCommand method is:
  73. %
  74. % MagickBooleanType AnimateImageCommand(ImageInfo *image_info,int argc,
  75. % char **argv,char **metadata,ExceptionInfo *exception)
  76. %
  77. % A description of each parameter follows:
  78. %
  79. % o image_info: the image info.
  80. %
  81. % o argc: the number of elements in the argument vector.
  82. %
  83. % o argv: A text array containing the command line arguments.
  84. %
  85. % o metadata: any metadata is returned here.
  86. %
  87. % o exception: return any errors or warnings in this structure.
  88. %
  89. */
  90. static MagickBooleanType AnimateUsage(void)
  91. {
  92. const char
  93. **p;
  94. static const char
  95. *buttons[]=
  96. {
  97. "Press any button to map or unmap the Command widget",
  98. (char *) NULL
  99. },
  100. *miscellaneous[]=
  101. {
  102. "-debug events display copious debugging information",
  103. "-help print program options",
  104. "-list type print a list of supported option arguments",
  105. "-log format format of debugging information",
  106. "-version print version information",
  107. (char *) NULL
  108. },
  109. *operators[]=
  110. {
  111. "-colors value preferred number of colors in the image",
  112. "-crop geometry preferred size and location of the cropped image",
  113. "-extract geometry extract area from image",
  114. "-monochrome transform image to black and white",
  115. "-repage geometry size and location of an image canvas (operator)",
  116. "-resample geometry change the resolution of an image",
  117. "-resize geometry resize the image",
  118. "-rotate degrees apply Paeth rotation to the image",
  119. "-strip strip image of all profiles and comments",
  120. "-thumbnail geometry create a thumbnail of the image",
  121. "-trim trim image edges",
  122. (char *) NULL
  123. },
  124. *settings[]=
  125. {
  126. "-alpha option on, activate, off, deactivate, set, opaque, copy",
  127. " transparent, extract, background, or shape",
  128. "-authenticate password",
  129. " decipher image with this password",
  130. "-backdrop display image centered on a backdrop",
  131. "-channel type apply option to select image channels",
  132. "-colormap type Shared or Private",
  133. "-colorspace type alternate image colorspace",
  134. "-decipher filename convert cipher pixels to plain pixels",
  135. "-define format:option",
  136. " define one or more image format options",
  137. "-delay value display the next image after pausing",
  138. "-density geometry horizontal and vertical density of the image",
  139. "-depth value image depth",
  140. "-display server display image to this X server",
  141. "-dispose method layer disposal method",
  142. "-dither method apply error diffusion to image",
  143. "-filter type use this filter when resizing an image",
  144. "-format \"string\" output formatted image characteristics",
  145. "-gamma value level of gamma correction",
  146. "-geometry geometry preferred size and location of the Image window",
  147. "-gravity type horizontal and vertical backdrop placement",
  148. "-identify identify the format and characteristics of the image",
  149. "-immutable displayed image cannot be modified",
  150. "-interlace type type of image interlacing scheme",
  151. "-interpolate method pixel color interpolation method",
  152. "-limit type value pixel cache resource limit",
  153. "-loop iterations loop images then exit",
  154. "-map type display image using this Standard Colormap",
  155. "-monitor monitor progress",
  156. "-pause seconds to pause before reanimating",
  157. "-page geometry size and location of an image canvas (setting)",
  158. "-quantize colorspace reduce colors in this colorspace",
  159. "-quiet suppress all warning messages",
  160. "-regard-warnings pay attention to warning messages",
  161. "-remote command execute a command in an remote display process",
  162. "-respect-parentheses settings remain in effect until parenthesis boundary",
  163. "-sampling-factor geometry",
  164. " horizontal and vertical sampling factor",
  165. "-seed value seed a new sequence of pseudo-random numbers",
  166. "-set attribute value set an image attribute",
  167. "-size geometry width and height of image",
  168. "-transparent-color color",
  169. " transparent color",
  170. "-treedepth value color tree depth",
  171. "-verbose print detailed information about the image",
  172. "-visual type display image using this visual type",
  173. "-virtual-pixel method",
  174. " virtual pixel access method",
  175. "-window id display image to background of this window",
  176. (char *) NULL
  177. },
  178. *sequence_operators[]=
  179. {
  180. "-coalesce merge a sequence of images",
  181. "-flatten flatten a sequence of images",
  182. (char *) NULL
  183. };
  184. (void) printf("Version: %s\n",GetMagickVersion((size_t *) NULL));
  185. (void) printf("Copyright: %s\n",GetMagickCopyright());
  186. (void) printf("Features: %s\n\n",GetMagickFeatures());
  187. (void) printf("Usage: %s [options ...] file [ [options ...] file ...]\n",
  188. GetClientName());
  189. (void) printf("\nImage Settings:\n");
  190. for (p=settings; *p != (char *) NULL; p++)
  191. (void) printf(" %s\n",*p);
  192. (void) printf("\nImage Operators:\n");
  193. for (p=operators; *p != (char *) NULL; p++)
  194. (void) printf(" %s\n",*p);
  195. (void) printf("\nImage Sequence Operators:\n");
  196. for (p=sequence_operators; *p != (char *) NULL; p++)
  197. (void) printf(" %s\n",*p);
  198. (void) printf("\nMiscellaneous Options:\n");
  199. for (p=miscellaneous; *p != (char *) NULL; p++)
  200. (void) printf(" %s\n",*p);
  201. (void) printf(
  202. "\nIn addition to those listed above, you can specify these standard X\n");
  203. (void) printf(
  204. "resources as command line options: -background, -bordercolor,\n");
  205. (void) printf(
  206. "-borderwidth, -font, -foreground, -iconGeometry, -iconic, -name,\n");
  207. (void) printf("-mattecolor, -shared-memory, or -title.\n");
  208. (void) printf(
  209. "\nBy default, the image format of `file' is determined by its magic\n");
  210. (void) printf(
  211. "number. To specify a particular image format, precede the filename\n");
  212. (void) printf(
  213. "with an image format name and a colon (i.e. ps:image) or specify the\n");
  214. (void) printf(
  215. "image type as the filename suffix (i.e. image.ps). Specify 'file' as\n");
  216. (void) printf("'-' for standard input or output.\n");
  217. (void) printf("\nButtons: \n");
  218. for (p=buttons; *p != (char *) NULL; p++)
  219. (void) printf(" %s\n",*p);
  220. return(MagickFalse);
  221. }
  222. WandExport MagickBooleanType AnimateImageCommand(ImageInfo *image_info,
  223. int argc,char **argv,char **wand_unused(metadata),ExceptionInfo *exception)
  224. {
  225. #if defined(MAGICKCORE_X11_DELEGATE)
  226. #define DestroyAnimate() \
  227. { \
  228. XDestroyResourceInfo(&resource_info); \
  229. if (display != (Display *) NULL) \
  230. { \
  231. XCloseDisplay(display); \
  232. display=(Display *) NULL; \
  233. } \
  234. XDestroyResourceInfo(&resource_info); \
  235. DestroyImageStack(); \
  236. for (i=0; i < (ssize_t) argc; i++) \
  237. argv[i]=DestroyString(argv[i]); \
  238. argv=(char **) RelinquishMagickMemory(argv); \
  239. }
  240. #define ThrowAnimateException(asperity,tag,option) \
  241. { \
  242. (void) ThrowMagickException(exception,GetMagickModule(),asperity,tag,"`%s'", \
  243. option); \
  244. DestroyAnimate(); \
  245. return(MagickFalse); \
  246. }
  247. #define ThrowAnimateInvalidArgumentException(option,argument) \
  248. { \
  249. (void) ThrowMagickException(exception,GetMagickModule(),OptionError, \
  250. "InvalidArgument","`%s': %s",option,argument); \
  251. DestroyAnimate(); \
  252. return(MagickFalse); \
  253. }
  254. char
  255. *resource_value,
  256. *server_name;
  257. const char
  258. *option;
  259. Display
  260. *display;
  261. Image
  262. *image;
  263. ImageStack
  264. image_stack[MaxImageStackDepth+1];
  265. MagickBooleanType
  266. fire,
  267. pend,
  268. respect_parenthesis;
  269. MagickStatusType
  270. status;
  271. QuantizeInfo
  272. *quantize_info;
  273. register ssize_t
  274. i;
  275. ssize_t
  276. j,
  277. k;
  278. XResourceInfo
  279. resource_info;
  280. XrmDatabase
  281. resource_database;
  282. /*
  283. Set defaults.
  284. */
  285. assert(image_info != (ImageInfo *) NULL);
  286. assert(image_info->signature == MagickSignature);
  287. if (image_info->debug != MagickFalse)
  288. (void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");
  289. assert(exception != (ExceptionInfo *) NULL);
  290. if (argc == 2)
  291. {
  292. option=argv[1];
  293. if ((LocaleCompare("version",option+1) == 0) ||
  294. (LocaleCompare("-version",option+1) == 0))
  295. {
  296. (void) FormatLocaleFile(stdout,"Version: %s\n",
  297. GetMagickVersion((size_t *) NULL));
  298. (void) FormatLocaleFile(stdout,"Copyright: %s\n",
  299. GetMagickCopyright());
  300. (void) FormatLocaleFile(stdout,"Features: %s\n\n",
  301. GetMagickFeatures());
  302. return(MagickFalse);
  303. }
  304. }
  305. status=MagickTrue;
  306. SetNotifyHandlers;
  307. display=(Display *) NULL;
  308. j=1;
  309. k=0;
  310. NewImageStack();
  311. option=(char *) NULL;
  312. pend=MagickFalse;
  313. respect_parenthesis=MagickFalse;
  314. resource_database=(XrmDatabase) NULL;
  315. (void) ResetMagickMemory(&resource_info,0,sizeof(XResourceInfo));
  316. server_name=(char *) NULL;
  317. status=MagickTrue;
  318. /*
  319. Check for server name specified on the command line.
  320. */
  321. ReadCommandlLine(argc,&argv);
  322. status=ExpandFilenames(&argc,&argv);
  323. if (status == MagickFalse)
  324. ThrowAnimateException(ResourceLimitError,"MemoryAllocationFailed",
  325. image_info->filename);
  326. for (i=1; i < (ssize_t) argc; i++)
  327. {
  328. /*
  329. Check command line for server name.
  330. */
  331. option=argv[i];
  332. if (LocaleCompare("display",option+1) == 0)
  333. {
  334. /*
  335. User specified server name.
  336. */
  337. i++;
  338. if (i == (ssize_t) argc)
  339. ThrowAnimateException(OptionError,"MissingArgument",option);
  340. server_name=argv[i];
  341. }
  342. if ((LocaleCompare("help",option+1) == 0) ||
  343. (LocaleCompare("-help",option+1) == 0))
  344. return(AnimateUsage());
  345. }
  346. /*
  347. Get user defaults from X resource database.
  348. */
  349. display=XOpenDisplay(server_name);
  350. if (display == (Display *) NULL)
  351. ThrowAnimateException(XServerError,"UnableToOpenXServer",
  352. XDisplayName(server_name));
  353. (void) XSetErrorHandler(XError);
  354. resource_database=XGetResourceDatabase(display,GetClientName());
  355. XGetResourceInfo(image_info,resource_database,GetClientName(),
  356. &resource_info);
  357. quantize_info=resource_info.quantize_info;
  358. image_info->density=XGetResourceInstance(resource_database,GetClientName(),
  359. "density",(char *) NULL);
  360. if (image_info->density == (char *) NULL)
  361. image_info->density=XGetScreenDensity(display);
  362. resource_value=XGetResourceInstance(resource_database,GetClientName(),
  363. "interlace","none");
  364. image_info->interlace=(InterlaceType)
  365. ParseCommandOption(MagickInterlaceOptions,MagickFalse,resource_value);
  366. resource_value=XGetResourceInstance(resource_database,GetClientName(),
  367. "verbose","False");
  368. image_info->verbose=IsMagickTrue(resource_value);
  369. resource_value=XGetResourceInstance(resource_database,GetClientName(),
  370. "dither","True");
  371. quantize_info->dither=IsMagickTrue(resource_value);
  372. /*
  373. Parse command line.
  374. */
  375. for (i=1; i <= (ssize_t) argc; i++)
  376. {
  377. if (i < (ssize_t) argc)
  378. option=argv[i];
  379. else
  380. if (image != (Image *) NULL)
  381. break;
  382. else
  383. if (isatty(STDIN_FILENO) != MagickFalse)
  384. option="logo:";
  385. else
  386. {
  387. int
  388. c;
  389. c=getc(stdin);
  390. if (c == EOF)
  391. option="logo:";
  392. else
  393. {
  394. c=ungetc(c,stdin);
  395. option="-";
  396. }
  397. }
  398. if (LocaleCompare(option,"(") == 0)
  399. {
  400. FireImageStack(MagickFalse,MagickTrue,pend);
  401. if (k == MaxImageStackDepth)
  402. ThrowAnimateException(OptionError,"ParenthesisNestedTooDeeply",
  403. option);
  404. PushImageStack();
  405. continue;
  406. }
  407. if (LocaleCompare(option,")") == 0)
  408. {
  409. FireImageStack(MagickFalse,MagickTrue,MagickTrue);
  410. if (k == 0)
  411. ThrowAnimateException(OptionError,"UnableToParseExpression",option);
  412. PopImageStack();
  413. continue;
  414. }
  415. if (IsCommandOption(option) == MagickFalse)
  416. {
  417. const char
  418. *filename;
  419. Image
  420. *images;
  421. /*
  422. Read input image.
  423. */
  424. FireImageStack(MagickFalse,MagickFalse,pend);
  425. filename=option;
  426. if ((LocaleCompare(filename,"--") == 0) && (i < (ssize_t) (argc-1)))
  427. {
  428. option=argv[++i];
  429. filename=option;
  430. }
  431. (void) SetImageOption(image_info,"filename",filename);
  432. (void) CopyMagickString(image_info->filename,filename,MaxTextExtent);
  433. if (image_info->ping != MagickFalse)
  434. images=PingImages(image_info,exception);
  435. else
  436. images=ReadImages(image_info,exception);
  437. status&=(images != (Image *) NULL) &&
  438. (exception->severity < ErrorException);
  439. if (images == (Image *) NULL)
  440. continue;
  441. AppendImageStack(images);
  442. continue;
  443. }
  444. pend=image != (Image *) NULL ? MagickTrue : MagickFalse;
  445. switch (*(option+1))
  446. {
  447. case 'a':
  448. {
  449. if (LocaleCompare("alpha",option+1) == 0)
  450. {
  451. ssize_t
  452. type;
  453. if (*option == '+')
  454. break;
  455. i++;
  456. if (i == (ssize_t) argc)
  457. ThrowAnimateException(OptionError,"MissingArgument",option);
  458. type=ParseCommandOption(MagickAlphaOptions,MagickFalse,argv[i]);
  459. if (type < 0)
  460. ThrowAnimateException(OptionError,"UnrecognizedAlphaChannelType",
  461. argv[i]);
  462. break;
  463. }
  464. if (LocaleCompare("authenticate",option+1) == 0)
  465. {
  466. if (*option == '+')
  467. break;
  468. i++;
  469. if (i == (ssize_t) argc)
  470. ThrowAnimateException(OptionError,"MissingArgument",option);
  471. break;
  472. }
  473. ThrowAnimateException(OptionError,"UnrecognizedOption",option);
  474. }
  475. case 'b':
  476. {
  477. if (LocaleCompare("backdrop",option+1) == 0)
  478. {
  479. resource_info.backdrop=(*option == '-') ? MagickTrue : MagickFalse;
  480. break;
  481. }
  482. if (LocaleCompare("background",option+1) == 0)
  483. {
  484. if (*option == '+')
  485. break;
  486. i++;
  487. if (i == (ssize_t) argc)
  488. ThrowAnimateException(OptionError,"MissingArgument",option);
  489. resource_info.background_color=argv[i];
  490. break;
  491. }
  492. if (LocaleCompare("bordercolor",option+1) == 0)
  493. {
  494. if (*option == '+')
  495. break;
  496. i++;
  497. if (i == (ssize_t) argc)
  498. ThrowAnimateException(OptionError,"MissingArgument",option);
  499. resource_info.border_color=argv[i];
  500. break;
  501. }
  502. if (LocaleCompare("borderwidth",option+1) == 0)
  503. {
  504. resource_info.border_width=0;
  505. if (*option == '+')
  506. break;
  507. i++;
  508. if ((i == (ssize_t) argc) || (IsGeometry(argv[i]) == MagickFalse))
  509. ThrowAnimateException(OptionError,"MissingArgument",option);
  510. resource_info.border_width=(unsigned int)
  511. StringToUnsignedLong(argv[i]);
  512. break;
  513. }
  514. ThrowAnimateException(OptionError,"UnrecognizedOption",option);
  515. }
  516. case 'c':
  517. {
  518. if (LocaleCompare("cache",option+1) == 0)
  519. {
  520. if (*option == '+')
  521. break;
  522. i++;
  523. if (i == (ssize_t) argc)
  524. ThrowAnimateException(OptionError,"MissingArgument",option);
  525. if (IsGeometry(argv[i]) == MagickFalse)
  526. ThrowAnimateInvalidArgumentException(option,argv[i]);
  527. break;
  528. }
  529. if (LocaleCompare("channel",option+1) == 0)
  530. {
  531. ssize_t
  532. channel;
  533. if (*option == '+')
  534. break;
  535. i++;
  536. if (i == (ssize_t) (argc-1))
  537. ThrowAnimateException(OptionError,"MissingArgument",option);
  538. channel=ParseChannelOption(argv[i]);
  539. if (channel < 0)
  540. ThrowAnimateException(OptionError,"UnrecognizedChannelType",
  541. argv[i]);
  542. break;
  543. }
  544. if (LocaleCompare("clone",option+1) == 0)
  545. {
  546. Image
  547. *clone_images;
  548. clone_images=image;
  549. if (k != 0)
  550. clone_images=image_stack[k-1].image;
  551. if (clone_images == (Image *) NULL)
  552. ThrowAnimateException(ImageError,"ImageSequenceRequired",option);
  553. FireImageStack(MagickFalse,MagickTrue,MagickTrue);
  554. if (*option == '+')
  555. clone_images=CloneImages(clone_images,"-1",exception);
  556. else
  557. {
  558. i++;
  559. if (i == (ssize_t) (argc-1))
  560. ThrowAnimateException(OptionError,"MissingArgument",option);
  561. if (IsSceneGeometry(argv[i],MagickFalse) == MagickFalse)
  562. ThrowAnimateInvalidArgumentException(option,argv[i]);
  563. clone_images=CloneImages(clone_images,argv[i],exception);
  564. }
  565. if (clone_images == (Image *) NULL)
  566. ThrowAnimateException(OptionError,"NoSuchImage",option);
  567. AppendImageStack(clone_images);
  568. break;
  569. }
  570. if (LocaleCompare("coalesce",option+1) == 0)
  571. break;
  572. if (LocaleCompare("colormap",option+1) == 0)
  573. {
  574. resource_info.colormap=PrivateColormap;
  575. if (*option == '+')
  576. break;
  577. i++;
  578. if (i == (ssize_t) argc)
  579. ThrowAnimateException(OptionError,"MissingArgument",option);
  580. resource_info.colormap=UndefinedColormap;
  581. if (LocaleCompare("private",argv[i]) == 0)
  582. resource_info.colormap=PrivateColormap;
  583. if (LocaleCompare("shared",argv[i]) == 0)
  584. resource_info.colormap=SharedColormap;
  585. if (resource_info.colormap == UndefinedColormap)
  586. ThrowAnimateException(OptionError,"UnrecognizedColormapType",
  587. argv[i]);
  588. break;
  589. }
  590. if (LocaleCompare("colors",option+1) == 0)
  591. {
  592. quantize_info->number_colors=0;
  593. if (*option == '+')
  594. break;
  595. i++;
  596. if (i == (ssize_t) argc)
  597. ThrowAnimateException(OptionError,"MissingArgument",option);
  598. if (IsGeometry(argv[i]) == MagickFalse)
  599. ThrowAnimateInvalidArgumentException(option,argv[i]);
  600. quantize_info->number_colors=StringToUnsignedLong(argv[i]);
  601. break;
  602. }
  603. if (LocaleCompare("colorspace",option+1) == 0)
  604. {
  605. ssize_t
  606. colorspace;
  607. if (*option == '+')
  608. break;
  609. i++;
  610. if (i == (ssize_t) argc)
  611. ThrowAnimateException(OptionError,"MissingArgument",option);
  612. colorspace=ParseCommandOption(MagickColorspaceOptions,
  613. MagickFalse,argv[i]);
  614. if (colorspace < 0)
  615. ThrowAnimateException(OptionError,"UnrecognizedColorspace",
  616. argv[i]);
  617. break;
  618. }
  619. if (LocaleCompare("concurrent",option+1) == 0)
  620. break;
  621. if (LocaleCompare("crop",option+1) == 0)
  622. {
  623. if (*option == '+')
  624. break;
  625. i++;
  626. if (i == (ssize_t) argc)
  627. ThrowAnimateException(OptionError,"MissingArgument",option);
  628. if (IsGeometry(argv[i]) == MagickFalse)
  629. ThrowAnimateInvalidArgumentException(option,argv[i]);
  630. break;
  631. }
  632. ThrowAnimateException(OptionError,"UnrecognizedOption",option);
  633. }
  634. case 'd':
  635. {
  636. if (LocaleCompare("debug",option+1) == 0)
  637. {
  638. ssize_t
  639. event;
  640. if (*option == '+')
  641. break;
  642. i++;
  643. if (i == (ssize_t) argc)
  644. ThrowAnimateException(OptionError,"MissingArgument",option);
  645. event=ParseCommandOption(MagickLogEventOptions,MagickFalse,argv[i]);
  646. if (event < 0)
  647. ThrowAnimateException(OptionError,"UnrecognizedEventType",
  648. argv[i]);
  649. (void) SetLogEventMask(argv[i]);
  650. break;
  651. }
  652. if (LocaleCompare("decipher",option+1) == 0)
  653. {
  654. if (*option == '+')
  655. break;
  656. i++;
  657. if (i == (ssize_t) (argc-1))
  658. ThrowAnimateException(OptionError,"MissingArgument",option);
  659. break;
  660. }
  661. if (LocaleCompare("define",option+1) == 0)
  662. {
  663. i++;
  664. if (i == (ssize_t) argc)
  665. ThrowAnimateException(OptionError,"MissingArgument",option);
  666. if (*option == '+')
  667. {
  668. const char
  669. *define;
  670. define=GetImageOption(image_info,argv[i]);
  671. if (define == (const char *) NULL)
  672. ThrowAnimateException(OptionError,"NoSuchOption",argv[i]);
  673. break;
  674. }
  675. break;
  676. }
  677. if (LocaleCompare("delay",option+1) == 0)
  678. {
  679. if (*option == '+')
  680. break;
  681. i++;
  682. if (i == (ssize_t) argc)
  683. ThrowAnimateException(OptionError,"MissingArgument",option);
  684. if (IsGeometry(argv[i]) == MagickFalse)
  685. ThrowAnimateInvalidArgumentException(option,argv[i]);
  686. break;
  687. }
  688. if (LocaleCompare("density",option+1) == 0)
  689. {
  690. if (*option == '+')
  691. break;
  692. i++;
  693. if (i == (ssize_t) argc)
  694. ThrowAnimateException(OptionError,"MissingArgument",option);
  695. if (IsGeometry(argv[i]) == MagickFalse)
  696. ThrowAnimateInvalidArgumentException(option,argv[i]);
  697. break;
  698. }
  699. if (LocaleCompare("depth",option+1) == 0)
  700. {
  701. if (*option == '+')
  702. break;
  703. i++;
  704. if (i == (ssize_t) argc)
  705. ThrowAnimateException(OptionError,"MissingArgument",option);
  706. if (IsGeometry(argv[i]) == MagickFalse)
  707. ThrowAnimateInvalidArgumentException(option,argv[i]);
  708. break;
  709. }
  710. if (LocaleCompare("display",option+1) == 0)
  711. {
  712. if (*option == '+')
  713. break;
  714. i++;
  715. if (i == (ssize_t) argc)
  716. ThrowAnimateException(OptionError,"MissingArgument",option);
  717. break;
  718. }
  719. if (LocaleCompare("dispose",option+1) == 0)
  720. {
  721. ssize_t
  722. dispose;
  723. if (*option == '+')
  724. break;
  725. i++;
  726. if (i == (ssize_t) argc)
  727. ThrowAnimateException(OptionError,"MissingArgument",option);
  728. dispose=ParseCommandOption(MagickDisposeOptions,MagickFalse,argv[i]);
  729. if (dispose < 0)
  730. ThrowAnimateException(OptionError,"UnrecognizedDisposeMethod",
  731. argv[i]);
  732. break;
  733. }
  734. if (LocaleCompare("dither",option+1) == 0)
  735. {
  736. ssize_t
  737. method;
  738. quantize_info->dither=MagickFalse;
  739. if (*option == '+')
  740. break;
  741. i++;
  742. if (i == (ssize_t) argc)
  743. ThrowAnimateException(OptionError,"MissingArgument",option);
  744. method=ParseCommandOption(MagickDitherOptions,MagickFalse,argv[i]);
  745. if (method < 0)
  746. ThrowAnimateException(OptionError,"UnrecognizedDitherMethod",
  747. argv[i]);
  748. quantize_info->dither=MagickTrue;
  749. quantize_info->dither_method=(DitherMethod) method;
  750. break;
  751. }
  752. if (LocaleCompare("duration",option+1) == 0)
  753. {
  754. if (*option == '+')
  755. break;
  756. i++;
  757. if (i == (ssize_t) (argc-1))
  758. ThrowAnimateException(OptionError,"MissingArgument",option);
  759. if (IsGeometry(argv[i]) == MagickFalse)
  760. ThrowAnimateInvalidArgumentException(option,argv[i]);
  761. break;
  762. }
  763. ThrowAnimateException(OptionError,"UnrecognizedOption",option);
  764. }
  765. case 'e':
  766. {
  767. if (LocaleCompare("extract",option+1) == 0)
  768. {
  769. if (*option == '+')
  770. break;
  771. i++;
  772. if (i == (ssize_t) argc)
  773. ThrowAnimateException(OptionError,"MissingArgument",option);
  774. if (IsGeometry(argv[i]) == MagickFalse)
  775. ThrowAnimateInvalidArgumentException(option,argv[i]);
  776. break;
  777. }
  778. ThrowAnimateException(OptionError,"UnrecognizedOption",option);
  779. }
  780. case 'f':
  781. {
  782. if (LocaleCompare("filter",option+1) == 0)
  783. {
  784. ssize_t
  785. filter;
  786. if (*option == '+')
  787. break;
  788. i++;
  789. if (i == (ssize_t) (argc-1))
  790. ThrowAnimateException(OptionError,"MissingArgument",option);
  791. filter=ParseCommandOption(MagickFilterOptions,MagickFalse,argv[i]);
  792. if (filter < 0)
  793. ThrowAnimateException(OptionError,"UnrecognizedImageFilter",
  794. argv[i]);
  795. break;
  796. }
  797. if (LocaleCompare("flatten",option+1) == 0)
  798. break;
  799. if (LocaleCompare("font",option+1) == 0)
  800. {
  801. if (*option == '+')
  802. break;
  803. i++;
  804. if (i == (ssize_t) argc)
  805. ThrowAnimateException(OptionError,"MissingArgument",option);
  806. resource_info.font=XGetResourceClass(resource_database,
  807. GetClientName(),"font",argv[i]);
  808. break;
  809. }
  810. if (LocaleCompare("foreground",option+1) == 0)
  811. {
  812. if (*option == '+')
  813. break;
  814. i++;
  815. if (i == (ssize_t) argc)
  816. ThrowAnimateException(OptionError,"MissingArgument",option);
  817. resource_info.foreground_color=argv[i];
  818. break;
  819. }
  820. if (LocaleCompare("format",option+1) == 0)
  821. {
  822. if (*option == '+')
  823. break;
  824. i++;
  825. if (i == (ssize_t) (argc-1))
  826. ThrowAnimateException(OptionError,"MissingArgument",option);
  827. break;
  828. }
  829. ThrowAnimateException(OptionError,"UnrecognizedOption",option);
  830. }
  831. case 'g':
  832. {
  833. if (LocaleCompare("gamma",option+1) == 0)
  834. {
  835. i++;
  836. if (i == (ssize_t) argc)
  837. ThrowAnimateException(OptionError,"MissingArgument",option);
  838. if (IsGeometry(argv[i]) == MagickFalse)
  839. ThrowAnimateInvalidArgumentException(option,argv[i]);
  840. break;
  841. }
  842. if (LocaleCompare("geometry",option+1) == 0)
  843. {
  844. resource_info.image_geometry=(char *) NULL;
  845. if (*option == '+')
  846. break;
  847. i++;
  848. if (i == (ssize_t) argc)
  849. ThrowAnimateException(OptionError,"MissingArgument",option);
  850. if (IsGeometry(argv[i]) == MagickFalse)
  851. ThrowAnimateInvalidArgumentException(option,argv[i]);
  852. resource_info.image_geometry=ConstantString(argv[i]);
  853. break;
  854. }
  855. if (LocaleCompare("gravity",option+1) == 0)
  856. {
  857. ssize_t
  858. gravity;
  859. if (*option == '+')
  860. break;
  861. i++;
  862. if (i == (ssize_t) (argc-1))
  863. ThrowAnimateException(OptionError,"MissingArgument",option);
  864. gravity=ParseCommandOption(MagickGravityOptions,MagickFalse,
  865. argv[i]);
  866. if (gravity < 0)
  867. ThrowAnimateException(OptionError,"UnrecognizedGravityType",
  868. argv[i]);
  869. break;
  870. }
  871. ThrowAnimateException(OptionError,"UnrecognizedOption",option);
  872. }
  873. case 'h':
  874. {
  875. if ((LocaleCompare("help",option+1) == 0) ||
  876. (LocaleCompare("-help",option+1) == 0))
  877. break;
  878. ThrowAnimateException(OptionError,"UnrecognizedOption",option);
  879. }
  880. case 'i':
  881. {
  882. if (LocaleCompare("iconGeometry",option+1) == 0)
  883. {
  884. resource_info.icon_geometry=(char *) NULL;
  885. if (*option == '+')
  886. break;
  887. i++;
  888. if (i == (ssize_t) argc)
  889. ThrowAnimateException(OptionError,"MissingArgument",option);
  890. if (IsGeometry(argv[i]) == MagickFalse)
  891. ThrowAnimateInvalidArgumentException(option,argv[i]);
  892. resource_info.icon_geometry=argv[i];
  893. break;
  894. }
  895. if (LocaleCompare("iconic",option+1) == 0)
  896. {
  897. resource_info.iconic=(*option == '-') ? MagickTrue : MagickFalse;
  898. break;
  899. }
  900. if (LocaleCompare("identify",option+1) == 0)
  901. break;
  902. if (LocaleCompare("immutable",option+1) == 0)
  903. {
  904. resource_info.immutable=(*option == '-') ? MagickTrue : MagickFalse;
  905. break;
  906. }
  907. if (LocaleCompare("interlace",option+1) == 0)
  908. {
  909. ssize_t
  910. interlace;
  911. if (*option == '+')
  912. break;
  913. i++;
  914. if (i == (ssize_t) argc)
  915. ThrowAnimateException(OptionError,"MissingArgument",option);
  916. interlace=ParseCommandOption(MagickInterlaceOptions,MagickFalse,
  917. argv[i]);
  918. if (interlace < 0)
  919. ThrowAnimateException(OptionError,"UnrecognizedInterlaceType",
  920. argv[i]);
  921. break;
  922. }
  923. if (LocaleCompare("interpolate",option+1) == 0)
  924. {
  925. ssize_t
  926. interpolate;
  927. if (*option == '+')
  928. break;
  929. i++;
  930. if (i == (ssize_t) argc)
  931. ThrowAnimateException(OptionError,"MissingArgument",option);
  932. interpolate=ParseCommandOption(MagickInterpolateOptions,MagickFalse,
  933. argv[i]);
  934. if (interpolate < 0)
  935. ThrowAnimateException(OptionError,"UnrecognizedInterpolateMethod",
  936. argv[i]);
  937. break;
  938. }
  939. ThrowAnimateException(OptionError,"UnrecognizedOption",option);
  940. }
  941. case 'l':
  942. {
  943. if (LocaleCompare("label",option+1) == 0)
  944. {
  945. if (*option == '+')
  946. break;
  947. i++;
  948. if (i == (ssize_t) argc)
  949. ThrowAnimateException(OptionError,"MissingArgument",option);
  950. break;
  951. }
  952. if (LocaleCompare("limit",option+1) == 0)
  953. {
  954. char
  955. *p;
  956. double
  957. value;
  958. ssize_t
  959. resource;
  960. if (*option == '+')
  961. break;
  962. i++;
  963. if (i == (ssize_t) argc)
  964. ThrowAnimateException(OptionError,"MissingArgument",option);
  965. resource=ParseCommandOption(MagickResourceOptions,MagickFalse,
  966. argv[i]);
  967. if (resource < 0)
  968. ThrowAnimateException(OptionError,"UnrecognizedResourceType",
  969. argv[i]);
  970. i++;
  971. if (i == (ssize_t) argc)
  972. ThrowAnimateException(OptionError,"MissingArgument",option);
  973. value=StringToDouble(argv[i],&p);
  974. (void) value;
  975. if ((p == argv[i]) && (LocaleCompare("unlimited",argv[i]) != 0))
  976. ThrowAnimateInvalidArgumentException(option,argv[i]);
  977. break;
  978. }
  979. if (LocaleCompare("list",option+1) == 0)
  980. {
  981. ssize_t
  982. list;
  983. if (*option == '+')
  984. break;
  985. i++;
  986. if (i == (ssize_t) argc)
  987. ThrowAnimateException(OptionError,"MissingArgument",option);
  988. list=ParseCommandOption(MagickListOptions,MagickFalse,argv[i]);
  989. if (list < 0)
  990. ThrowAnimateException(OptionError,"UnrecognizedListType",argv[i]);
  991. status=MogrifyImageInfo(image_info,(int) (i-j+1),(const char **)
  992. argv+j,exception);
  993. DestroyAnimate();
  994. return(status != 0 ? MagickFalse : MagickTrue);
  995. }
  996. if (LocaleCompare("log",option+1) == 0)
  997. {
  998. if (*option == '+')
  999. break;
  1000. i++;
  1001. if ((i == (ssize_t) argc) ||
  1002. (strchr(argv[i],'%') == (char *) NULL))
  1003. ThrowAnimateException(OptionError,"MissingArgument",option);
  1004. break;
  1005. }
  1006. if (LocaleCompare("loop",option+1) == 0)
  1007. {
  1008. if (*option == '+')
  1009. break;
  1010. i++;
  1011. if (i == (ssize_t) (argc-1))
  1012. ThrowAnimateException(OptionError,"MissingArgument",option);
  1013. if (IsGeometry(argv[i]) == MagickFalse)
  1014. ThrowAnimateInvalidArgumentException(option,argv[i]);
  1015. break;
  1016. }
  1017. ThrowAnimateException(OptionError,"UnrecognizedOption",option);
  1018. }
  1019. case 'm':
  1020. {
  1021. if (LocaleCompare("map",option+1) == 0)
  1022. {
  1023. resource_info.map_type=(char *) NULL;
  1024. if (*option == '+')
  1025. break;
  1026. (void) CopyMagickString(argv[i]+1,"san",MaxTextExtent);
  1027. i++;
  1028. if (i == (ssize_t) argc)
  1029. ThrowAnimateException(OptionError,"MissingArgument",option);
  1030. resource_info.map_type=argv[i];
  1031. break;
  1032. }
  1033. if (LocaleCompare("matte",option+1) == 0)
  1034. break;
  1035. if (LocaleCompare("mattecolor",option+1) == 0)
  1036. {
  1037. if (*option == '+')
  1038. break;
  1039. i++;
  1040. if (i == (ssize_t) argc)
  1041. ThrowAnimateException(OptionError,"MissingArgument",option);
  1042. resource_info.matte_color=argv[i];
  1043. break;
  1044. }
  1045. if (LocaleCompare("monitor",option+1) == 0)
  1046. break;
  1047. if (LocaleCompare("monochrome",option+1) == 0)
  1048. {
  1049. if (*option == '+')
  1050. break;
  1051. quantize_info->number_colors=2;
  1052. quantize_info->colorspace=GRAYColorspace;
  1053. break;
  1054. }
  1055. ThrowAnimateException(OptionError,"UnrecognizedOption",option);
  1056. }
  1057. case 'n':
  1058. {
  1059. if (LocaleCompare("name",option+1) == 0)
  1060. {
  1061. resource_info.name=(char *) NULL;
  1062. if (*option == '+')
  1063. break;
  1064. i++;
  1065. if (i == (ssize_t) argc)
  1066. ThrowAnimateException(OptionError,"MissingArgument",option);
  1067. resource_info.name=ConstantString(argv[i]);
  1068. break;
  1069. }
  1070. if (LocaleCompare("noop",option+1) == 0)
  1071. break;
  1072. ThrowAnimateException(OptionError,"UnrecognizedOption",option);
  1073. }
  1074. case 'p':
  1075. {
  1076. if (LocaleCompare("pause",option+1) == 0)
  1077. {
  1078. resource_info.pause=0;
  1079. if (*option == '+')
  1080. break;
  1081. i++;
  1082. if (i == (ssize_t) argc)
  1083. ThrowAnimateException(OptionError,"MissingArgument",option);
  1084. if (IsGeometry(argv[i]) == MagickFalse)
  1085. ThrowAnimateInvalidArgumentException(option,argv[i]);
  1086. resource_info.pause=(unsigned int) StringToUnsignedLong(argv[i]);
  1087. break;
  1088. }
  1089. if (LocaleCompare("page",option+1) == 0)
  1090. {
  1091. if (*option == '+')
  1092. break;
  1093. i++;
  1094. if (i == (ssize_t) argc)
  1095. ThrowAnimateException(OptionError,"MissingArgument",option);
  1096. break;
  1097. }
  1098. if (LocaleCompare("profile",option+1) == 0)
  1099. {
  1100. i++;
  1101. if (i == (ssize_t) argc)
  1102. ThrowAnimateException(OptionError,"MissingArgument",option);
  1103. break;
  1104. }
  1105. ThrowAnimateException(OptionError,"UnrecognizedOption",option);
  1106. }
  1107. case 'q':
  1108. {
  1109. if (LocaleCompare("quantize",option+1) == 0)
  1110. {
  1111. ssize_t
  1112. colorspace;
  1113. if (*option == '+')
  1114. break;
  1115. i++;
  1116. if (i == (ssize_t) (argc-1))
  1117. ThrowAnimateException(OptionError,"MissingArgument",option);
  1118. colorspace=ParseCommandOption(MagickColorspaceOptions,
  1119. MagickFalse,argv[i]);
  1120. if (colorspace < 0)
  1121. ThrowAnimateException(OptionError,"UnrecognizedColorspace",
  1122. argv[i]);
  1123. break;
  1124. }
  1125. if (LocaleCompare("quiet",option+1) == 0)
  1126. break;
  1127. ThrowAnimateException(OptionError,"UnrecognizedOption",option);
  1128. }
  1129. case 'r':
  1130. {
  1131. if (LocaleCompare("regard-warnings",option+1) == 0)
  1132. break;
  1133. if (LocaleCompare("remote",option+1) == 0)
  1134. {
  1135. i++;
  1136. if (i == (ssize_t) argc)
  1137. ThrowAnimateException(OptionError,"MissingArgument",option);
  1138. if (XRemoteCommand(display,resource_info.window_id,argv[i]) != 0)
  1139. return(MagickFalse);
  1140. i--;
  1141. break;
  1142. }
  1143. if (LocaleCompare("repage",option+1) == 0)
  1144. {
  1145. if (*option == '+')
  1146. break;
  1147. i++;
  1148. if (i == (ssize_t) argc)
  1149. ThrowAnimateException(OptionError,"MissingArgument",option);
  1150. if (IsGeometry(argv[i]) == MagickFalse)
  1151. ThrowAnimateInvalidArgumentException(option,argv[i]);
  1152. break;
  1153. }
  1154. if (LocaleCompare("resample",option+1) == 0)
  1155. {
  1156. if (*option == '+')
  1157. break;
  1158. i++;
  1159. if (i == (ssize_t) (argc-1))
  1160. ThrowAnimateException(OptionError,"MissingArgument",option);
  1161. if (IsGeometry(argv[i]) == MagickFalse)
  1162. ThrowAnimateInvalidArgumentException(option,argv[i]);
  1163. break;
  1164. }
  1165. if (LocaleCompare("resize",option+1) == 0)
  1166. {
  1167. if (*option == '+')
  1168. break;
  1169. i++;
  1170. if (i == (ssize_t) argc)
  1171. ThrowAnimateException(OptionError,"MissingArgument",option);
  1172. if (IsGeometry(argv[i]) == MagickFalse)
  1173. ThrowAnimateInvalidArgumentException(option,argv[i]);
  1174. break;
  1175. }
  1176. if (LocaleNCompare("respect-parentheses",option+1,17) == 0)
  1177. {
  1178. respect_parenthesis=(*option == '-') ? MagickTrue : MagickFalse;
  1179. break;
  1180. }
  1181. if (LocaleCompare("rotate",option+1) == 0)
  1182. {
  1183. i++;
  1184. if (i == (ssize_t) argc)
  1185. ThrowAnimateException(OptionError,"MissingArgument",option);
  1186. if (IsGeometry(argv[i]) == MagickFalse)
  1187. ThrowAnimateInvalidArgumentException(option,argv[i]);
  1188. break;
  1189. }
  1190. ThrowAnimateException(OptionError,"UnrecognizedOption",option);
  1191. }
  1192. case 's':
  1193. {
  1194. if (LocaleCompare("sampling-factor",option+1) == 0)
  1195. {
  1196. if (*option == '+')
  1197. break;
  1198. i++;
  1199. if (i == (ssize_t) argc)
  1200. ThrowAnimateException(OptionError,"MissingArgument",option);
  1201. if (IsGeometry(argv[i]) == MagickFalse)
  1202. ThrowAnimateInvalidArgumentException(option,argv[i]);
  1203. break;
  1204. }
  1205. if (LocaleCompare("seed",option+1) == 0)
  1206. {
  1207. if (*option == '+')
  1208. break;
  1209. i++;
  1210. if (i == (ssize_t) (argc-1))
  1211. ThrowAnimateException(OptionError,"MissingArgument",option);
  1212. if (IsGeometry(argv[i]) == MagickFalse)
  1213. ThrowAnimateInvalidArgumentException(option,argv[i]);
  1214. break;
  1215. }
  1216. if (LocaleCompare("scenes",option+1) == 0) /* deprecated */
  1217. {
  1218. if (*option == '+')
  1219. break;
  1220. i++;
  1221. if (i == (ssize_t) argc)
  1222. ThrowAnimateException(OptionError,"MissingArgument",option);
  1223. if (IsSceneGeometry(argv[i],MagickFalse) == MagickFalse)
  1224. ThrowAnimateInvalidArgumentException(option,argv[i]);
  1225. break;
  1226. }
  1227. if (LocaleCompare("set",option+1) == 0)
  1228. {
  1229. i++;
  1230. if (i == (ssize_t) argc)
  1231. ThrowAnimateException(OptionError,"MissingArgument",option);
  1232. if (*option == '+')
  1233. break;
  1234. i++;
  1235. if (i == (ssize_t) argc)
  1236. ThrowAnimateException(OptionError,"MissingArgument",option);
  1237. break;
  1238. }
  1239. if (LocaleCompare("shared-memory",option+1) == 0)
  1240. {
  1241. resource_info.use_shared_memory=(*option == '-') ? MagickTrue :
  1242. MagickFalse;
  1243. break;
  1244. }
  1245. if (LocaleCompare("size",option+1) == 0)
  1246. {
  1247. if (*option == '+')
  1248. break;
  1249. i++;
  1250. if (i == (ssize_t) argc)
  1251. ThrowAnimateException(OptionError,"MissingArgument",option);
  1252. if (IsGeometry(argv[i]) == MagickFalse)
  1253. ThrowAnimateInvalidArgumentException(option,argv[i]);
  1254. break;
  1255. }
  1256. if (LocaleCompare("strip",option+1) == 0)
  1257. break;
  1258. if (LocaleCompare("support",option+1) == 0)
  1259. {
  1260. i++; /* deprecated */
  1261. break;
  1262. }
  1263. ThrowAnimateException(OptionError,"UnrecognizedOption",option);
  1264. }
  1265. case 't':
  1266. {
  1267. if (LocaleCompare("text-font",option+1) == 0)
  1268. {
  1269. resource_info.text_font=(char *) NULL;
  1270. if (*option == '+')
  1271. break;
  1272. i++;
  1273. if (i == (ssize_t) argc)
  1274. ThrowAnimateException(OptionError,"MissingArgument",option);
  1275. resource_info.text_font=XGetResourceClass(resource_database,
  1276. GetClientName(),"font",argv[i]);
  1277. break;
  1278. }
  1279. if (LocaleCompare("thumbnail",option+1) == 0)
  1280. {
  1281. if (*option == '+')
  1282. break;
  1283. i++;
  1284. if (i == (ssize_t) argc)
  1285. ThrowAnimateException(OptionError,"MissingArgument",option);
  1286. if (IsGeometry(argv[i]) == MagickFalse)
  1287. ThrowAnimateInvalidArgumentException(option,argv[i]);
  1288. break;
  1289. }
  1290. if (LocaleCompare("title",option+1) == 0)
  1291. {
  1292. resource_info.title=(char *) NULL;
  1293. if (*option == '+')
  1294. break;
  1295. i++;
  1296. if (i == (ssize_t) argc)
  1297. ThrowAnimateException(OptionError,"MissingArgument",option);
  1298. resource_info.title=argv[i];
  1299. break;
  1300. }
  1301. if (LocaleCompare("transparent-color",option+1) == 0)
  1302. {
  1303. if (*option == '+')
  1304. break;
  1305. i++;
  1306. if (i == (ssize_t) (argc-1))
  1307. ThrowAnimateException(OptionError,"MissingArgument",option);
  1308. break;
  1309. }
  1310. if (LocaleCompare("treedepth",option+1) == 0)
  1311. {
  1312. quantize_info->tree_depth=0;
  1313. if (*option == '+')
  1314. break;
  1315. i++;
  1316. if (i == (ssize_t) argc)
  1317. ThrowAnimateException(OptionError,"MissingArgument",option);
  1318. if (IsGeometry(argv[i]) == MagickFalse)
  1319. ThrowAnimateInvalidArgumentException(option,argv[i]);
  1320. quantize_info->tree_depth=StringToUnsignedLong(argv[i]);
  1321. break;
  1322. }
  1323. if (LocaleCompare("trim",option+1) == 0)
  1324. break;
  1325. ThrowAnimateException(OptionError,"UnrecognizedOption",option);
  1326. }
  1327. case 'v':
  1328. {
  1329. if (LocaleCompare("verbose",option+1) == 0)
  1330. break;
  1331. if ((LocaleCompare("version",option+1) == 0) ||
  1332. (LocaleCompare("-version",option+1) == 0))
  1333. {
  1334. (void) FormatLocaleFile(stdout,"Version: %s\n",
  1335. GetMagickVersion((size_t *) NULL));
  1336. (void) FormatLocaleFile(stdout,"Copyright: %s\n",
  1337. GetMagickCopyright());
  1338. (void) FormatLocaleFile(stdout,"Features: %s\n\n",
  1339. GetMagickFeatures());
  1340. break;
  1341. }
  1342. if (LocaleCompare("virtual-pixel",option+1) == 0)
  1343. {
  1344. ssize_t
  1345. method;
  1346. if (*option == '+')
  1347. break;
  1348. i++;
  1349. if (i == (ssize_t) argc)
  1350. ThrowAnimateException(OptionError,"MissingArgument",option);
  1351. method=ParseCommandOption(MagickVirtualPixelOptions,MagickFalse,
  1352. argv[i]);
  1353. if (method < 0)
  1354. ThrowAnimateException(OptionError,
  1355. "UnrecognizedVirtualPixelMethod",argv[i]);
  1356. break;
  1357. }
  1358. if (LocaleCompare("visual",option+1) == 0)

Large files files are truncated, but you can click here to view the full file