I have a JPG image that is 3264 x 2448 (2.34 MB) and MagickReadImage() won't load it. It complains:
Code: Select all
test3.c main 22 Empty input file `input.jpg' @ error/jpeg.c/JPEGErrorHandler/318
If I resize it to 800 x 600 with mogrify, it will load.
Here's a simple test program and output illustrating the problem:
Code: Select all
pgg@g550 ~/test
$ ls -l
total 2404
-rw-r--r-- 1 pgg None 2454865 Feb 21 22:13 input.jpg
-rwxr-xr-x 1 pgg None 888 Feb 21 22:13 test3.c
pgg@g550 ~/test
$ cat test3.c
#include <stdio.h>
#include <wand/magick_wand.h>
#define ThrowWandException(wand) \
{ \
char *description; \
ExceptionType severity; \
description=MagickGetException(wand,&severity); \
printf("\n\n-----\n%s %s %lu %s\n",GetMagickModule(),description); \
description=(char *) MagickRelinquishMemory(description); \
exit(-1); \
}
int main() {
MagickWand *mw1 = NULL;
MagickWandGenesis();
mw1 = NewMagickWand();
if( !MagickReadImage( mw1, "input.jpg" ) )
ThrowWandException( mw1 );
MagickWriteImage( mw1, "output.jpg" );
mw1 = DestroyMagickWand(mw1);
MagickWandTerminus();
return 0;
}
/*
gcc test3.c -o test3 -lMagickWand-Q16 -lgdi32 -L/home/pgg/ImageMagick-6.8.1/lib -I/home/pgg/ImageMagick-6.8.1/include/ImageMagick -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16
*/
pgg@g550 ~/test
$ gcc test3.c -o test3 -lMagickWand-Q16 -lgdi32 -L/home/pgg/ImageMagick-6.8.1/lib -I/home/pgg/ImageMagick-6.8.1/include/ImageMagick -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16
pgg@g550 ~/test
$ ./test3.exe
-----
test3.c main 22 Empty input file `input.jpg' @ error/jpeg.c/JPEGErrorHandler/318
pgg@g550 ~/test
$ mogrify -geometry 1024x768 input.jpg
pgg@g550 ~/test
$ ./test3.exe
-----
test3.c main 22 Empty input file `input.jpg' @ error/jpeg.c/JPEGErrorHandler/318
pgg@g550 ~/test
$ mogrify -geometry 800x600 input.jpg
pgg@g550 ~/test
$ ./test3.exe
pgg@g550 ~/test
$ ls -l
total 488
-rw-r--r-- 1 pgg None 220768 Feb 21 22:14 input.jpg
-rw-r--r-- 1 pgg None 220870 Feb 21 22:14 output.jpg
-rwxr-xr-x 1 pgg None 888 Feb 21 22:13 test3.c
-rwxr-xr-x 1 pgg None 52766 Feb 21 22:14 test3.exe