stream.c

Go to the documentation of this file.
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-2009 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 "wand/studio.h"
00048 #include "wand/MagickWand.h"
00049 #include "wand/mogrify-private.h"
00050 #include "magick/stream-private.h"
00051 
00052 /*
00053 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00054 %                                                                             %
00055 %                                                                             %
00056 %                                                                             %
00057 %   S t r e a m I m a g e C o m m a n d                                       %
00058 %                                                                             %
00059 %                                                                             %
00060 %                                                                             %
00061 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00062 %
00063 %  StreamImageCommand() is a lightweight method designed to extract pixels
00064 %  from large image files to a raw format using a minimum of system resources.
00065 %  The entire image or any regular portion of the image can be extracted.
00066 %
00067 %  The format of the StreamImageCommand method is:
00068 %
00069 %      MagickBooleanType StreamImageCommand(ImageInfo *image_info,int argc,
00070 %        char **argv,char **metadata,ExceptionInfo *exception)
00071 %
00072 %  A description of each parameter follows:
00073 %
00074 %    o image_info: the image info.
00075 %
00076 %    o argc: the number of elements in the argument vector.
00077 %
00078 %    o argv: A text array containing the command line arguments.
00079 %
00080 %    o metadata: any metadata is returned here.
00081 %
00082 %    o exception: return any errors or warnings in this structure.
00083 %
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       "-transparent-color color",
00131       "                     transparent color",
00132       "-verbose             print detailed information about the image",
00133       "-virtual-pixel method",
00134       "                     virtual pixel access method",
00135       (char *) NULL
00136     };
00137 
00138   (void) printf("Version: %s\n",GetMagickVersion((unsigned long *) NULL));
00139   (void) printf("Copyright: %s\n",GetMagickCopyright());
00140   (void) printf("Features: %s\n\n",GetMagickFeatures());
00141   (void) printf("Usage: %s [options ...] input-image raw-image\n",
00142     GetClientName());
00143   (void) printf("\nImage Settings:\n");
00144   for (p=settings; *p != (char *) NULL; p++)
00145     (void) printf("  %s\n",*p);
00146   (void) printf("\nMiscellaneous Options:\n");
00147   for (p=miscellaneous; *p != (char *) NULL; p++)
00148     (void) printf("  %s\n",*p);
00149   (void) printf(
00150     "\nBy default, the image format of `file' is determined by its magic\n");
00151   (void) printf(
00152     "number.  To specify a particular image format, precede the filename\n");
00153   (void) printf(
00154     "with an image format name and a colon (i.e. ps:image) or specify the\n");
00155   (void) printf(
00156     "image type as the filename suffix (i.e. image.ps).  Specify 'file' as\n");
00157   (void) printf("'-' for standard input or output.\n");
00158   return(MagickFalse);
00159 }
00160 
00161 WandExport MagickBooleanType StreamImageCommand(ImageInfo *image_info,
00162   int argc,char **argv,char **metadata,ExceptionInfo *exception)
00163 {
00164 #define DestroyStream() \
00165 { \
00166   DestroyImageStack(); \
00167   stream_info=DestroyStreamInfo(stream_info); \
00168   for (i=0; i < (long) argc; i++) \
00169     argv[i]=DestroyString(argv[i]); \
00170   argv=(char **) RelinquishMagickMemory(argv); \
00171 }
00172 #define ThrowStreamException(asperity,tag,option) \
00173 { \
00174   (void) ThrowMagickException(exception,GetMagickModule(),asperity,tag,"`%s'", \
00175     option); \
00176   DestroyStream(); \
00177   return(MagickFalse); \
00178 }
00179 #define ThrowStreamInvalidArgumentException(option,argument) \
00180 { \
00181   (void) ThrowMagickException(exception,GetMagickModule(),OptionError, \
00182     "InvalidArgument","`%s': %s",option,argument); \
00183   DestroyStream(); \
00184   return(MagickFalse); \
00185 }
00186 
00187   char
00188     *filename,
00189     *option;
00190 
00191   const char
00192     *format;
00193 
00194   Image
00195     *image;
00196 
00197   ImageStack
00198     image_stack[MaxImageStackDepth+1];
00199 
00200   long
00201     j,
00202     k;
00203 
00204   MagickBooleanType
00205     fire,
00206     pend;
00207 
00208   MagickStatusType
00209     status;
00210 
00211   register long
00212     i;
00213 
00214   StreamInfo
00215     *stream_info;
00216 
00217   /*
00218     Set defaults.
00219   */
00220   assert(image_info != (ImageInfo *) NULL);
00221   assert(image_info->signature == MagickSignature);
00222   if (image_info->debug != MagickFalse)
00223     (void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");
00224   assert(exception != (ExceptionInfo *) NULL);
00225   (void) metadata;
00226   if (argc == 2)
00227     {
00228       option=argv[1];
00229       if ((LocaleCompare("version",option+1) == 0) ||
00230           (LocaleCompare("-version",option+1) == 0))
00231         {
00232           (void) fprintf(stdout,"Version: %s\n",
00233             GetMagickVersion((unsigned long *) NULL));
00234           (void) fprintf(stdout,"Copyright: %s\n",GetMagickCopyright());
00235           (void) fprintf(stdout,"Features: %s\n\n",GetMagickFeatures());
00236           return(MagickFalse);
00237         }
00238     }
00239   if (argc < 3)
00240     {
00241       (void) StreamUsage();
00242       return(MagickTrue);
00243     }
00244   format="%w,%h,%m";
00245   j=1;
00246   k=0;
00247   NewImageStack();
00248   option=(char *) NULL;
00249   pend=MagickFalse;
00250   stream_info=AcquireStreamInfo(image_info);
00251   status=MagickTrue;
00252   /*
00253     Stream an image.
00254   */
00255   ReadCommandlLine(argc,&argv);
00256   status=ExpandFilenames(&argc,&argv);
00257   if (status == MagickFalse)
00258     ThrowStreamException(ResourceLimitError,"MemoryAllocationFailed",
00259       GetExceptionMessage(errno));
00260   status=OpenStream(image_info,stream_info,argv[argc-1],exception);
00261   if (status == MagickFalse)
00262     {
00263       DestroyStream();
00264       return(MagickFalse);
00265     }
00266   for (i=1; i < (long) (argc-1); i++)
00267   {
00268     option=argv[i];
00269     if (LocaleCompare(option,"(") == 0)
00270       {
00271         FireImageStack(MagickFalse,MagickTrue,pend);
00272         if (k == MaxImageStackDepth)
00273           ThrowStreamException(OptionError,"ParenthesisNestedTooDeeply",option);
00274         PushImageStack();
00275         continue;
00276       }
00277     if (LocaleCompare(option,")") == 0)
00278       {
00279         FireImageStack(MagickFalse,MagickTrue,MagickTrue);
00280         if (k == 0)
00281           ThrowStreamException(OptionError,"UnableToParseExpression",option);
00282         PopImageStack();
00283         continue;
00284       }
00285     if (IsMagickOption(option) == MagickFalse)
00286       {
00287         Image
00288           *images;
00289 
00290         /*
00291           Stream input image.
00292         */
00293         FireImageStack(MagickFalse,MagickFalse,pend);
00294         filename=argv[i];
00295         if ((LocaleCompare(filename,"--") == 0) && (i < (argc-1)))
00296           filename=argv[++i];
00297         (void) CopyMagickString(image_info->filename,filename,MaxTextExtent);
00298         images=StreamImage(image_info,stream_info,exception);
00299         status&=(images != (Image *) NULL) &&
00300           (exception->severity < ErrorException);
00301         if (images == (Image *) NULL)
00302           continue;
00303         AppendImageStack(images);
00304         continue;
00305       }
00306     pend=image != (Image *) NULL ? MagickTrue : MagickFalse;
00307     switch (*(option+1))
00308     {
00309       case 'a':
00310       {
00311         if (LocaleCompare("authenticate",option+1) == 0)
00312           {
00313             if (*option == '+')
00314               break;
00315             i++;
00316             if (i == (long) (argc-1))
00317               ThrowStreamException(OptionError,"MissingArgument",option);
00318             break;
00319           }
00320         ThrowStreamException(OptionError,"UnrecognizedOption",option)
00321       }
00322       case 'c':
00323       {
00324         if (LocaleCompare("cache",option+1) == 0)
00325           {
00326             if (*option == '+')
00327               break;
00328             i++;
00329             if (i == (long) argc)
00330               ThrowStreamException(OptionError,"MissingArgument",option);
00331             if (IsGeometry(argv[i]) == MagickFalse)
00332               ThrowStreamInvalidArgumentException(option,argv[i]);
00333             break;
00334           }
00335         if (LocaleCompare("channel",option+1) == 0)
00336           {
00337             long
00338               channel;
00339 
00340             if (*option == '+')
00341               break;
00342             i++;
00343             if (i == (long) (argc-1))
00344               ThrowStreamException(OptionError,"MissingArgument",option);
00345             channel=ParseChannelOption(argv[i]);
00346             if (channel < 0)
00347               ThrowStreamException(OptionError,"UnrecognizedChannelType",
00348                 argv[i]);
00349             break;
00350           }
00351         if (LocaleCompare("colorspace",option+1) == 0)
00352           {
00353             long
00354               colorspace;
00355 
00356             if (*option == '+')
00357               break;
00358             i++;
00359             if (i == (long) (argc-1))
00360               ThrowStreamException(OptionError,"MissingArgument",option);
00361             colorspace=ParseMagickOption(MagickColorspaceOptions,MagickFalse,
00362               argv[i]);
00363             if (colorspace < 0)
00364               ThrowStreamException(OptionError,"UnrecognizedColorspace",
00365                 argv[i]);
00366             break;
00367           }
00368         if (LocaleCompare("compress",option+1) == 0)
00369           {
00370             long
00371               compress;
00372 
00373             if (*option == '+')
00374               break;
00375             i++;
00376             if (i == (long) (argc-1))
00377               ThrowStreamException(OptionError,"MissingArgument",option);
00378             compress=ParseMagickOption(MagickCompressOptions,MagickFalse,
00379               argv[i]);
00380             if (compress < 0)
00381               ThrowStreamException(OptionError,"UnrecognizedImageCompression",
00382                 argv[i]);
00383             break;
00384           }
00385         if (LocaleCompare("concurrent",option+1) == 0)
00386           break;
00387         ThrowStreamException(OptionError,"UnrecognizedOption",option)
00388       }
00389       case 'd':
00390       {
00391         if (LocaleCompare("debug",option+1) == 0)
00392           {
00393             long
00394               event;
00395 
00396             if (*option == '+')
00397               break;
00398             i++;
00399             if (i == (long) argc)
00400               ThrowStreamException(OptionError,"MissingArgument",option);
00401             event=ParseMagickOption(MagickLogEventOptions,MagickFalse,argv[i]);
00402             if (event < 0)
00403               ThrowStreamException(OptionError,"UnrecognizedEventType",argv[i]);
00404             (void) SetLogEventMask(argv[i]);
00405             break;
00406           }
00407         if (LocaleCompare("define",option+1) == 0)
00408           {
00409             i++;
00410             if (i == (long) argc)
00411               ThrowStreamException(OptionError,"MissingArgument",option);
00412             if (*option == '+')
00413               {
00414                 const char
00415                   *define;
00416 
00417                 define=GetImageOption(image_info,argv[i]);
00418                 if (define == (const char *) NULL)
00419                   ThrowStreamException(OptionError,"NoSuchOption",argv[i]);
00420                 break;
00421               }
00422             break;
00423           }
00424         if (LocaleCompare("density",option+1) == 0)
00425           {
00426             if (*option == '+')
00427               break;
00428             i++;
00429             if (i == (long) argc)
00430               ThrowStreamException(OptionError,"MissingArgument",option);
00431             if (IsGeometry(argv[i]) == MagickFalse)
00432               ThrowStreamInvalidArgumentException(option,argv[i]);
00433             break;
00434           }
00435         if (LocaleCompare("depth",option+1) == 0)
00436           {
00437             if (*option == '+')
00438               break;
00439             i++;
00440             if (i == (long) argc)
00441               ThrowStreamException(OptionError,"MissingArgument",option);
00442             if (IsGeometry(argv[i]) == MagickFalse)
00443               ThrowStreamInvalidArgumentException(option,argv[i]);
00444             break;
00445           }
00446         if (LocaleCompare("duration",option+1) == 0)
00447           {
00448             if (*option == '+')
00449               break;
00450             i++;
00451             if (i == (long) (argc-1))
00452               ThrowStreamException(OptionError,"MissingArgument",option);
00453             if (IsGeometry(argv[i]) == MagickFalse)
00454               ThrowStreamInvalidArgumentException(option,argv[i]);
00455             break;
00456           }
00457         ThrowStreamException(OptionError,"UnrecognizedOption",option)
00458       }
00459       case 'e':
00460       {
00461         if (LocaleCompare("extract",option+1) == 0)
00462           {
00463             if (*option == '+')
00464               break;
00465             i++;
00466             if (i == (long) (argc-1))
00467               ThrowStreamException(OptionError,"MissingArgument",option);
00468             if (IsGeometry(argv[i]) == MagickFalse)
00469               ThrowStreamInvalidArgumentException(option,argv[i]);
00470             break;
00471           }
00472         ThrowStreamException(OptionError,"UnrecognizedOption",option)
00473       }
00474       case 'h':
00475       {
00476         if ((LocaleCompare("help",option+1) == 0) ||
00477             (LocaleCompare("-help",option+1) == 0))
00478           return(StreamUsage());
00479         ThrowStreamException(OptionError,"UnrecognizedOption",option)
00480       }
00481       case 'i':
00482       {
00483         if (LocaleCompare("identify",option+1) == 0)
00484           break;
00485         if (LocaleCompare("interlace",option+1) == 0)
00486           {
00487             long
00488               interlace;
00489 
00490             if (*option == '+')
00491               break;
00492             i++;
00493             if (i == (long) argc)
00494               ThrowStreamException(OptionError,"MissingArgument",option);
00495             interlace=ParseMagickOption(MagickInterlaceOptions,MagickFalse,
00496               argv[i]);
00497             if (interlace < 0)
00498               ThrowStreamException(OptionError,"UnrecognizedInterlaceType",
00499                 argv[i]);
00500             break;
00501           }
00502         if (LocaleCompare("interpolate",option+1) == 0)
00503           {
00504             long
00505               interpolate;
00506 
00507             if (*option == '+')
00508               break;
00509             i++;
00510             if (i == (long) argc)
00511               ThrowStreamException(OptionError,"MissingArgument",option);
00512             interpolate=ParseMagickOption(MagickInterpolateOptions,MagickFalse,
00513               argv[i]);
00514             if (interpolate < 0)
00515               ThrowStreamException(OptionError,"UnrecognizedInterpolateMethod",
00516                 argv[i]);
00517             break;
00518           }
00519         ThrowStreamException(OptionError,"UnrecognizedOption",option)
00520       }
00521       case 'l':
00522       {
00523         if (LocaleCompare("limit",option+1) == 0)
00524           {
00525             char
00526               *p;
00527 
00528             double
00529               value;
00530 
00531             long
00532               resource;
00533 
00534             if (*option == '+')
00535               break;
00536             i++;
00537             if (i == (long) argc)
00538               ThrowStreamException(OptionError,"MissingArgument",option);
00539             resource=ParseMagickOption(MagickResourceOptions,MagickFalse,
00540               argv[i]);
00541             if (resource < 0)
00542               ThrowStreamException(OptionError,"UnrecognizedResourceType",
00543                 argv[i]);
00544             i++;
00545             if (i == (long) argc)
00546               ThrowStreamException(OptionError,"MissingArgument",option);
00547             value=strtod(argv[i],&p);
00548             if ((p == argv[i]) && (LocaleCompare("unlimited",argv[i]) != 0))
00549               ThrowStreamInvalidArgumentException(option,argv[i]);
00550             break;
00551           }
00552         if (LocaleCompare("list",option+1) == 0)
00553           {
00554             long
00555               list;
00556 
00557             if (*option == '+')
00558               break;
00559             i++;
00560             if (i == (long) argc)
00561               ThrowStreamException(OptionError,"MissingArgument",option);
00562             list=ParseMagickOption(MagickListOptions,MagickFalse,argv[i]);
00563             if (list < 0)
00564               ThrowStreamException(OptionError,"UnrecognizedListType",argv[i]);
00565             (void) MogrifyImageInfo(image_info,(int) (i-j+1),(const char **)
00566               argv+j,exception);
00567             DestroyStream();
00568             return(MagickTrue);
00569           }
00570         if (LocaleCompare("log",option+1) == 0)
00571           {
00572             if (*option == '+')
00573               break;
00574             i++;
00575             if ((i == (long) argc) || (strchr(argv[i],'%') == (char *) NULL))
00576               ThrowStreamException(OptionError,"MissingArgument",option);
00577             break;
00578           }
00579         ThrowStreamException(OptionError,"UnrecognizedOption",option)
00580       }
00581       case 'm':
00582       {
00583         if (LocaleCompare("map",option+1) == 0)
00584           {
00585             (void) CopyMagickString(argv[i]+1,"san",MaxTextExtent);
00586             if (*option == '+')
00587               break;
00588             i++;
00589             SetStreamInfoMap(stream_info,argv[i]);
00590             break;
00591           }
00592         if (LocaleCompare("monitor",option+1) == 0)
00593           break;
00594         ThrowStreamException(OptionError,"UnrecognizedOption",option)
00595       }
00596       case 'q':
00597       {
00598         if (LocaleCompare("quantize",option+1) == 0)
00599           {
00600             long
00601               colorspace;
00602 
00603             if (*option == '+')
00604               break;
00605             i++;
00606             if (i == (long) (argc-1))
00607               ThrowStreamException(OptionError,"MissingArgument",option);
00608             colorspace=ParseMagickOption(MagickColorspaceOptions,
00609               MagickFalse,argv[i]);
00610             if (colorspace < 0)
00611               ThrowStreamException(OptionError,"UnrecognizedColorspace",
00612                 argv[i]);
00613             break;
00614           }
00615         if (LocaleCompare("quiet",option+1) == 0)
00616           break;
00617         ThrowStreamException(OptionError,"UnrecognizedOption",option)
00618       }
00619       case 'r':
00620       {
00621         if (LocaleCompare("regard-warnings",option+1) == 0)
00622           break;
00623         if (LocaleNCompare("respect-parentheses",option+1,17) == 0)
00624           {
00625             respect_parenthesis=(*option == '-') ? MagickTrue : MagickFalse;
00626             break;
00627           }
00628         ThrowStreamException(OptionError,"UnrecognizedOption",option)
00629       }
00630       case 's':
00631       {
00632         if (LocaleCompare("sampling-factor",option+1) == 0)
00633           {
00634             if (*option == '+')
00635               break;
00636             i++;
00637             if (i == (long) argc)
00638               ThrowStreamException(OptionError,"MissingArgument",option);
00639             if (IsGeometry(argv[i]) == MagickFalse)
00640               ThrowStreamInvalidArgumentException(option,argv[i]);
00641             break;
00642           }
00643         if (LocaleCompare("seed",option+1) == 0)
00644           {
00645             if (*option == '+')
00646               break;
00647             i++;
00648             if (i == (long) (argc-1))
00649               ThrowStreamException(OptionError,"MissingArgument",option);
00650             if (IsGeometry(argv[i]) == MagickFalse)
00651               ThrowStreamInvalidArgumentException(option,argv[i]);
00652             break;
00653           }
00654         if (LocaleCompare("set",option+1) == 0)
00655           {
00656             i++;
00657             if (i == (long) argc)
00658               ThrowStreamException(OptionError,"MissingArgument",option);
00659             if (*option == '+')
00660               break;
00661             i++;
00662             if (i == (long) argc)
00663               ThrowStreamException(OptionError,"MissingArgument",option);
00664             break;
00665           }
00666         if (LocaleCompare("size",option+1) == 0)
00667           {
00668             if (*option == '+')
00669               break;
00670             i++;
00671             if (i == (long) argc)
00672               ThrowStreamException(OptionError,"MissingArgument",option);
00673             if (IsGeometry(argv[i]) == MagickFalse)
00674               ThrowStreamInvalidArgumentException(option,argv[i]);
00675             break;
00676           }
00677         if (LocaleCompare("storage-type",option+1) == 0)
00678           {
00679             long
00680               type;
00681 
00682             if (*option == '+')
00683               break;
00684             i++;
00685             if (i == (long) (argc-1))
00686               ThrowStreamException(OptionError,"MissingArgument",option);
00687             type=ParseMagickOption(MagickStorageOptions,MagickFalse,argv[i]);
00688             if (type < 0)
00689               ThrowStreamException(OptionError,"UnrecognizedStorageType",
00690                 argv[i]);
00691             SetStreamInfoStorageType(stream_info,(StorageType) type);
00692             break;
00693           }
00694         ThrowStreamException(OptionError,"UnrecognizedOption",option)
00695       }
00696       case 't':
00697       {
00698         if (LocaleCompare("transparent-color",option+1) == 0)
00699           {
00700             if (*option == '+')
00701               break;
00702             i++;
00703             if (i == (long) (argc-1))
00704               ThrowStreamException(OptionError,"MissingArgument",option);
00705             break;
00706           }
00707         ThrowStreamException(OptionError,"UnrecognizedOption",option)
00708       }
00709       case 'v':
00710       {
00711         if (LocaleCompare("verbose",option+1) == 0)
00712           break;
00713         if ((LocaleCompare("version",option+1) == 0) ||
00714             (LocaleCompare("-version",option+1) == 0))
00715           {
00716             (void) fprintf(stdout,"Version: %s\n",
00717               GetMagickVersion((unsigned long *) NULL));
00718             (void) fprintf(stdout,"Copyright: %s\n",GetMagickCopyright());
00719             (void) fprintf(stdout,"Features: %s\n\n",GetMagickFeatures());
00720             break;
00721           }
00722         if (LocaleCompare("virtual-pixel",option+1) == 0)
00723           {
00724             long
00725               method;
00726 
00727             if (*option == '+')
00728               break;
00729             i++;
00730             if (i == (long) (argc-1))
00731               ThrowStreamException(OptionError,"MissingArgument",option);
00732             method=ParseMagickOption(MagickVirtualPixelOptions,MagickFalse,
00733               argv[i]);
00734             if (method < 0)
00735               ThrowStreamException(OptionError,
00736                 "UnrecognizedVirtualPixelMethod",argv[i]);
00737             break;
00738           }
00739         ThrowStreamException(OptionError,"UnrecognizedOption",option)
00740       }
00741       case '?':
00742         break;
00743       default:
00744         ThrowStreamException(OptionError,"UnrecognizedOption",option)
00745     }
00746     fire=ParseMagickOption(MagickImageListOptions,MagickFalse,option+1) < 0 ?
00747       MagickFalse : MagickTrue;
00748     if (fire != MagickFalse)
00749       FireImageStack(MagickFalse,MagickTrue,MagickTrue);
00750   }
00751   if (k != 0)
00752     ThrowStreamException(OptionError,"UnbalancedParenthesis",argv[i]);
00753   if (i-- != (long) (argc-1))
00754     ThrowStreamException(OptionError,"MissingAnImageFilename",argv[i]);
00755   if (image == (Image *) NULL)
00756     ThrowStreamException(OptionError,"MissingAnImageFilename",argv[i]);
00757   FinalizeImageSettings(image_info,image,MagickTrue);
00758   if (image == (Image *) NULL)
00759     ThrowStreamException(OptionError,"MissingAnImageFilename",argv[i]);
00760   DestroyStream();
00761   return(status != 0 ? MagickTrue : MagickFalse);
00762 }

Generated on 19 Nov 2009 for MagickWand by  doxygen 1.6.1