blob: 1b973458501774e5792b655d8c015235aa89db03 [file] [log] [blame]
anthony25247ae2013-03-18 05:05:40 +00001/*
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 in 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
27int main(int argc, char **argv)
28{
29 MagickCoreGenesis(argv[0],MagickFalse);
30
31 {
32 MagickBooleanType status;
33
34 ImageInfo *image_info = AcquireImageInfo();
35 ExceptionInfo *exception = AcquireExceptionInfo();
36
37 int arg_count;
38 char *args[] = { "magick", "-size", "100x100", "xc:red",
39 "(", "rose:", "-rotate", "-90", ")",
40 "+append", "show:", NULL };
41
cristyf432c632014-12-07 15:11:28 +000042 for(arg_count = 0; args[arg_count] != (char *) NULL; arg_count++);
anthony25247ae2013-03-18 05:05:40 +000043
44 (void) MagickImageCommand(image_info, arg_count, args, NULL, exception);
45
46 if (exception->severity != UndefinedException)
47 {
48 CatchException(exception);
49 fprintf(stderr, "Major Error Detected\n");
50 }
51
52 image_info=DestroyImageInfo(image_info);
53 exception=DestroyExceptionInfo(exception);
54 }
55 MagickCoreTerminus();
56}