How to get Image information...
Posted: 2017-01-02T17:13:45-07:00
Hello.
I'm a newbie and trying to use some get functions.
But some get functions return right values, some return nothing.
Output of execution is following..........
Format:
filename:
width=4128
MagickGetFormat and MagickGetFilename return something strange and not null. MagickGetImageWidth returns a right thing.
Please let me know what to do...
Thanks in advance...
I'm a newbie and trying to use some get functions.
But some get functions return right values, some return nothing.
Code: Select all
#include <stdio.h>
#include <stdlib.h>
#include <MagickWand/MagickWand.h>
void test_wand(void)
{
MagickWand *mw = NULL;
MagickBooleanType status;
int width;
char *outStr;
MagickWandGenesis();
mw = NewMagickWand();
status = MagickReadImage(mw,"20170102_130111.jpg");
if (status == MagickFalse) ThrowWandException(mw);
outStr = (char *)MagickGetFormat(mw);
if(outStr == NULL) {
printf("Format is NULL\n");
ThrowWandException(mw);
}
printf("Format: %s\n", outStr);
outStr = (char *)MagickGetFilename((const)mw);
if(outStr == NULL) {
printf("filename is NULL\n");
ThrowWandException(mw);
}
printf("filename: %s\n", outStr);
printf("width=%d\n", MagickGetImageWidth(mw));
if(mw) mw = DestroyMagickWand(mw);
MagickWandTerminus();
}
Format:
filename:
width=4128
MagickGetFormat and MagickGetFilename return something strange and not null. MagickGetImageWidth returns a right thing.
Please let me know what to do...
Thanks in advance...