vipsthumbnail fix

fix to vipsthumbnail ... --crop could fail for very non-square images,
thanks Alessandro
This commit is contained in:
John Cupitt 2014-03-18 17:41:39 +00:00
parent df225a97ff
commit 58239a4583
2 changed files with 9 additions and 2 deletions

View File

@ -12,6 +12,7 @@
- vipsthumbnail has --rotate auto-rotate option
- removed embedded thumbnail reader from vipsthumbnail: embedded thumbnails
are too unlike the main image
- fix to vipsthumbnail --crop, thanks Alessandro
6/3/14 started 7.38.6
- grey ramp minimum was wrong

View File

@ -199,13 +199,19 @@ calculate_shrink( VipsImage *im, 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 );