• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2    Direct call to ProcessCommandOptions() to process an array of
3    options minus the command argument.  This is the function that
4    actually splits up the argument array into separate operation
5    group calls.
6 
7 
8    Compile with ImageMagick-devlop installed...
9 
10      gcc -lMagickWand -lMagickCore cli_process.c -o cli_process
11 
12    Compile and run directly in Source Directory...
13 
14      IM_PROG=api_examples/cli_process
15      gcc -I`pwd` -LMagickWand/.libs -LMagickCore/.libs \
16        -lMagickWand -lMagickCore  $IM_PROG.c -o $IM_PROG
17 
18      sh magick.sh    $IM_PROG
19 
20 */
21 #include <stdio.h>
22 #include "MagickCore/studio.h"
23 #include "MagickWand/MagickWand.h"
24 
main(int argc,char ** argv)25 int main(int argc, char **argv)
26 {
27   MagickCLI
28     *cli_wand;
29 
30   int arg_count;
31   char *args[] = { "-size", "100x100", "xc:red",
32                    "(", "rose:", "-rotate", "-90", ")",
33                    "+append", "show:", NULL };
34 
35   for(arg_count = 0; args[arg_count] != (char *) NULL; arg_count++);
36 
37 
38   MagickCoreGenesis(argv[0],MagickFalse);
39   cli_wand = AcquireMagickCLI((ImageInfo *) NULL,(ExceptionInfo *) NULL);
40 
41   ProcessCommandOptions(cli_wand, arg_count, args, 0, MagickCommandOptionFlags);
42 
43   /* Note use of 'True' to report all exceptions - including non-fatals */
44   if ( CLICatchException(cli_wand,MagickTrue) != MagickFalse )
45     fprintf(stderr, "Major Error Detected\n");
46 
47 
48   cli_wand = DestroyMagickCLI(cli_wand);
49   MagickCoreTerminus();
50 }
51