1
0
mirror of https://github.com/imgproxy/imgproxy.git synced 2025-11-29 23:07:40 +02:00

TIFF support

This commit is contained in:
DarthSim
2019-09-27 17:49:52 +06:00
parent 7d8145360c
commit 5e18d59f80
7 changed files with 170 additions and 5 deletions

29
vips.c
View File

@@ -13,6 +13,9 @@
#define VIPS_SUPPORT_SVG \
(VIPS_MAJOR_VERSION > 8 || (VIPS_MAJOR_VERSION == 8 && VIPS_MINOR_VERSION >= 3))
#define VIPS_SUPPORT_TIFF \
(VIPS_MAJOR_VERSION > 8 || (VIPS_MAJOR_VERSION == 8 && VIPS_MINOR_VERSION >= 6))
#define VIPS_SUPPORT_MAGICK \
(VIPS_MAJOR_VERSION > 8 || (VIPS_MAJOR_VERSION == 8 && VIPS_MINOR_VERSION >= 7))
@@ -79,6 +82,8 @@ vips_type_find_load_go(int imgtype) {
return vips_type_find("VipsOperation", "svgload_buffer");
case (HEIC):
return vips_type_find("VipsOperation", "heifload_buffer");
case (TIFF):
return vips_type_find("VipsOperation", "tiffload_buffer");
}
return 0;
}
@@ -99,6 +104,8 @@ vips_type_find_save_go(int imgtype) {
return vips_type_find("VipsOperation", "magicksave_buffer");
case (HEIC):
return vips_type_find("VipsOperation", "heifsave_buffer");
case (TIFF):
return vips_type_find("VipsOperation", "tiffsave_buffer");
}
return 0;
@@ -164,6 +171,16 @@ vips_heifload_go(void *buf, size_t len, VipsImage **out) {
#endif
}
int
vips_tiffload_go(void *buf, size_t len, VipsImage **out) {
#if VIPS_SUPPORT_TIFF
return vips_tiffload_buffer(buf, len, out, "access", VIPS_ACCESS_SEQUENTIAL, NULL);
#else
vips_error("vips_tiffload_go", "Loading TIFF is not supported (libvips 8.6+ reuired)");
return 1;
#endif
}
int
vips_get_orientation(VipsImage *image) {
#ifdef VIPS_META_ORIENTATION
@@ -485,7 +502,17 @@ vips_heifsave_go(VipsImage *in, void **buf, size_t *len, int quality) {
#if VIPS_SUPPORT_HEIF
return vips_heifsave_buffer(in, buf, len, "Q", quality, NULL);
#else
vips_error("vips_heifsave_go", "Saving HEIF is not supported");
vips_error("vips_heifsave_go", "Saving HEIF is not supported (libvips 8.8+ reuired)");
return 1;
#endif
}
int
vips_tiffsave_go(VipsImage *in, void **buf, size_t *len, int quality) {
#if VIPS_SUPPORT_TIFF
return vips_tiffsave_buffer(in, buf, len, "Q", quality, NULL);
#else
vips_error("vips_tiffsave_go", "Saving TIFF is not supported (libvips 8.6+ reuired)");
return 1;
#endif
}