summaryrefslogtreecommitdiff
path: root/Build/source/libs/gd/libgd-2.1.0-rc1/examples/tiffread.c
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2013-06-24 09:01:02 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2013-06-24 09:01:02 +0000
commitcd573af8ce5db24aae95c942b2ba505ca0a3338f (patch)
treeac38fcc8f72bccacd785ca6f74835e1f976334e1 /Build/source/libs/gd/libgd-2.1.0-rc1/examples/tiffread.c
parent6c998f4d3d5f21632bc1d2c87073afa9e6b9fc70 (diff)
gd 2.1.0-rc1 (libgd)
git-svn-id: svn://tug.org/texlive/trunk@30886 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/libs/gd/libgd-2.1.0-rc1/examples/tiffread.c')
-rw-r--r--Build/source/libs/gd/libgd-2.1.0-rc1/examples/tiffread.c59
1 files changed, 59 insertions, 0 deletions
diff --git a/Build/source/libs/gd/libgd-2.1.0-rc1/examples/tiffread.c b/Build/source/libs/gd/libgd-2.1.0-rc1/examples/tiffread.c
new file mode 100644
index 00000000000..fe63ce00b2c
--- /dev/null
+++ b/Build/source/libs/gd/libgd-2.1.0-rc1/examples/tiffread.c
@@ -0,0 +1,59 @@
+/* $Id$ */
+/*
+ * You can fetch a set of samples TIFF images here:
+ * ftp://ftp.remotesensing.org/pub/libtiff/
+ * (pics-x.y.z.tar.gz)
+ */
+
+#include <gd.h>
+#include <stdio.h>
+#include <stdlib.h>
+int main()
+{
+ gdImagePtr im;
+ FILE *fp;
+ char path[9][2048];
+ int i;
+ char dst[2048];
+
+ sprintf(path[0], "cramps-tile.tif");
+ sprintf(path[1], "cramps.tif");
+ sprintf(path[2], "ycbcr-cat.tif");
+ sprintf(path[3], "jello.tif");
+ sprintf(path[4], "caspian.tif");
+ sprintf(path[5], "strike.tif");
+ sprintf(path[6], "off_luv24.tif");
+ sprintf(path[7], "off_l16.tif");
+ sprintf(path[8], "fax2d.tif");
+
+ for (i = 0; i < 9; i++) {
+ printf("opening %s\n", path[i]);
+ fp = fopen(path[i], "rb");
+ if (!fp) {
+ printf("failed, cannot open file\n");
+ return 1;
+ }
+
+ im = gdImageCreateFromTiff(fp);
+ fclose(fp);
+ if (!im) {
+ fprintf(stderr, "Can't load TIFF image %s\n", path[i]);
+ return 1;
+ }
+
+
+ sprintf(dst, "%i.png", i);
+
+ fp = fopen(dst, "wb");
+ if (!fp) {
+ fprintf(stderr, "Can't save png image fromtiff.png\n");
+ gdImageDestroy(im);
+ return 1;
+ }
+
+ gdImagePng(im, fp);
+ fclose(fp);
+ gdImageDestroy(im);
+ }
+ return 0;
+}