Last active
August 29, 2015 14:05
-
-
Save vozlt/6fbb0089e02311b60db7 to your computer and use it in GitHub Desktop.
ImageMagick MagickStripImage() API Test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @file: exif-remover.c | |
* @brief: ImageMagick MagickStripImage() API Test | |
* @author: YoungJoo.Kim <http://vozlt.com> | |
* @version: | |
* @date: 20140210 | |
* | |
* | |
* shell> yum install ImageMagick-devel | |
* shell> gcc -o test test.c -I/usr/include/ImageMagick -lMagickWand | |
* shell> ./test test.jpg | |
* | |
**/ | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <wand/magick_wand.h> | |
void usage(char *programName) { | |
printf("Usage: %s [imagePath]\n", programName); | |
exit(1); | |
} | |
int main(int argc, char **argv) { | |
if (argc < 2) usage(argv[0]); | |
char *originalImagePath = argv[1]; | |
char newImagePath[1024]; | |
sprintf(newImagePath, "new.%s", originalImagePath); | |
MagickWand *mw = NULL; | |
MagickBooleanType status; | |
MagickWandGenesis(); | |
mw = NewMagickWand(); | |
/* Read the image */ | |
if(MagickReadImage(mw, originalImagePath) == MagickFalse) { | |
printf("Unable to read image\n"); | |
exit(1); | |
} | |
/* Strip the image */ | |
status = MagickStripImage(mw); | |
if (status == MagickFalse) { | |
printf("Unable to strip image\n"); | |
exit(1); | |
} | |
printf("# Create New Image: %s\n", newImagePath); | |
/* Write the new image */ | |
MagickWriteImage(mw, newImagePath); | |
/* Clean up */ | |
if(mw)mw = DestroyMagickWand(mw); | |
MagickWandTerminus(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment