1 /* Copyright (C) GraphicsMagick Group 2002 - 2022 */
2 import core
.stdc
.stdio
;
3 import core
.stdc
.string
;
5 import graphicsmagick_c
.config
;
6 import graphicsmagick_c
.magick
;
8 extern (C
) int main(int argc
, char** argv
)
12 char[MaxTextExtent
] infile
;
13 char[MaxTextExtent
] outfile
;
20 ExceptionInfo exception
;
22 version(GMagick_Static
) {}
26 bool success
= loadGraphicsMagick(libgm
);
28 puts("Successfully loaded GraphicsMagick!\n");
30 puts("Loaded GraphicsMagick with some errors!\n");
34 InitializeMagick(null);
35 imageInfo
= CloneImageInfo(null);
36 GetExceptionInfo(&exception
);
39 fprintf(stderr
, "Usage: %s infile outfile\n", argv
[0]);
45 // array.ptr and &array[0] are the same thing
46 strncpy(infile
.ptr
, argv
[arg
], MaxTextExtent
-1);
48 strncpy(&outfile
[0], argv
[arg
], MaxTextExtent
-1);
50 strcpy(imageInfo
.filename
.ptr
, infile
.ptr
);
51 image
= ReadImage(imageInfo
, &exception
);
53 CatchException(&exception
);
58 strcpy(image
.filename
.ptr
, outfile
.ptr
);
59 if (!WriteImage(imageInfo
, image
)) {
60 CatchException(&exception
);
70 if (imageInfo
!is null)
71 DestroyImageInfo(imageInfo
);