From f2576003b79c49800094cd4a4202227a6c527234 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Fri, 18 Aug 2017 22:08:43 +0100 Subject: [PATCH] fix webp upscale in thumbnail we could try to use webp shrink on load to upscale, oops see https://github.com/jcupitt/libvips/issues/710 --- ChangeLog | 1 + libvips/resample/thumbnail.c | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 02917137..d764d9ca 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,7 @@ - fix transparency detection in merge, thanks Haida - define env var VIPS_WARNING to hide warning messages - shut down dzsave output earlier to help mark-sweep bindings +- fix webp thumbnail upscale, thanks Kleis 9/6/17 started 8.5.7 - better smartcrop diff --git a/libvips/resample/thumbnail.c b/libvips/resample/thumbnail.c index 6211aed9..932e17fc 100644 --- a/libvips/resample/thumbnail.c +++ b/libvips/resample/thumbnail.c @@ -254,8 +254,11 @@ vips_thumbnail_open( VipsThumbnail *thumbnail ) g_info( "loading PDF/SVG with factor %g pre-scale", scale ); } else if( vips_isprefix( "VipsForeignLoadWebp", thumbnail->loader ) ) { - shrink = vips_thumbnail_calculate_shrink( thumbnail, - thumbnail->input_width, thumbnail->input_height ); + shrink = VIPS_MAX( 1.0, + vips_thumbnail_calculate_shrink( thumbnail, + thumbnail->input_width, + thumbnail->input_height ) ); + g_info( "loading webp with factor %d pre-shrink", shrink ); }