CalcCropSize calculates the crop size based on the original size and crop scale.
(orig int, crop float64)
| 54 | |
| 55 | // CalcCropSize calculates the crop size based on the original size and crop scale. |
| 56 | func CalcCropSize(orig int, crop float64) int { |
| 57 | switch { |
| 58 | case crop == 0.0: |
| 59 | return 0 |
| 60 | case crop >= 1.0: |
| 61 | return int(crop) |
| 62 | default: |
| 63 | return max(1, imath.Scale(orig, crop)) |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | func (c *Context) calcScale(width, height int, po ProcessingOptions) { |
| 68 | wshrink, hshrink := 1.0, 1.0 |