diff --git a/ChangeLog b/ChangeLog index da8305fb..6877339c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -30,6 +30,7 @@ - vector path for convolution is more accurate and can handle larger masks - linear and cubic kernels for reduce are higer quality - added vips_value_set_blob_free() +- "--size Nx" to vipsthumbnail was broken, thanks jrochkind 29/8/17 started 8.5.9 - make --fail stop jpeg read on any libjpeg warning, thanks @mceachen diff --git a/tools/vipsthumbnail.c b/tools/vipsthumbnail.c index b14b9972..961d447d 100644 --- a/tools/vipsthumbnail.c +++ b/tools/vipsthumbnail.c @@ -94,6 +94,8 @@ * - add ! geo modifier * 30/8/17 * - add --intent + * 23/10/17 + * - --size Nx didn't work, argh ... thanks jrochkind */ #ifdef HAVE_CONFIG_H @@ -310,6 +312,7 @@ thumbnail_parse_geometry( const char *geometry ) */ const char *p; + gboolean had_x; /* w or h missing means replace with a huuuge value to prevent * reduction or enlargement in that axis. @@ -324,13 +327,8 @@ thumbnail_parse_geometry( const char *geometry ) while( isspace( *p ) ) p++; if( isdigit ( *p ) ) { - /* We have a number! vipsthumbnail history means that "-s 200" - * means "200x200", not "200xhuge" - */ - thumbnail_width = thumbnail_height = atoi( p ); + thumbnail_width = atoi( p ); - /* And skip over it. - */ while( isdigit( *p ) ) p++; } @@ -339,8 +337,11 @@ thumbnail_parse_geometry( const char *geometry ) */ while( isspace( *p ) ) p++; - if( *p == 'x' ) + had_x = FALSE; + if( *p == 'x' ) { p += 1; + had_x = TRUE; + } while( isspace( *p ) ) p++; @@ -370,6 +371,12 @@ thumbnail_parse_geometry( const char *geometry ) return( -1 ); } + /* If there was no 'x' we have just width. vipsthumbnail history means + * this is a square bounding box. + */ + if( !had_x ) + thumbnail_height = thumbnail_width; + /* If force is set and one of width or height isn't set, copy from the * one that is. */