From efd62acccd8362468e1e20c5d8be3f892d4b758c Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Fri, 24 Apr 2020 19:29:35 +0100 Subject: [PATCH] better iiif tile naming We were clipping edge tiles against the size of the scaled up layer. Instead, clip against the size of the top level image. See https://github.com/libvips/libvips/issues/1621 --- ChangeLog | 3 +++ configure.ac | 6 +++--- libvips/foreign/dzsave.c | 10 ++++++++-- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 494cb001..c464cadb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +24/4/20 started 8.9.3 +- better iiif tile naming [IllyaMoskvin] + 31/1/19 started 8.9.2 - fix a deadlock with --vips-leak [DarthSim] - better gifload behaviour for DISPOSAL_UNSPECIFIED [DarthSim] diff --git a/configure.ac b/configure.ac index 98173c27..c2253ebe 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ # also update the version number in the m4 macros below -AC_INIT([vips], [8.9.2], [vipsip@jiscmail.ac.uk]) +AC_INIT([vips], [8.9.3], [vipsip@jiscmail.ac.uk]) # required for gobject-introspection AC_PREREQ(2.62) @@ -18,7 +18,7 @@ AC_CONFIG_MACRO_DIR([m4]) # user-visible library versioning m4_define([vips_major_version], [8]) m4_define([vips_minor_version], [9]) -m4_define([vips_micro_version], [2]) +m4_define([vips_micro_version], [3]) m4_define([vips_version], [vips_major_version.vips_minor_version.vips_micro_version]) @@ -38,7 +38,7 @@ VIPS_VERSION_STRING=$VIPS_VERSION-`date -u -r ChangeLog` # binary interface changes not backwards compatible?: reset age to 0 LIBRARY_CURRENT=54 -LIBRARY_REVISION=2 +LIBRARY_REVISION=3 LIBRARY_AGE=12 # patched into include/vips/version.h diff --git a/libvips/foreign/dzsave.c b/libvips/foreign/dzsave.c index 3f43ebcb..c022ce1d 100644 --- a/libvips/foreign/dzsave.c +++ b/libvips/foreign/dzsave.c @@ -85,6 +85,8 @@ * - add @no_strip * 9/11/19 * - add IIIF layout + * 24/4/20 [IllyaMoskvin] + * - better IIIF tile naming */ /* @@ -1357,6 +1359,7 @@ static GsfOutput * tile_name( Layer *layer, int x, int y ) { VipsForeignSaveDz *dz = layer->dz; + VipsForeignSave *save = (VipsForeignSave *) dz; GsfOutput *out; char name[VIPS_PATH_MAX]; @@ -1419,13 +1422,16 @@ tile_name( Layer *layer, int x, int y ) { /* Tiles are addressed in full resolution coordinates, so * scale up by layer->sub and dz->tile_size + * + * We always clip against the full-sized image, not the scaled + * up layer. */ int left = x * dz->tile_size * layer->sub; int top = y * dz->tile_size * layer->sub; int width = VIPS_MIN( dz->tile_size * layer->sub, - layer->width * layer->sub - left ); + save->ready->Xsize - left ); int height = VIPS_MIN( dz->tile_size * layer->sub, - layer->height * layer->sub - top ); + save->ready->Ysize - top ); /* IIIF "size" is just real tile width, I think. *