blob: ed0b934140d2f59d42b58c1b803a5f343bfaa466 [file] [log] [blame]
anthony25247ae2013-03-18 05:05:40 +00001/*
2 Make direct calls to process the various CLI option handling groups
3 as defined in "MagickWand/operators.c" which uses a special
4 MagickCLI type of 'wand'.
5
Seth29ee2052020-08-16 13:09:27 +02006 This is essentially the calls 'ProcessCommandOptions()' make
anthony25247ae2013-03-18 05:05:40 +00007 though without as many error and sanity checks.
8
9 Compile with ImageMagick-devlop installed...
10
11 gcc -lMagickWand -lMagickCore cli_operators.c -o cli_operators
12
Anthony Thyssen5b7198d2016-12-20 11:05:09 +100013 Compile and run directly from Source Directory...
anthony25247ae2013-03-18 05:05:40 +000014
15 IM_PROG=api_examples/cli_operators
16 gcc -I`pwd` -LMagickWand/.libs -LMagickCore/.libs \
17 -lMagickWand -lMagickCore $IM_PROG.c -o $IM_PROG
18
Anthony Thyssen5b7198d2016-12-20 11:05:09 +100019 sh ./magick.sh $IM_PROG
anthony25247ae2013-03-18 05:05:40 +000020
21
22*/
23#include <stdio.h>
24#include "MagickCore/studio.h"
25#include "MagickWand/MagickWand.h"
26#include "MagickWand/operation.h"
27
28int main(int argc, char **argv)
29{
30 MagickCLI
31 *cli_wand;
32
33 MagickCoreGenesis(argv[0],MagickFalse);
34
cristyf432c632014-12-07 15:11:28 +000035 cli_wand = AcquireMagickCLI((ImageInfo *) NULL,(ExceptionInfo *) NULL);
anthony25247ae2013-03-18 05:05:40 +000036
Tianqian Zhucb5fc1b2020-07-18 20:09:29 +080037 CLIOption (cli_wand, "-size", "100x100");
38 CLIOption (cli_wand, "-read", "xc:red");
39 CLIOption (cli_wand, "(", NULL);
40 CLIOption (cli_wand, "-read", "rose:");
41 CLIOption (cli_wand, "-rotate", "-90", NULL);
42 CLIOption (cli_wand, ")", NULL);
43 CLIOption (cli_wand, "+append", NULL, NULL);
44 CLIOption (cli_wand, "-write", "show:", NULL);
anthony25247ae2013-03-18 05:05:40 +000045
46 /* Note use of 'True' to report all exceptions - including fatals */
47 if ( CLICatchException(cli_wand,MagickTrue) != MagickFalse )
48 fprintf(stderr, "Major Error Detected\n");
49
50 cli_wand = DestroyMagickCLI(cli_wand);
51
52 MagickCoreTerminus();
53}