summaryrefslogtreecommitdiff
path: root/source/fitz
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2016-02-23 12:29:32 +0100
committerTor Andersson <tor.andersson@artifex.com>2016-02-24 13:12:18 +0100
commita24dd0ec500ecdaf808822ab67c59213898c12f1 (patch)
treefbf162c8d2bb33094551b8d8f122cfffcd9c8a8b /source/fitz
parenta9043b470ba26fc5ec06e1d44ae8e9480d75724a (diff)
downloadmupdf-a24dd0ec500ecdaf808822ab67c59213898c12f1.tar.xz
Add fz_new_image_from_file.
Diffstat (limited to 'source/fitz')
-rw-r--r--source/fitz/image.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/source/fitz/image.c b/source/fitz/image.c
index 59e2ab56..a2f4bed2 100644
--- a/source/fitz/image.c
+++ b/source/fitz/image.c
@@ -545,6 +545,23 @@ fz_new_image_from_buffer(fz_context *ctx, fz_buffer *buffer)
return fz_new_image(ctx, w, h, 8, cspace, xres, yres, 0, 0, NULL, NULL, bc, NULL);
}
+fz_image *
+fz_new_image_from_file(fz_context *ctx, const char *path)
+{
+ fz_buffer *buffer;
+ fz_image *image;
+
+ buffer = fz_read_file(ctx, path);
+ fz_try(ctx)
+ image = fz_new_image_from_buffer(ctx, buffer);
+ fz_always(ctx)
+ fz_drop_buffer(ctx, buffer);
+ fz_catch(ctx)
+ fz_rethrow(ctx);
+
+ return image;
+}
+
void
fz_image_resolution(fz_image *image, int *xres, int *yres)
{