From 88769d0e749ae2d0704386cca8876092c500e348 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Tue, 18 Mar 2014 19:47:22 +0000 Subject: [PATCH 1/5] fix vipsthumbnail crop with very non-square images thanks Alessandro --- tools/vipsthumbnail.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tools/vipsthumbnail.c b/tools/vipsthumbnail.c index f7150551..69b1b8ed 100644 --- a/tools/vipsthumbnail.c +++ b/tools/vipsthumbnail.c @@ -152,13 +152,19 @@ calculate_shrink( int width, int height, double *residual ) int shrink = floor( factor2 ); if( residual ) { - /* Width after int shrink. + /* Size after int shrink. We have to try with both axes since + * if they are very different sizes we'll see different + * rounding errors. */ int iwidth = width / shrink; + int iheight = height / shrink; /* Therefore residual scale factor is. */ - *residual = (width / factor) / iwidth; + double hresidual = (width / factor) / iwidth; + double vresidual = (height / factor) / iheight; + + *residual = VIPS_MAX( hresidual, vresidual ); } return( shrink ); From ffd61773c40a089332e566e88e74040b8eb9b5bf Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Tue, 18 Mar 2014 21:20:57 +0000 Subject: [PATCH 2/5] changelog update too --- ChangeLog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ChangeLog b/ChangeLog index eabcd4b6..85524960 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 6/3/14 started 7.38.6 - grey ramp minimum was wrong +- vipsthumbnail --crop could fail for very non-square images, thanks + Alessandro 24/2/14 started 7.38.5 - jpeg load from buffer could write to input, thanks Lovell From 5f0f188659eec21f55ae41650cf8aace603329df Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Fri, 28 Mar 2014 09:48:27 +0000 Subject: [PATCH 3/5] drop the default max operations the cache defaulted to 10,000 operations, fine for nip2, not fine for batch-style applications thanks Rafael --- ChangeLog | 1 + libvips/iofuncs/cache.c | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index c98df350..180de982 100644 --- a/ChangeLog +++ b/ChangeLog @@ -13,6 +13,7 @@ - removed embedded thumbnail reader from vipsthumbnail: embedded thumbnails are too unlike the main image - fix to vipsthumbnail --crop, thanks Alessandro +- reduce default cache size to 1,000 operations 6/3/14 started 7.38.6 - grey ramp minimum was wrong diff --git a/libvips/iofuncs/cache.c b/libvips/iofuncs/cache.c index b25f5949..40cdbcdc 100644 --- a/libvips/iofuncs/cache.c +++ b/libvips/iofuncs/cache.c @@ -77,10 +77,12 @@ char *vips__cache_max_files = NULL; gboolean vips__cache_dump = FALSE; gboolean vips__cache_trace = FALSE; -/* Max number of cached operations. We are likely to trim due to memuse or - * file use before we hit this limit. +/* Max number of cached operations. + * + * It was 10,000, but this was too high for batch-style applications with + * little reuse. */ -static int vips_cache_max = 10000; +static int vips_cache_max = 1000; /* How many tracked open files we allow before we start dropping cache. */ From bc79cb4f623fe8f6608cc00c27f6325b1c753817 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Sun, 30 Mar 2014 15:23:55 +0100 Subject: [PATCH 4/5] crash-causing typo in vips_rawsave() thanks Alessandro --- ChangeLog | 1 + libvips/foreign/rawsave.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 85524960..58c5338d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,7 @@ - grey ramp minimum was wrong - vipsthumbnail --crop could fail for very non-square images, thanks Alessandro +- fix a crash in vips_rawsave(), thanks Alessandro 24/2/14 started 7.38.5 - jpeg load from buffer could write to input, thanks Lovell diff --git a/libvips/foreign/rawsave.c b/libvips/foreign/rawsave.c index 0ab34125..14679878 100644 --- a/libvips/foreign/rawsave.c +++ b/libvips/foreign/rawsave.c @@ -174,7 +174,7 @@ vips_rawsave( VipsImage *in, const char *filename, ... ) int result; va_start( ap, filename ); - result = vips_call_split( "rawsave", ap, filename ); + result = vips_call_split( "rawsave", ap, in, filename ); va_end( ap ); return( result ); From 10354be6c33fbe38e7343762ca15c3f38e3554ab Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Sun, 30 Mar 2014 15:26:36 +0100 Subject: [PATCH 5/5] ooops, sorry Andrea --- ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 58c5338d..a6d49c70 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,7 +2,7 @@ - grey ramp minimum was wrong - vipsthumbnail --crop could fail for very non-square images, thanks Alessandro -- fix a crash in vips_rawsave(), thanks Alessandro +- fix a crash in vips_rawsave(), thanks Andrea 24/2/14 started 7.38.5 - jpeg load from buffer could write to input, thanks Lovell