fix vipsthumbnail crop with very non-square images
thanks Alessandro
This commit is contained in:
parent
62307d18ef
commit
88769d0e74
@ -152,13 +152,19 @@ calculate_shrink( int width, int height, double *residual )
|
|||||||
int shrink = floor( factor2 );
|
int shrink = floor( factor2 );
|
||||||
|
|
||||||
if( residual ) {
|
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 iwidth = width / shrink;
|
||||||
|
int iheight = height / shrink;
|
||||||
|
|
||||||
/* Therefore residual scale factor is.
|
/* 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 );
|
return( shrink );
|
||||||
|
Loading…
Reference in New Issue
Block a user