blob: 1f18c413cdefad99f3d59e70ac2ff0b79d6a1b68 [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
Anthony Thyssen5b7198d2016-12-20 11:05:09 +100012 Compile and run directly from Source Directory...
anthony25247ae2013-03-18 05:05:40 +000013
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
Anthony Thyssen5b7198d2016-12-20 11:05:09 +100018 sh ./magick.sh $IM_PROG
anthony25247ae2013-03-18 05:05:40 +000019
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}