PageRenderTime 44ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

/scripts/ImageMagick-6.6.2-6/wand/stream.c

https://bitbucket.org/JasonGross/alphabets
C | 759 lines | 642 code | 29 blank | 88 comment | 259 complexity | 8073d1e9453729590958f553eb49182a MD5 | raw file
Possible License(s): BSD-3-Clause-No-Nuclear-License-2014, Apache-2.0, MPL-2.0-no-copyleft-exception
  1. /*
  2. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  3. % %
  4. % %
  5. % %
  6. % SSSSS TTTTT RRRR EEEEE AAA M M %
  7. % SS T R R E A A MM MM %
  8. % SSS T RRRR EEE AAAAA M M M %
  9. % SS T R R E A A M M %
  10. % SSSSS T R R EEEEE A A M M %
  11. % %
  12. % %
  13. % Stream Image to a Raw Image Format %
  14. % %
  15. % Software Design %
  16. % John Cristy %
  17. % July 1992 %
  18. % %
  19. % %
  20. % Copyright 1999-2010 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. % Stream is a lightweight tool to stream one or more pixel components of the
  37. % image or portion of the image to your choice of storage formats. It writes
  38. % the pixel components as they are read from the input image a row at a time
  39. % making stream desirable when working with large images or when you require
  40. % raw pixel components.
  41. %
  42. */
  43. /*
  44. Include declarations.
  45. */
  46. #include "wand/studio.h"
  47. #include "wand/MagickWand.h"
  48. #include "wand/mogrify-private.h"
  49. #include "magick/stream-private.h"
  50. /*
  51. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  52. % %
  53. % %
  54. % %
  55. % S t r e a m I m a g e C o m m a n d %
  56. % %
  57. % %
  58. % %
  59. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  60. %
  61. % StreamImageCommand() is a lightweight method designed to extract pixels
  62. % from large image files to a raw format using a minimum of system resources.
  63. % The entire image or any regular portion of the image can be extracted.
  64. %
  65. % The format of the StreamImageCommand method is:
  66. %
  67. % MagickBooleanType StreamImageCommand(ImageInfo *image_info,int argc,
  68. % char **argv,char **metadata,ExceptionInfo *exception)
  69. %
  70. % A description of each parameter follows:
  71. %
  72. % o image_info: the image info.
  73. %
  74. % o argc: the number of elements in the argument vector.
  75. %
  76. % o argv: A text array containing the command line arguments.
  77. %
  78. % o metadata: any metadata is returned here.
  79. %
  80. % o exception: return any errors or warnings in this structure.
  81. %
  82. %
  83. */
  84. static MagickBooleanType StreamUsage(void)
  85. {
  86. const char
  87. **p;
  88. static const char
  89. *miscellaneous[]=
  90. {
  91. "-debug events display copious debugging information",
  92. "-help print program options",
  93. "-list type print a list of supported option arguments",
  94. "-log format format of debugging information",
  95. "-version print version information",
  96. (char *) NULL
  97. },
  98. *settings[]=
  99. {
  100. "-authenticate password",
  101. " decipher image with this password",
  102. "-channel type apply option to select image channels",
  103. "-colorspace type alternate image colorspace",
  104. "-compress type type of pixel compression when writing the image",
  105. "-define format:option",
  106. " define one or more image format options",
  107. "-density geometry horizontal and vertical density of the image",
  108. "-depth value image depth",
  109. "-extract geometry extract area from image",
  110. "-identify identify the format and characteristics of the image",
  111. "-interlace type type of image interlacing scheme",
  112. "-interpolate method pixel color interpolation method",
  113. "-limit type value pixel cache resource limit",
  114. "-map components one or more pixel components",
  115. "-monitor monitor progress",
  116. "-quantize colorspace reduce colors in this colorspace",
  117. "-quiet suppress all warning messages",
  118. "-regard-warnings pay attention to warning messages",
  119. "-respect-parentheses settings remain in effect until parenthesis boundary",
  120. "-sampling-factor geometry",
  121. " horizontal and vertical sampling factor",
  122. "-seed value seed a new sequence of pseudo-random numbers",
  123. "-set attribute value set an image attribute",
  124. "-size geometry width and height of image",
  125. "-storage-type type pixel storage type",
  126. "-transparent-color color",
  127. " transparent color",
  128. "-verbose print detailed information about the image",
  129. "-virtual-pixel method",
  130. " virtual pixel access method",
  131. (char *) NULL
  132. };
  133. (void) printf("Version: %s\n",GetMagickVersion((size_t *) NULL));
  134. (void) printf("Copyright: %s\n",GetMagickCopyright());
  135. (void) printf("Features: %s\n\n",GetMagickFeatures());
  136. (void) printf("Usage: %s [options ...] input-image raw-image\n",
  137. GetClientName());
  138. (void) printf("\nImage Settings:\n");
  139. for (p=settings; *p != (char *) NULL; p++)
  140. (void) printf(" %s\n",*p);
  141. (void) printf("\nMiscellaneous Options:\n");
  142. for (p=miscellaneous; *p != (char *) NULL; p++)
  143. (void) printf(" %s\n",*p);
  144. (void) printf(
  145. "\nBy default, the image format of `file' is determined by its magic\n");
  146. (void) printf(
  147. "number. To specify a particular image format, precede the filename\n");
  148. (void) printf(
  149. "with an image format name and a colon (i.e. ps:image) or specify the\n");
  150. (void) printf(
  151. "image type as the filename suffix (i.e. image.ps). Specify 'file' as\n");
  152. (void) printf("'-' for standard input or output.\n");
  153. return(MagickFalse);
  154. }
  155. WandExport MagickBooleanType StreamImageCommand(ImageInfo *image_info,
  156. int argc,char **argv,char **metadata,ExceptionInfo *exception)
  157. {
  158. #define DestroyStream() \
  159. { \
  160. DestroyImageStack(); \
  161. stream_info=DestroyStreamInfo(stream_info); \
  162. for (i=0; i < (ssize_t) argc; i++) \
  163. argv[i]=DestroyString(argv[i]); \
  164. argv=(char **) RelinquishMagickMemory(argv); \
  165. }
  166. #define ThrowStreamException(asperity,tag,option) \
  167. { \
  168. (void) ThrowMagickException(exception,GetMagickModule(),asperity,tag,"`%s'", \
  169. option); \
  170. DestroyStream(); \
  171. return(MagickFalse); \
  172. }
  173. #define ThrowStreamInvalidArgumentException(option,argument) \
  174. { \
  175. (void) ThrowMagickException(exception,GetMagickModule(),OptionError, \
  176. "InvalidArgument","`%s': %s",option,argument); \
  177. DestroyStream(); \
  178. return(MagickFalse); \
  179. }
  180. char
  181. *filename,
  182. *option;
  183. const char
  184. *format;
  185. Image
  186. *image;
  187. ImageStack
  188. image_stack[MaxImageStackDepth+1];
  189. ssize_t
  190. j,
  191. k;
  192. MagickBooleanType
  193. fire,
  194. pend;
  195. MagickStatusType
  196. status;
  197. register ssize_t
  198. i;
  199. StreamInfo
  200. *stream_info;
  201. /*
  202. Set defaults.
  203. */
  204. assert(image_info != (ImageInfo *) NULL);
  205. assert(image_info->signature == MagickSignature);
  206. if (image_info->debug != MagickFalse)
  207. (void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");
  208. assert(exception != (ExceptionInfo *) NULL);
  209. (void) metadata;
  210. if (argc == 2)
  211. {
  212. option=argv[1];
  213. if ((LocaleCompare("version",option+1) == 0) ||
  214. (LocaleCompare("-version",option+1) == 0))
  215. {
  216. (void) fprintf(stdout,"Version: %s\n",
  217. GetMagickVersion((size_t *) NULL));
  218. (void) fprintf(stdout,"Copyright: %s\n",GetMagickCopyright());
  219. (void) fprintf(stdout,"Features: %s\n\n",GetMagickFeatures());
  220. return(MagickFalse);
  221. }
  222. }
  223. if (argc < 3)
  224. return(StreamUsage());
  225. format="%w,%h,%m";
  226. j=1;
  227. k=0;
  228. NewImageStack();
  229. option=(char *) NULL;
  230. pend=MagickFalse;
  231. stream_info=AcquireStreamInfo(image_info);
  232. status=MagickTrue;
  233. /*
  234. Stream an image.
  235. */
  236. ReadCommandlLine(argc,&argv);
  237. status=ExpandFilenames(&argc,&argv);
  238. if (status == MagickFalse)
  239. ThrowStreamException(ResourceLimitError,"MemoryAllocationFailed",
  240. GetExceptionMessage(errno));
  241. status=OpenStream(image_info,stream_info,argv[argc-1],exception);
  242. if (status == MagickFalse)
  243. {
  244. DestroyStream();
  245. return(MagickFalse);
  246. }
  247. for (i=1; i < (ssize_t) (argc-1); i++)
  248. {
  249. option=argv[i];
  250. if (LocaleCompare(option,"(") == 0)
  251. {
  252. FireImageStack(MagickFalse,MagickTrue,pend);
  253. if (k == MaxImageStackDepth)
  254. ThrowStreamException(OptionError,"ParenthesisNestedTooDeeply",option);
  255. PushImageStack();
  256. continue;
  257. }
  258. if (LocaleCompare(option,")") == 0)
  259. {
  260. FireImageStack(MagickFalse,MagickTrue,MagickTrue);
  261. if (k == 0)
  262. ThrowStreamException(OptionError,"UnableToParseExpression",option);
  263. PopImageStack();
  264. continue;
  265. }
  266. if (IsMagickOption(option) == MagickFalse)
  267. {
  268. Image
  269. *images;
  270. /*
  271. Stream input image.
  272. */
  273. FireImageStack(MagickFalse,MagickFalse,pend);
  274. filename=argv[i];
  275. if ((LocaleCompare(filename,"--") == 0) && (i < (ssize_t) (argc-1)))
  276. filename=argv[++i];
  277. (void) CopyMagickString(image_info->filename,filename,MaxTextExtent);
  278. images=StreamImage(image_info,stream_info,exception);
  279. status&=(images != (Image *) NULL) &&
  280. (exception->severity < ErrorException);
  281. if (images == (Image *) NULL)
  282. continue;
  283. AppendImageStack(images);
  284. continue;
  285. }
  286. pend=image != (Image *) NULL ? MagickTrue : MagickFalse;
  287. switch (*(option+1))
  288. {
  289. case 'a':
  290. {
  291. if (LocaleCompare("authenticate",option+1) == 0)
  292. {
  293. if (*option == '+')
  294. break;
  295. i++;
  296. if (i == (ssize_t) (argc-1))
  297. ThrowStreamException(OptionError,"MissingArgument",option);
  298. break;
  299. }
  300. ThrowStreamException(OptionError,"UnrecognizedOption",option)
  301. }
  302. case 'c':
  303. {
  304. if (LocaleCompare("cache",option+1) == 0)
  305. {
  306. if (*option == '+')
  307. break;
  308. i++;
  309. if (i == (ssize_t) argc)
  310. ThrowStreamException(OptionError,"MissingArgument",option);
  311. if (IsGeometry(argv[i]) == MagickFalse)
  312. ThrowStreamInvalidArgumentException(option,argv[i]);
  313. break;
  314. }
  315. if (LocaleCompare("channel",option+1) == 0)
  316. {
  317. ssize_t
  318. channel;
  319. if (*option == '+')
  320. break;
  321. i++;
  322. if (i == (ssize_t) (argc-1))
  323. ThrowStreamException(OptionError,"MissingArgument",option);
  324. channel=ParseChannelOption(argv[i]);
  325. if (channel < 0)
  326. ThrowStreamException(OptionError,"UnrecognizedChannelType",
  327. argv[i]);
  328. break;
  329. }
  330. if (LocaleCompare("colorspace",option+1) == 0)
  331. {
  332. ssize_t
  333. colorspace;
  334. if (*option == '+')
  335. break;
  336. i++;
  337. if (i == (ssize_t) (argc-1))
  338. ThrowStreamException(OptionError,"MissingArgument",option);
  339. colorspace=ParseMagickOption(MagickColorspaceOptions,MagickFalse,
  340. argv[i]);
  341. if (colorspace < 0)
  342. ThrowStreamException(OptionError,"UnrecognizedColorspace",
  343. argv[i]);
  344. break;
  345. }
  346. if (LocaleCompare("compress",option+1) == 0)
  347. {
  348. ssize_t
  349. compress;
  350. if (*option == '+')
  351. break;
  352. i++;
  353. if (i == (ssize_t) (argc-1))
  354. ThrowStreamException(OptionError,"MissingArgument",option);
  355. compress=ParseMagickOption(MagickCompressOptions,MagickFalse,
  356. argv[i]);
  357. if (compress < 0)
  358. ThrowStreamException(OptionError,"UnrecognizedImageCompression",
  359. argv[i]);
  360. break;
  361. }
  362. if (LocaleCompare("concurrent",option+1) == 0)
  363. break;
  364. ThrowStreamException(OptionError,"UnrecognizedOption",option)
  365. }
  366. case 'd':
  367. {
  368. if (LocaleCompare("debug",option+1) == 0)
  369. {
  370. ssize_t
  371. event;
  372. if (*option == '+')
  373. break;
  374. i++;
  375. if (i == (ssize_t) argc)
  376. ThrowStreamException(OptionError,"MissingArgument",option);
  377. event=ParseMagickOption(MagickLogEventOptions,MagickFalse,argv[i]);
  378. if (event < 0)
  379. ThrowStreamException(OptionError,"UnrecognizedEventType",argv[i]);
  380. (void) SetLogEventMask(argv[i]);
  381. break;
  382. }
  383. if (LocaleCompare("define",option+1) == 0)
  384. {
  385. i++;
  386. if (i == (ssize_t) argc)
  387. ThrowStreamException(OptionError,"MissingArgument",option);
  388. if (*option == '+')
  389. {
  390. const char
  391. *define;
  392. define=GetImageOption(image_info,argv[i]);
  393. if (define == (const char *) NULL)
  394. ThrowStreamException(OptionError,"NoSuchOption",argv[i]);
  395. break;
  396. }
  397. break;
  398. }
  399. if (LocaleCompare("density",option+1) == 0)
  400. {
  401. if (*option == '+')
  402. break;
  403. i++;
  404. if (i == (ssize_t) argc)
  405. ThrowStreamException(OptionError,"MissingArgument",option);
  406. if (IsGeometry(argv[i]) == MagickFalse)
  407. ThrowStreamInvalidArgumentException(option,argv[i]);
  408. break;
  409. }
  410. if (LocaleCompare("depth",option+1) == 0)
  411. {
  412. if (*option == '+')
  413. break;
  414. i++;
  415. if (i == (ssize_t) argc)
  416. ThrowStreamException(OptionError,"MissingArgument",option);
  417. if (IsGeometry(argv[i]) == MagickFalse)
  418. ThrowStreamInvalidArgumentException(option,argv[i]);
  419. break;
  420. }
  421. if (LocaleCompare("duration",option+1) == 0)
  422. {
  423. if (*option == '+')
  424. break;
  425. i++;
  426. if (i == (ssize_t) (argc-1))
  427. ThrowStreamException(OptionError,"MissingArgument",option);
  428. if (IsGeometry(argv[i]) == MagickFalse)
  429. ThrowStreamInvalidArgumentException(option,argv[i]);
  430. break;
  431. }
  432. ThrowStreamException(OptionError,"UnrecognizedOption",option)
  433. }
  434. case 'e':
  435. {
  436. if (LocaleCompare("extract",option+1) == 0)
  437. {
  438. if (*option == '+')
  439. break;
  440. i++;
  441. if (i == (ssize_t) (argc-1))
  442. ThrowStreamException(OptionError,"MissingArgument",option);
  443. if (IsGeometry(argv[i]) == MagickFalse)
  444. ThrowStreamInvalidArgumentException(option,argv[i]);
  445. break;
  446. }
  447. ThrowStreamException(OptionError,"UnrecognizedOption",option)
  448. }
  449. case 'h':
  450. {
  451. if ((LocaleCompare("help",option+1) == 0) ||
  452. (LocaleCompare("-help",option+1) == 0))
  453. return(StreamUsage());
  454. ThrowStreamException(OptionError,"UnrecognizedOption",option)
  455. }
  456. case 'i':
  457. {
  458. if (LocaleCompare("identify",option+1) == 0)
  459. break;
  460. if (LocaleCompare("interlace",option+1) == 0)
  461. {
  462. ssize_t
  463. interlace;
  464. if (*option == '+')
  465. break;
  466. i++;
  467. if (i == (ssize_t) argc)
  468. ThrowStreamException(OptionError,"MissingArgument",option);
  469. interlace=ParseMagickOption(MagickInterlaceOptions,MagickFalse,
  470. argv[i]);
  471. if (interlace < 0)
  472. ThrowStreamException(OptionError,"UnrecognizedInterlaceType",
  473. argv[i]);
  474. break;
  475. }
  476. if (LocaleCompare("interpolate",option+1) == 0)
  477. {
  478. ssize_t
  479. interpolate;
  480. if (*option == '+')
  481. break;
  482. i++;
  483. if (i == (ssize_t) argc)
  484. ThrowStreamException(OptionError,"MissingArgument",option);
  485. interpolate=ParseMagickOption(MagickInterpolateOptions,MagickFalse,
  486. argv[i]);
  487. if (interpolate < 0)
  488. ThrowStreamException(OptionError,"UnrecognizedInterpolateMethod",
  489. argv[i]);
  490. break;
  491. }
  492. ThrowStreamException(OptionError,"UnrecognizedOption",option)
  493. }
  494. case 'l':
  495. {
  496. if (LocaleCompare("limit",option+1) == 0)
  497. {
  498. char
  499. *p;
  500. double
  501. value;
  502. ssize_t
  503. resource;
  504. if (*option == '+')
  505. break;
  506. i++;
  507. if (i == (ssize_t) argc)
  508. ThrowStreamException(OptionError,"MissingArgument",option);
  509. resource=ParseMagickOption(MagickResourceOptions,MagickFalse,
  510. argv[i]);
  511. if (resource < 0)
  512. ThrowStreamException(OptionError,"UnrecognizedResourceType",
  513. argv[i]);
  514. i++;
  515. if (i == (ssize_t) argc)
  516. ThrowStreamException(OptionError,"MissingArgument",option);
  517. value=strtod(argv[i],&p);
  518. if ((p == argv[i]) && (LocaleCompare("unlimited",argv[i]) != 0))
  519. ThrowStreamInvalidArgumentException(option,argv[i]);
  520. break;
  521. }
  522. if (LocaleCompare("list",option+1) == 0)
  523. {
  524. ssize_t
  525. list;
  526. if (*option == '+')
  527. break;
  528. i++;
  529. if (i == (ssize_t) argc)
  530. ThrowStreamException(OptionError,"MissingArgument",option);
  531. list=ParseMagickOption(MagickListOptions,MagickFalse,argv[i]);
  532. if (list < 0)
  533. ThrowStreamException(OptionError,"UnrecognizedListType",argv[i]);
  534. status=MogrifyImageInfo(image_info,(int) (i-j+1),(const char **)
  535. argv+j,exception);
  536. DestroyStream();
  537. return(status != 0 ? MagickFalse : MagickTrue);
  538. }
  539. if (LocaleCompare("log",option+1) == 0)
  540. {
  541. if (*option == '+')
  542. break;
  543. i++;
  544. if ((i == (ssize_t) argc) || (strchr(argv[i],'%') == (char *) NULL))
  545. ThrowStreamException(OptionError,"MissingArgument",option);
  546. break;
  547. }
  548. ThrowStreamException(OptionError,"UnrecognizedOption",option)
  549. }
  550. case 'm':
  551. {
  552. if (LocaleCompare("map",option+1) == 0)
  553. {
  554. (void) CopyMagickString(argv[i]+1,"san",MaxTextExtent);
  555. if (*option == '+')
  556. break;
  557. i++;
  558. SetStreamInfoMap(stream_info,argv[i]);
  559. break;
  560. }
  561. if (LocaleCompare("monitor",option+1) == 0)
  562. break;
  563. ThrowStreamException(OptionError,"UnrecognizedOption",option)
  564. }
  565. case 'q':
  566. {
  567. if (LocaleCompare("quantize",option+1) == 0)
  568. {
  569. ssize_t
  570. colorspace;
  571. if (*option == '+')
  572. break;
  573. i++;
  574. if (i == (ssize_t) (argc-1))
  575. ThrowStreamException(OptionError,"MissingArgument",option);
  576. colorspace=ParseMagickOption(MagickColorspaceOptions,
  577. MagickFalse,argv[i]);
  578. if (colorspace < 0)
  579. ThrowStreamException(OptionError,"UnrecognizedColorspace",
  580. argv[i]);
  581. break;
  582. }
  583. if (LocaleCompare("quiet",option+1) == 0)
  584. break;
  585. ThrowStreamException(OptionError,"UnrecognizedOption",option)
  586. }
  587. case 'r':
  588. {
  589. if (LocaleCompare("regard-warnings",option+1) == 0)
  590. break;
  591. if (LocaleNCompare("respect-parentheses",option+1,17) == 0)
  592. {
  593. respect_parenthesis=(*option == '-') ? MagickTrue : MagickFalse;
  594. break;
  595. }
  596. ThrowStreamException(OptionError,"UnrecognizedOption",option)
  597. }
  598. case 's':
  599. {
  600. if (LocaleCompare("sampling-factor",option+1) == 0)
  601. {
  602. if (*option == '+')
  603. break;
  604. i++;
  605. if (i == (ssize_t) argc)
  606. ThrowStreamException(OptionError,"MissingArgument",option);
  607. if (IsGeometry(argv[i]) == MagickFalse)
  608. ThrowStreamInvalidArgumentException(option,argv[i]);
  609. break;
  610. }
  611. if (LocaleCompare("seed",option+1) == 0)
  612. {
  613. if (*option == '+')
  614. break;
  615. i++;
  616. if (i == (ssize_t) (argc-1))
  617. ThrowStreamException(OptionError,"MissingArgument",option);
  618. if (IsGeometry(argv[i]) == MagickFalse)
  619. ThrowStreamInvalidArgumentException(option,argv[i]);
  620. break;
  621. }
  622. if (LocaleCompare("set",option+1) == 0)
  623. {
  624. i++;
  625. if (i == (ssize_t) argc)
  626. ThrowStreamException(OptionError,"MissingArgument",option);
  627. if (*option == '+')
  628. break;
  629. i++;
  630. if (i == (ssize_t) argc)
  631. ThrowStreamException(OptionError,"MissingArgument",option);
  632. break;
  633. }
  634. if (LocaleCompare("size",option+1) == 0)
  635. {
  636. if (*option == '+')
  637. break;
  638. i++;
  639. if (i == (ssize_t) argc)
  640. ThrowStreamException(OptionError,"MissingArgument",option);
  641. if (IsGeometry(argv[i]) == MagickFalse)
  642. ThrowStreamInvalidArgumentException(option,argv[i]);
  643. break;
  644. }
  645. if (LocaleCompare("storage-type",option+1) == 0)
  646. {
  647. ssize_t
  648. type;
  649. if (*option == '+')
  650. break;
  651. i++;
  652. if (i == (ssize_t) (argc-1))
  653. ThrowStreamException(OptionError,"MissingArgument",option);
  654. type=ParseMagickOption(MagickStorageOptions,MagickFalse,argv[i]);
  655. if (type < 0)
  656. ThrowStreamException(OptionError,"UnrecognizedStorageType",
  657. argv[i]);
  658. SetStreamInfoStorageType(stream_info,(StorageType) type);
  659. break;
  660. }
  661. ThrowStreamException(OptionError,"UnrecognizedOption",option)
  662. }
  663. case 't':
  664. {
  665. if (LocaleCompare("transparent-color",option+1) == 0)
  666. {
  667. if (*option == '+')
  668. break;
  669. i++;
  670. if (i == (ssize_t) (argc-1))
  671. ThrowStreamException(OptionError,"MissingArgument",option);
  672. break;
  673. }
  674. ThrowStreamException(OptionError,"UnrecognizedOption",option)
  675. }
  676. case 'v':
  677. {
  678. if (LocaleCompare("verbose",option+1) == 0)
  679. break;
  680. if ((LocaleCompare("version",option+1) == 0) ||
  681. (LocaleCompare("-version",option+1) == 0))
  682. {
  683. (void) fprintf(stdout,"Version: %s\n",
  684. GetMagickVersion((size_t *) NULL));
  685. (void) fprintf(stdout,"Copyright: %s\n",GetMagickCopyright());
  686. (void) fprintf(stdout,"Features: %s\n\n",GetMagickFeatures());
  687. break;
  688. }
  689. if (LocaleCompare("virtual-pixel",option+1) == 0)
  690. {
  691. ssize_t
  692. method;
  693. if (*option == '+')
  694. break;
  695. i++;
  696. if (i == (ssize_t) (argc-1))
  697. ThrowStreamException(OptionError,"MissingArgument",option);
  698. method=ParseMagickOption(MagickVirtualPixelOptions,MagickFalse,
  699. argv[i]);
  700. if (method < 0)
  701. ThrowStreamException(OptionError,
  702. "UnrecognizedVirtualPixelMethod",argv[i]);
  703. break;
  704. }
  705. ThrowStreamException(OptionError,"UnrecognizedOption",option)
  706. }
  707. case '?':
  708. break;
  709. default:
  710. ThrowStreamException(OptionError,"UnrecognizedOption",option)
  711. }
  712. fire=ParseMagickOption(MagickImageListOptions,MagickFalse,option+1) < 0 ?
  713. MagickFalse : MagickTrue;
  714. if (fire != MagickFalse)
  715. FireImageStack(MagickFalse,MagickTrue,MagickTrue);
  716. }
  717. if (k != 0)
  718. ThrowStreamException(OptionError,"UnbalancedParenthesis",argv[i]);
  719. if (i-- != (ssize_t) (argc-1))
  720. ThrowStreamException(OptionError,"MissingAnImageFilename",argv[i]);
  721. if (image == (Image *) NULL)
  722. ThrowStreamException(OptionError,"MissingAnImageFilename",argv[i]);
  723. FinalizeImageSettings(image_info,image,MagickTrue);
  724. if (image == (Image *) NULL)
  725. ThrowStreamException(OptionError,"MissingAnImageFilename",argv[i]);
  726. DestroyStream();
  727. return(status != 0 ? MagickTrue : MagickFalse);
  728. }