1
0
mirror of https://github.com/imgproxy/imgproxy.git synced 2024-11-29 08:22:11 +02:00

Optimize memory usage

This commit is contained in:
DarthSim 2020-04-22 19:02:50 +06:00
parent 13546aa405
commit a18dbf76f0

View File

@ -383,23 +383,21 @@ func transformImage(ctx context.Context, img *vipsImage, data []byte, po *proces
}
}
if err = img.CopyMemory(); err != nil {
return err
}
checkTimeout(ctx)
if angle != vipsAngleD0 || flip {
if err = img.CopyMemory(); err != nil {
if angle != vipsAngleD0 {
if err = img.Rotate(angle); err != nil {
return err
}
}
if angle != vipsAngleD0 {
if err = img.Rotate(angle); err != nil {
return err
}
}
if flip {
if err = img.Flip(); err != nil {
return err
}
if flip {
if err = img.Flip(); err != nil {
return err
}
}
@ -433,6 +431,12 @@ func transformImage(ctx context.Context, img *vipsImage, data []byte, po *proces
}
}
if err = img.CopyMemory(); err != nil {
return err
}
checkTimeout(ctx)
if po.Blur > 0 {
if err = img.Blur(po.Blur); err != nil {
return err