1
0
mirror of https://github.com/imgproxy/imgproxy.git synced 2024-11-24 08:12:38 +02:00
This commit is contained in:
DarthSim 2020-09-28 15:57:39 +06:00
parent 8ad7d5520e
commit b8f5d4302d
2 changed files with 16 additions and 8 deletions

View File

@ -4,6 +4,9 @@
### Added
- AVIF support.
### Fix
- Fix `dpr` option.
## [2.15.0] - 2020-09-03
### Added
- Ability to skip processing of some formats. See [Skip processing](https://docs.imgproxy.net/#/configuration?id=skip-processing).

View File

@ -353,11 +353,14 @@ func transformImage(ctx context.Context, img *vipsImage, data []byte, po *proces
// Update scale after scale-on-load
newWidth, newHeight, _, _ := extractMeta(img)
widthToScale = scaleInt(widthToScale, float64(newWidth)/float64(srcWidth))
heightToScale = scaleInt(heightToScale, float64(newHeight)/float64(srcHeight))
scale = calcScale(widthToScale, heightToScale, po, imgtype)
if srcWidth > srcHeight {
scale = float64(srcWidth) * scale / float64(newWidth)
} else {
scale = float64(srcHeight) * scale / float64(newHeight)
}
if srcWidth == scaleInt(srcWidth, scale) && srcHeight == scaleInt(srcHeight, scale) {
scale = 1.0
}
}
if err = img.Rad2Float(); err != nil {
@ -365,7 +368,7 @@ func transformImage(ctx context.Context, img *vipsImage, data []byte, po *proces
}
iccImported := false
convertToLinear := conf.UseLinearColorspace && (scale != 1 || po.Dpr != 1)
convertToLinear := conf.UseLinearColorspace && scale != 1
if convertToLinear || !img.IsSRGB() {
if err = img.ImportColourProfile(true); err != nil {
@ -536,8 +539,10 @@ func transformAnimated(ctx context.Context, img *vipsImage, data []byte, po *pro
if nPages, _ := img.GetInt("n-pages"); nPages > 0 {
scale := 1.0
// Don't do scale on load if we need to crop
if po.Crop.Width == 0 && po.Crop.Height == 0 {
// Don't do scale on load if DPR != 1 or we need to crop
// because it causes problems in these cases.
// TODO: Rewrite scaling
if po.Dpr == 1.0 && po.Crop.Width == 0 && po.Crop.Height == 0 {
scale = calcScale(imgWidth, frameHeight, po, imgtype)
}