Index: trunk/extensions/VipsScaler/VipsScaler_body.php |
— | — | @@ -48,13 +48,16 @@ |
49 | 49 | # Set the new rotated file |
50 | 50 | $tmp = $tmp2; |
51 | 51 | } |
| 52 | + |
| 53 | + # Calculate shrink factors. Offsetting by 0.5 pixels is required |
| 54 | + # because of rounding down of the target size by VIPS. See 25990#c7 |
52 | 55 | if ( $rotation % 180 == 90 ) { |
53 | 56 | # Rotated 90 degrees, so width = height and vice versa |
54 | | - $rx = $params['srcWidth'] / $params['physicalHeight']; |
55 | | - $ry = $params['srcHeight'] / $params['physicalWidth']; |
| 57 | + $rx = $params['srcWidth'] / ($params['physicalHeight'] + 0.5); |
| 58 | + $ry = $params['srcHeight'] / ($params['physicalWidth'] + 0.5); |
56 | 59 | } else { |
57 | | - $rx = $params['srcWidth'] / $params['physicalWidth']; |
58 | | - $ry = $params['srcHeight'] / $params['physicalHeight']; |
| 60 | + $rx = $params['srcWidth'] / ($params['physicalWidth'] + 0.5); |
| 61 | + $ry = $params['srcHeight'] / ($params['physicalHeight'] + 0.5); |
59 | 62 | } |
60 | 63 | |
61 | 64 | # Scale the image to the final output |