1
0
mirror of https://github.com/imgproxy/imgproxy.git synced 2025-12-09 23:41:58 +02:00

Fix max_bytes option

This commit is contained in:
DarthSim
2023-04-19 17:20:32 +03:00
parent 4fae754071
commit 1da86887d4

View File

@@ -209,6 +209,10 @@ func saveImageToFitBytes(ctx context.Context, po *options.ProcessingOptions, img
var diff float64
quality := po.GetQuality()
if err := img.CopyMemory(); err != nil {
return nil, err
}
for {
imgdata, err := img.Save(po.Format, quality)
if err != nil || len(imgdata.Data) <= po.MaxBytes || quality <= 10 {