MagickSetExtract() segfaults
Posted: 2014-07-19T23:25:33-07:00
hi.
i'm running the following on macosx 10.9.3, using Fink:
----
Version: ImageMagick 6.8.8-10 Q16 x86_64 2014-04-24 http://www.imagemagick.org
----
i'm trying to use MagickSetExtract() to specify which bits of a large image i want to read. the MagickWand web page says
----
MagickSetExtract() sets the extract geometry before you read or write an image file. Use it for inline cropping (e.g. 200x200+0+0) or resizing (e.g.200x200).
----
which leads me to believe i should call it before calling, e.g., MagickReadImage(). however, i get a segfault when i run the simple program below.
any help would be appreciated.
cheers, Greg Minshall
----
running the following code on my system gives me:
----
bash greg-minshalls-mbp: {1361} ./test 200x200+0+0 ../tests/c-L1001745.png
got image_wand
about to call magicksetextract with 200x200+0+0
Segmentation fault: 11
----
the code:
-----
#include <stdio.h>
#include <wand/MagickWand.h>
int main(int argc, char *argv[]) {
MagickBooleanType status;
MagickWand *image_wand;
char *file, *geometry;
file = "../tests/foo.png"; /* doesn't matter -- doesn't get that far! */
geometry = "200x200+0+0"; /* anything (apparently) will do */
/* Read an image. */
MagickWandGenesis();
image_wand = NewMagickWand();
fprintf(stderr, "got image_wand\n");
if (geometry) {
fprintf(stderr, "about to call magicksetextract with %s\n", geometry);
status = MagickSetExtract(image_wand, geometry);
fprintf(stderr, "return from magicksetextract, status %d\n", status);
if (status == MagickFalse) {
fprintf(stderr, "error from MagickSetExtract\n");
exit(1);
/*NOTREACHED*/
}
}
fprintf(stderr, "about to call magickreadimage\n");
status = MagickReadImage(image_wand, file);
fprintf(stderr, "return from magickreadimage\n");
if (status == MagickFalse) {
fprintf(stderr, "error from MagickReadImage\n");
exit(2);
/*NOTREACHED*/
}
}
i'm running the following on macosx 10.9.3, using Fink:
----
Version: ImageMagick 6.8.8-10 Q16 x86_64 2014-04-24 http://www.imagemagick.org
----
i'm trying to use MagickSetExtract() to specify which bits of a large image i want to read. the MagickWand web page says
----
MagickSetExtract() sets the extract geometry before you read or write an image file. Use it for inline cropping (e.g. 200x200+0+0) or resizing (e.g.200x200).
----
which leads me to believe i should call it before calling, e.g., MagickReadImage(). however, i get a segfault when i run the simple program below.
any help would be appreciated.
cheers, Greg Minshall
----
running the following code on my system gives me:
----
bash greg-minshalls-mbp: {1361} ./test 200x200+0+0 ../tests/c-L1001745.png
got image_wand
about to call magicksetextract with 200x200+0+0
Segmentation fault: 11
----
the code:
-----
#include <stdio.h>
#include <wand/MagickWand.h>
int main(int argc, char *argv[]) {
MagickBooleanType status;
MagickWand *image_wand;
char *file, *geometry;
file = "../tests/foo.png"; /* doesn't matter -- doesn't get that far! */
geometry = "200x200+0+0"; /* anything (apparently) will do */
/* Read an image. */
MagickWandGenesis();
image_wand = NewMagickWand();
fprintf(stderr, "got image_wand\n");
if (geometry) {
fprintf(stderr, "about to call magicksetextract with %s\n", geometry);
status = MagickSetExtract(image_wand, geometry);
fprintf(stderr, "return from magicksetextract, status %d\n", status);
if (status == MagickFalse) {
fprintf(stderr, "error from MagickSetExtract\n");
exit(1);
/*NOTREACHED*/
}
}
fprintf(stderr, "about to call magickreadimage\n");
status = MagickReadImage(image_wand, file);
fprintf(stderr, "return from magickreadimage\n");
if (status == MagickFalse) {
fprintf(stderr, "error from MagickReadImage\n");
exit(2);
/*NOTREACHED*/
}
}