1 /*
2 Direct call to MagickImageCommand(),
3 which is basically what the "magick" command does via
4 a wrapper function MagickCommandGenesis()
5
6 Compile with ImageMagick-devlop installed...
7
8 gcc -lMagickWand -lMagickCore magick_command.c -o magick_command
9
10 Compile and run directly from Source Directory...
11
12 IM_PROG=api_examples/magick_command
13 gcc -I`pwd` -LMagickWand/.libs -LMagickCore/.libs \
14 -lMagickWand -lMagickCore $IM_PROG.c -o $IM_PROG
15
16 sh ./magick.sh $IM_PROG
17
18 */
19 #include <stdio.h>
20 #include "MagickCore/studio.h"
21 #include "MagickCore/exception.h"
22 #include "MagickCore/exception-private.h"
23 #include "MagickCore/image.h"
24 #include "MagickWand/MagickWand.h"
25 #include "MagickWand/magick-cli.h"
26
main(int argc,char ** argv)27 int main(int argc, char **argv)
28 {
29 MagickCoreGenesis(argv[0],MagickFalse);
30
31 {
32
33 ImageInfo *image_info = AcquireImageInfo();
34 ExceptionInfo *exception = AcquireExceptionInfo();
35
36 int arg_count;
37 char *args[] = { "magick", "-size", "100x100", "xc:red",
38 "(", "rose:", "-rotate", "-90", ")",
39 "+append", "show:", NULL };
40
41 for(arg_count = 0; args[arg_count] != (char *) NULL; arg_count++);
42
43 (void) MagickImageCommand(image_info, arg_count, args, NULL, exception);
44
45 if (exception->severity != UndefinedException)
46 {
47 CatchException(exception);
48 fprintf(stderr, "Major Error Detected\n");
49 }
50
51 image_info=DestroyImageInfo(image_info);
52 exception=DestroyExceptionInfo(exception);
53 }
54 MagickCoreTerminus();
55 }
56