blob: 1eb662df8fda76d6b3a0676439a7c0481fc326e7 [file] [log] [blame]
anthony25247ae2013-03-18 05:05:40 +00001/*
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
25int 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
cristyf432c632014-12-07 15:11:28 +000035 for(arg_count = 0; args[arg_count] != (char *) NULL; arg_count++);
anthony25247ae2013-03-18 05:05:40 +000036
37
38 MagickCoreGenesis(argv[0],MagickFalse);
cristyf432c632014-12-07 15:11:28 +000039 cli_wand = AcquireMagickCLI((ImageInfo *) NULL,(ExceptionInfo *) NULL);
anthony25247ae2013-03-18 05:05:40 +000040
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}