summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--magick.c74
1 files changed, 39 insertions, 35 deletions
diff --git a/magick.c b/magick.c
index 444dd02..ea1540d 100644
--- a/magick.c
+++ b/magick.c
@@ -56,50 +56,54 @@ static Bool magickFileToImage (
int len;
MAGICK_DISPLAY(d);
-
- len = (path ? strlen(path) : 0) + strlen(name) + 1;
- file = malloc(len);
-
- if (file)
+
+ if (name && strstr(name,"."))
{
- MagickWand *wand;
- MagickBooleanType result;
-
- if (path)
- sprintf(file, "%s/%s", path, name);
- else
- sprintf(file, "%s", name);
-
- wand = NewMagickWand ();
-
- result = MagickReadImage (wand, file);
-
- if (result != MagickFalse)
+
+ len = (path ? strlen(path) : 0) + strlen(name) + 1;
+ file = malloc(len);
+
+ if (file)
{
- *width = MagickGetImageWidth (wand);
- *height = MagickGetImageHeight(wand);
-
- *data = malloc (*width * *height * 4);
- if (*data)
+ MagickWand *wand;
+ MagickBooleanType result;
+
+ if (path)
+ sprintf(file, "%s/%s", path, name);
+ else
+ sprintf(file, "%s", name);
+
+ wand = NewMagickWand ();
+
+ result = MagickReadImage (wand, file);
+
+ if (result != MagickFalse)
{
- MagickGetImagePixels(wand, 0,0, *width, *height, "BGRA", CharPixel, *data);
- *stride = *width * 4;
-
- free (file);
- wand = DestroyMagickWand (wand);
- return TRUE;
+ *width = MagickGetImageWidth (wand);
+ *height = MagickGetImageHeight(wand);
+
+ *data = malloc (*width * *height * 4);
+ if (*data)
+ {
+ MagickGetImagePixels(wand, 0,0, *width, *height, "BGRA", CharPixel, *data);
+ *stride = *width * 4;
+
+ free (file);
+ wand = DestroyMagickWand (wand);
+ return TRUE;
+ }
}
+
+
+ free (file);
+ wand = DestroyMagickWand (wand);
}
-
-
- free (file);
- wand = DestroyMagickWand (wand);
}
-
+
UNWRAP (md, d, fileToImage);
status = (*d->fileToImage) (d, path, name, width, height, stride, data);
WRAP (md, d, fileToImage, magickFileToImage);
-
+
return status;
}