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