|
MagickWand
6.7.5
|
00001 /* 00002 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 00003 % % 00004 % % 00005 % % 00006 % SSSSS TTTTT RRRR EEEEE AAA M M % 00007 % SS T R R E A A MM MM % 00008 % SSS T RRRR EEE AAAAA M M M % 00009 % SS T R R E A A M M % 00010 % SSSSS T R R EEEEE A A M M % 00011 % % 00012 % % 00013 % Stream Image to a Raw Image Format % 00014 % % 00015 % Software Design % 00016 % John Cristy % 00017 % July 1992 % 00018 % % 00019 % % 00020 % Copyright 1999-2012 ImageMagick Studio LLC, a non-profit organization % 00021 % dedicated to making software imaging solutions freely available. % 00022 % % 00023 % You may not use this file except in compliance with the License. You may % 00024 % obtain a copy of the License at % 00025 % % 00026 % http://www.imagemagick.org/script/license.php % 00027 % % 00028 % Unless required by applicable law or agreed to in writing, software % 00029 % distributed under the License is distributed on an "AS IS" BASIS, % 00030 % WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. % 00031 % See the License for the specific language governing permissions and % 00032 % limitations under the License. % 00033 % % 00034 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 00035 % 00036 % Stream is a lightweight tool to stream one or more pixel components of the 00037 % image or portion of the image to your choice of storage formats. It writes 00038 % the pixel components as they are read from the input image a row at a time 00039 % making stream desirable when working with large images or when you require 00040 % raw pixel components. 00041 % 00042 */ 00043 00044 /* 00045 Include declarations. 00046 */ 00047 #include "MagickWand/studio.h" 00048 #include "MagickWand/MagickWand.h" 00049 #include "MagickWand/mogrify-private.h" 00050 #include "MagickCore/stream-private.h" 00051 #include "MagickCore/string-private.h" 00052 00053 /* 00054 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 00055 % % 00056 % % 00057 % % 00058 % S t r e a m I m a g e C o m m a n d % 00059 % % 00060 % % 00061 % % 00062 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 00063 % 00064 % StreamImageCommand() is a lightweight method designed to extract pixels 00065 % from large image files to a raw format using a minimum of system resources. 00066 % The entire image or any regular portion of the image can be extracted. 00067 % 00068 % The format of the StreamImageCommand method is: 00069 % 00070 % MagickBooleanType StreamImageCommand(ImageInfo *image_info,int argc, 00071 % char **argv,char **metadata,ExceptionInfo *exception) 00072 % 00073 % A description of each parameter follows: 00074 % 00075 % o image_info: the image info. 00076 % 00077 % o argc: the number of elements in the argument vector. 00078 % 00079 % o argv: A text array containing the command line arguments. 00080 % 00081 % o metadata: any metadata is returned here. 00082 % 00083 % o exception: return any errors or warnings in this structure. 00084 % 00085 */ 00086 00087 static MagickBooleanType StreamUsage(void) 00088 { 00089 const char 00090 **p; 00091 00092 static const char 00093 *miscellaneous[]= 00094 { 00095 "-debug events display copious debugging information", 00096 "-help print program options", 00097 "-list type print a list of supported option arguments", 00098 "-log format format of debugging information", 00099 "-version print version information", 00100 (char *) NULL 00101 }, 00102 *settings[]= 00103 { 00104 "-authenticate password", 00105 " decipher image with this password", 00106 "-channel type apply option to select image channels", 00107 "-colorspace type alternate image colorspace", 00108 "-compress type type of pixel compression when writing the image", 00109 "-define format:option", 00110 " define one or more image format options", 00111 "-density geometry horizontal and vertical density of the image", 00112 "-depth value image depth", 00113 "-extract geometry extract area from image", 00114 "-identify identify the format and characteristics of the image", 00115 "-interlace type type of image interlacing scheme", 00116 "-interpolate method pixel color interpolation method", 00117 "-limit type value pixel cache resource limit", 00118 "-map components one or more pixel components", 00119 "-monitor monitor progress", 00120 "-quantize colorspace reduce colors in this colorspace", 00121 "-quiet suppress all warning messages", 00122 "-regard-warnings pay attention to warning messages", 00123 "-respect-parentheses settings remain in effect until parenthesis boundary", 00124 "-sampling-factor geometry", 00125 " horizontal and vertical sampling factor", 00126 "-seed value seed a new sequence of pseudo-random numbers", 00127 "-set attribute value set an image attribute", 00128 "-size geometry width and height of image", 00129 "-storage-type type pixel storage type", 00130 "-synchronize synchronize image to storage device", 00131 "-taint declare the image as modified", 00132 "-transparent-color color", 00133 " transparent color", 00134 "-verbose print detailed information about the image", 00135 "-virtual-pixel method", 00136 " virtual pixel access method", 00137 (char *) NULL 00138 }; 00139 00140 (void) printf("Version: %s\n",GetMagickVersion((size_t *) NULL)); 00141 (void) printf("Copyright: %s\n",GetMagickCopyright()); 00142 (void) printf("Features: %s\n\n",GetMagickFeatures()); 00143 (void) printf("Usage: %s [options ...] input-image raw-image\n", 00144 GetClientName()); 00145 (void) printf("\nImage Settings:\n"); 00146 for (p=settings; *p != (char *) NULL; p++) 00147 (void) printf(" %s\n",*p); 00148 (void) printf("\nMiscellaneous Options:\n"); 00149 for (p=miscellaneous; *p != (char *) NULL; p++) 00150 (void) printf(" %s\n",*p); 00151 (void) printf( 00152 "\nBy default, the image format of `file' is determined by its magic\n"); 00153 (void) printf( 00154 "number. To specify a particular image format, precede the filename\n"); 00155 (void) printf( 00156 "with an image format name and a colon (i.e. ps:image) or specify the\n"); 00157 (void) printf( 00158 "image type as the filename suffix (i.e. image.ps). Specify 'file' as\n"); 00159 (void) printf("'-' for standard input or output.\n"); 00160 return(MagickFalse); 00161 } 00162 00163 WandExport MagickBooleanType StreamImageCommand(ImageInfo *image_info, 00164 int argc,char **argv,char **metadata,ExceptionInfo *exception) 00165 { 00166 #define DestroyStream() \ 00167 { \ 00168 DestroyImageStack(); \ 00169 stream_info=DestroyStreamInfo(stream_info); \ 00170 for (i=0; i < (ssize_t) argc; i++) \ 00171 argv[i]=DestroyString(argv[i]); \ 00172 argv=(char **) RelinquishMagickMemory(argv); \ 00173 } 00174 #define ThrowStreamException(asperity,tag,option) \ 00175 { \ 00176 (void) ThrowMagickException(exception,GetMagickModule(),asperity,tag,"`%s'", \ 00177 option); \ 00178 DestroyStream(); \ 00179 return(MagickFalse); \ 00180 } 00181 #define ThrowStreamInvalidArgumentException(option,argument) \ 00182 { \ 00183 (void) ThrowMagickException(exception,GetMagickModule(),OptionError, \ 00184 "InvalidArgument","`%s': %s",option,argument); \ 00185 DestroyStream(); \ 00186 return(MagickFalse); \ 00187 } 00188 00189 char 00190 *filename, 00191 *option; 00192 00193 const char 00194 *format; 00195 00196 Image 00197 *image; 00198 00199 ImageStack 00200 image_stack[MaxImageStackDepth+1]; 00201 00202 MagickBooleanType 00203 fire, 00204 pend, 00205 respect_parenthesis; 00206 00207 MagickStatusType 00208 status; 00209 00210 register ssize_t 00211 i; 00212 00213 ssize_t 00214 j, 00215 k; 00216 00217 StreamInfo 00218 *stream_info; 00219 00220 /* 00221 Set defaults. 00222 */ 00223 assert(image_info != (ImageInfo *) NULL); 00224 assert(image_info->signature == MagickSignature); 00225 if (image_info->debug != MagickFalse) 00226 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"..."); 00227 assert(exception != (ExceptionInfo *) NULL); 00228 (void) metadata; 00229 if (argc == 2) 00230 { 00231 option=argv[1]; 00232 if ((LocaleCompare("version",option+1) == 0) || 00233 (LocaleCompare("-version",option+1) == 0)) 00234 { 00235 (void) FormatLocaleFile(stdout,"Version: %s\n", 00236 GetMagickVersion((size_t *) NULL)); 00237 (void) FormatLocaleFile(stdout,"Copyright: %s\n", 00238 GetMagickCopyright()); 00239 (void) FormatLocaleFile(stdout,"Features: %s\n\n", 00240 GetMagickFeatures()); 00241 return(MagickFalse); 00242 } 00243 } 00244 if (argc < 3) 00245 return(StreamUsage()); 00246 format="%w,%h,%m"; 00247 (void) format; 00248 j=1; 00249 k=0; 00250 NewImageStack(); 00251 option=(char *) NULL; 00252 pend=MagickFalse; 00253 respect_parenthesis=MagickFalse; 00254 stream_info=AcquireStreamInfo(image_info,exception); 00255 status=MagickTrue; 00256 /* 00257 Stream an image. 00258 */ 00259 ReadCommandlLine(argc,&argv); 00260 status=ExpandFilenames(&argc,&argv); 00261 if (status == MagickFalse) 00262 ThrowStreamException(ResourceLimitError,"MemoryAllocationFailed", 00263 GetExceptionMessage(errno)); 00264 status=OpenStream(image_info,stream_info,argv[argc-1],exception); 00265 if (status == MagickFalse) 00266 { 00267 DestroyStream(); 00268 return(MagickFalse); 00269 } 00270 for (i=1; i < (ssize_t) (argc-1); i++) 00271 { 00272 option=argv[i]; 00273 if (LocaleCompare(option,"(") == 0) 00274 { 00275 FireImageStack(MagickFalse,MagickTrue,pend); 00276 if (k == MaxImageStackDepth) 00277 ThrowStreamException(OptionError,"ParenthesisNestedTooDeeply",option); 00278 PushImageStack(); 00279 continue; 00280 } 00281 if (LocaleCompare(option,")") == 0) 00282 { 00283 FireImageStack(MagickFalse,MagickTrue,MagickTrue); 00284 if (k == 0) 00285 ThrowStreamException(OptionError,"UnableToParseExpression",option); 00286 PopImageStack(); 00287 continue; 00288 } 00289 if (IsCommandOption(option) == MagickFalse) 00290 { 00291 Image 00292 *images; 00293 00294 /* 00295 Stream input image. 00296 */ 00297 FireImageStack(MagickFalse,MagickFalse,pend); 00298 filename=argv[i]; 00299 if ((LocaleCompare(filename,"--") == 0) && (i < (ssize_t) (argc-1))) 00300 filename=argv[++i]; 00301 (void) CopyMagickString(image_info->filename,filename,MaxTextExtent); 00302 images=StreamImage(image_info,stream_info,exception); 00303 status&=(images != (Image *) NULL) && 00304 (exception->severity < ErrorException); 00305 if (images == (Image *) NULL) 00306 continue; 00307 AppendImageStack(images); 00308 continue; 00309 } 00310 pend=image != (Image *) NULL ? MagickTrue : MagickFalse; 00311 switch (*(option+1)) 00312 { 00313 case 'a': 00314 { 00315 if (LocaleCompare("authenticate",option+1) == 0) 00316 { 00317 if (*option == '+') 00318 break; 00319 i++; 00320 if (i == (ssize_t) (argc-1)) 00321 ThrowStreamException(OptionError,"MissingArgument",option); 00322 break; 00323 } 00324 ThrowStreamException(OptionError,"UnrecognizedOption",option) 00325 } 00326 case 'c': 00327 { 00328 if (LocaleCompare("cache",option+1) == 0) 00329 { 00330 if (*option == '+') 00331 break; 00332 i++; 00333 if (i == (ssize_t) argc) 00334 ThrowStreamException(OptionError,"MissingArgument",option); 00335 if (IsGeometry(argv[i]) == MagickFalse) 00336 ThrowStreamInvalidArgumentException(option,argv[i]); 00337 break; 00338 } 00339 if (LocaleCompare("channel",option+1) == 0) 00340 { 00341 ssize_t 00342 channel; 00343 00344 if (*option == '+') 00345 break; 00346 i++; 00347 if (i == (ssize_t) (argc-1)) 00348 ThrowStreamException(OptionError,"MissingArgument",option); 00349 channel=ParseChannelOption(argv[i]); 00350 if (channel < 0) 00351 ThrowStreamException(OptionError,"UnrecognizedChannelType", 00352 argv[i]); 00353 break; 00354 } 00355 if (LocaleCompare("colorspace",option+1) == 0) 00356 { 00357 ssize_t 00358 colorspace; 00359 00360 if (*option == '+') 00361 break; 00362 i++; 00363 if (i == (ssize_t) (argc-1)) 00364 ThrowStreamException(OptionError,"MissingArgument",option); 00365 colorspace=ParseCommandOption(MagickColorspaceOptions,MagickFalse, 00366 argv[i]); 00367 if (colorspace < 0) 00368 ThrowStreamException(OptionError,"UnrecognizedColorspace", 00369 argv[i]); 00370 break; 00371 } 00372 if (LocaleCompare("compress",option+1) == 0) 00373 { 00374 ssize_t 00375 compress; 00376 00377 if (*option == '+') 00378 break; 00379 i++; 00380 if (i == (ssize_t) (argc-1)) 00381 ThrowStreamException(OptionError,"MissingArgument",option); 00382 compress=ParseCommandOption(MagickCompressOptions,MagickFalse, 00383 argv[i]); 00384 if (compress < 0) 00385 ThrowStreamException(OptionError,"UnrecognizedImageCompression", 00386 argv[i]); 00387 break; 00388 } 00389 if (LocaleCompare("concurrent",option+1) == 0) 00390 break; 00391 ThrowStreamException(OptionError,"UnrecognizedOption",option) 00392 } 00393 case 'd': 00394 { 00395 if (LocaleCompare("debug",option+1) == 0) 00396 { 00397 ssize_t 00398 event; 00399 00400 if (*option == '+') 00401 break; 00402 i++; 00403 if (i == (ssize_t) argc) 00404 ThrowStreamException(OptionError,"MissingArgument",option); 00405 event=ParseCommandOption(MagickLogEventOptions,MagickFalse,argv[i]); 00406 if (event < 0) 00407 ThrowStreamException(OptionError,"UnrecognizedEventType",argv[i]); 00408 (void) SetLogEventMask(argv[i]); 00409 break; 00410 } 00411 if (LocaleCompare("define",option+1) == 0) 00412 { 00413 i++; 00414 if (i == (ssize_t) argc) 00415 ThrowStreamException(OptionError,"MissingArgument",option); 00416 if (*option == '+') 00417 { 00418 const char 00419 *define; 00420 00421 define=GetImageOption(image_info,argv[i]); 00422 if (define == (const char *) NULL) 00423 ThrowStreamException(OptionError,"NoSuchOption",argv[i]); 00424 break; 00425 } 00426 break; 00427 } 00428 if (LocaleCompare("density",option+1) == 0) 00429 { 00430 if (*option == '+') 00431 break; 00432 i++; 00433 if (i == (ssize_t) argc) 00434 ThrowStreamException(OptionError,"MissingArgument",option); 00435 if (IsGeometry(argv[i]) == MagickFalse) 00436 ThrowStreamInvalidArgumentException(option,argv[i]); 00437 break; 00438 } 00439 if (LocaleCompare("depth",option+1) == 0) 00440 { 00441 if (*option == '+') 00442 break; 00443 i++; 00444 if (i == (ssize_t) argc) 00445 ThrowStreamException(OptionError,"MissingArgument",option); 00446 if (IsGeometry(argv[i]) == MagickFalse) 00447 ThrowStreamInvalidArgumentException(option,argv[i]); 00448 break; 00449 } 00450 if (LocaleCompare("duration",option+1) == 0) 00451 { 00452 if (*option == '+') 00453 break; 00454 i++; 00455 if (i == (ssize_t) (argc-1)) 00456 ThrowStreamException(OptionError,"MissingArgument",option); 00457 if (IsGeometry(argv[i]) == MagickFalse) 00458 ThrowStreamInvalidArgumentException(option,argv[i]); 00459 break; 00460 } 00461 ThrowStreamException(OptionError,"UnrecognizedOption",option) 00462 } 00463 case 'e': 00464 { 00465 if (LocaleCompare("extract",option+1) == 0) 00466 { 00467 if (*option == '+') 00468 break; 00469 i++; 00470 if (i == (ssize_t) (argc-1)) 00471 ThrowStreamException(OptionError,"MissingArgument",option); 00472 if (IsGeometry(argv[i]) == MagickFalse) 00473 ThrowStreamInvalidArgumentException(option,argv[i]); 00474 break; 00475 } 00476 ThrowStreamException(OptionError,"UnrecognizedOption",option) 00477 } 00478 case 'h': 00479 { 00480 if ((LocaleCompare("help",option+1) == 0) || 00481 (LocaleCompare("-help",option+1) == 0)) 00482 return(StreamUsage()); 00483 ThrowStreamException(OptionError,"UnrecognizedOption",option) 00484 } 00485 case 'i': 00486 { 00487 if (LocaleCompare("identify",option+1) == 0) 00488 break; 00489 if (LocaleCompare("interlace",option+1) == 0) 00490 { 00491 ssize_t 00492 interlace; 00493 00494 if (*option == '+') 00495 break; 00496 i++; 00497 if (i == (ssize_t) argc) 00498 ThrowStreamException(OptionError,"MissingArgument",option); 00499 interlace=ParseCommandOption(MagickInterlaceOptions,MagickFalse, 00500 argv[i]); 00501 if (interlace < 0) 00502 ThrowStreamException(OptionError,"UnrecognizedInterlaceType", 00503 argv[i]); 00504 break; 00505 } 00506 if (LocaleCompare("interpolate",option+1) == 0) 00507 { 00508 ssize_t 00509 interpolate; 00510 00511 if (*option == '+') 00512 break; 00513 i++; 00514 if (i == (ssize_t) argc) 00515 ThrowStreamException(OptionError,"MissingArgument",option); 00516 interpolate=ParseCommandOption(MagickInterpolateOptions,MagickFalse, 00517 argv[i]); 00518 if (interpolate < 0) 00519 ThrowStreamException(OptionError,"UnrecognizedInterpolateMethod", 00520 argv[i]); 00521 break; 00522 } 00523 ThrowStreamException(OptionError,"UnrecognizedOption",option) 00524 } 00525 case 'l': 00526 { 00527 if (LocaleCompare("limit",option+1) == 0) 00528 { 00529 char 00530 *p; 00531 00532 double 00533 value; 00534 00535 ssize_t 00536 resource; 00537 00538 if (*option == '+') 00539 break; 00540 i++; 00541 if (i == (ssize_t) argc) 00542 ThrowStreamException(OptionError,"MissingArgument",option); 00543 resource=ParseCommandOption(MagickResourceOptions,MagickFalse, 00544 argv[i]); 00545 if (resource < 0) 00546 ThrowStreamException(OptionError,"UnrecognizedResourceType", 00547 argv[i]); 00548 i++; 00549 if (i == (ssize_t) argc) 00550 ThrowStreamException(OptionError,"MissingArgument",option); 00551 value=StringToDouble(argv[i],&p); 00552 (void) value; 00553 if ((p == argv[i]) && (LocaleCompare("unlimited",argv[i]) != 0)) 00554 ThrowStreamInvalidArgumentException(option,argv[i]); 00555 break; 00556 } 00557 if (LocaleCompare("list",option+1) == 0) 00558 { 00559 ssize_t 00560 list; 00561 00562 if (*option == '+') 00563 break; 00564 i++; 00565 if (i == (ssize_t) argc) 00566 ThrowStreamException(OptionError,"MissingArgument",option); 00567 list=ParseCommandOption(MagickListOptions,MagickFalse,argv[i]); 00568 if (list < 0) 00569 ThrowStreamException(OptionError,"UnrecognizedListType",argv[i]); 00570 status=MogrifyImageInfo(image_info,(int) (i-j+1),(const char **) 00571 argv+j,exception); 00572 DestroyStream(); 00573 return(status != 0 ? MagickFalse : MagickTrue); 00574 } 00575 if (LocaleCompare("log",option+1) == 0) 00576 { 00577 if (*option == '+') 00578 break; 00579 i++; 00580 if ((i == (ssize_t) argc) || (strchr(argv[i],'%') == (char *) NULL)) 00581 ThrowStreamException(OptionError,"MissingArgument",option); 00582 break; 00583 } 00584 ThrowStreamException(OptionError,"UnrecognizedOption",option) 00585 } 00586 case 'm': 00587 { 00588 if (LocaleCompare("map",option+1) == 0) 00589 { 00590 (void) CopyMagickString(argv[i]+1,"san",MaxTextExtent); 00591 if (*option == '+') 00592 break; 00593 i++; 00594 SetStreamInfoMap(stream_info,argv[i]); 00595 break; 00596 } 00597 if (LocaleCompare("monitor",option+1) == 0) 00598 break; 00599 ThrowStreamException(OptionError,"UnrecognizedOption",option) 00600 } 00601 case 'q': 00602 { 00603 if (LocaleCompare("quantize",option+1) == 0) 00604 { 00605 ssize_t 00606 colorspace; 00607 00608 if (*option == '+') 00609 break; 00610 i++; 00611 if (i == (ssize_t) (argc-1)) 00612 ThrowStreamException(OptionError,"MissingArgument",option); 00613 colorspace=ParseCommandOption(MagickColorspaceOptions, 00614 MagickFalse,argv[i]); 00615 if (colorspace < 0) 00616 ThrowStreamException(OptionError,"UnrecognizedColorspace", 00617 argv[i]); 00618 break; 00619 } 00620 if (LocaleCompare("quiet",option+1) == 0) 00621 break; 00622 ThrowStreamException(OptionError,"UnrecognizedOption",option) 00623 } 00624 case 'r': 00625 { 00626 if (LocaleCompare("regard-warnings",option+1) == 0) 00627 break; 00628 if (LocaleNCompare("respect-parentheses",option+1,17) == 0) 00629 { 00630 respect_parenthesis=(*option == '-') ? MagickTrue : MagickFalse; 00631 break; 00632 } 00633 ThrowStreamException(OptionError,"UnrecognizedOption",option) 00634 } 00635 case 's': 00636 { 00637 if (LocaleCompare("sampling-factor",option+1) == 0) 00638 { 00639 if (*option == '+') 00640 break; 00641 i++; 00642 if (i == (ssize_t) argc) 00643 ThrowStreamException(OptionError,"MissingArgument",option); 00644 if (IsGeometry(argv[i]) == MagickFalse) 00645 ThrowStreamInvalidArgumentException(option,argv[i]); 00646 break; 00647 } 00648 if (LocaleCompare("seed",option+1) == 0) 00649 { 00650 if (*option == '+') 00651 break; 00652 i++; 00653 if (i == (ssize_t) (argc-1)) 00654 ThrowStreamException(OptionError,"MissingArgument",option); 00655 if (IsGeometry(argv[i]) == MagickFalse) 00656 ThrowStreamInvalidArgumentException(option,argv[i]); 00657 break; 00658 } 00659 if (LocaleCompare("set",option+1) == 0) 00660 { 00661 i++; 00662 if (i == (ssize_t) argc) 00663 ThrowStreamException(OptionError,"MissingArgument",option); 00664 if (*option == '+') 00665 break; 00666 i++; 00667 if (i == (ssize_t) argc) 00668 ThrowStreamException(OptionError,"MissingArgument",option); 00669 break; 00670 } 00671 if (LocaleCompare("size",option+1) == 0) 00672 { 00673 if (*option == '+') 00674 break; 00675 i++; 00676 if (i == (ssize_t) argc) 00677 ThrowStreamException(OptionError,"MissingArgument",option); 00678 if (IsGeometry(argv[i]) == MagickFalse) 00679 ThrowStreamInvalidArgumentException(option,argv[i]); 00680 break; 00681 } 00682 if (LocaleCompare("storage-type",option+1) == 0) 00683 { 00684 ssize_t 00685 type; 00686 00687 if (*option == '+') 00688 break; 00689 i++; 00690 if (i == (ssize_t) (argc-1)) 00691 ThrowStreamException(OptionError,"MissingArgument",option); 00692 type=ParseCommandOption(MagickStorageOptions,MagickFalse,argv[i]); 00693 if (type < 0) 00694 ThrowStreamException(OptionError,"UnrecognizedStorageType", 00695 argv[i]); 00696 SetStreamInfoStorageType(stream_info,(StorageType) type); 00697 break; 00698 } 00699 if (LocaleCompare("synchronize",option+1) == 0) 00700 break; 00701 ThrowStreamException(OptionError,"UnrecognizedOption",option) 00702 } 00703 case 't': 00704 { 00705 if (LocaleCompare("taint",option+1) == 0) 00706 break; 00707 if (LocaleCompare("transparent-color",option+1) == 0) 00708 { 00709 if (*option == '+') 00710 break; 00711 i++; 00712 if (i == (ssize_t) (argc-1)) 00713 ThrowStreamException(OptionError,"MissingArgument",option); 00714 break; 00715 } 00716 ThrowStreamException(OptionError,"UnrecognizedOption",option) 00717 } 00718 case 'v': 00719 { 00720 if (LocaleCompare("verbose",option+1) == 0) 00721 break; 00722 if ((LocaleCompare("version",option+1) == 0) || 00723 (LocaleCompare("-version",option+1) == 0)) 00724 { 00725 (void) FormatLocaleFile(stdout,"Version: %s\n", 00726 GetMagickVersion((size_t *) NULL)); 00727 (void) FormatLocaleFile(stdout,"Copyright: %s\n", 00728 GetMagickCopyright()); 00729 (void) FormatLocaleFile(stdout,"Features: %s\n\n", 00730 GetMagickFeatures()); 00731 break; 00732 } 00733 if (LocaleCompare("virtual-pixel",option+1) == 0) 00734 { 00735 ssize_t 00736 method; 00737 00738 if (*option == '+') 00739 break; 00740 i++; 00741 if (i == (ssize_t) (argc-1)) 00742 ThrowStreamException(OptionError,"MissingArgument",option); 00743 method=ParseCommandOption(MagickVirtualPixelOptions,MagickFalse, 00744 argv[i]); 00745 if (method < 0) 00746 ThrowStreamException(OptionError, 00747 "UnrecognizedVirtualPixelMethod",argv[i]); 00748 break; 00749 } 00750 ThrowStreamException(OptionError,"UnrecognizedOption",option) 00751 } 00752 case '?': 00753 break; 00754 default: 00755 ThrowStreamException(OptionError,"UnrecognizedOption",option) 00756 } 00757 fire=(GetCommandOptionFlags(MagickCommandOptions,MagickFalse,option) & 00758 FireOptionFlag) == 0 ? MagickFalse : MagickTrue; 00759 if (fire != MagickFalse) 00760 FireImageStack(MagickFalse,MagickTrue,MagickTrue); 00761 } 00762 if (k != 0) 00763 ThrowStreamException(OptionError,"UnbalancedParenthesis",argv[i]); 00764 if (i-- != (ssize_t) (argc-1)) 00765 ThrowStreamException(OptionError,"MissingAnImageFilename",argv[i]); 00766 if (image == (Image *) NULL) 00767 ThrowStreamException(OptionError,"MissingAnImageFilename",argv[i]); 00768 FinalizeImageSettings(image_info,image,MagickTrue); 00769 if (image == (Image *) NULL) 00770 ThrowStreamException(OptionError,"MissingAnImageFilename",argv[i]); 00771 DestroyStream(); 00772 return(status != 0 ? MagickTrue : MagickFalse); 00773 }