You've already forked imgproxy
mirror of
https://github.com/imgproxy/imgproxy.git
synced 2025-11-27 22:48:53 +02:00
Reduce memory usage when scaling down animated images
This commit is contained in:
@@ -14,6 +14,7 @@
|
|||||||
- Don't set `Expires` HTTP header as it is ignored if the `Cache-Control` header is set.
|
- Don't set `Expires` HTTP header as it is ignored if the `Cache-Control` header is set.
|
||||||
- Don't log health-check requests and responses.
|
- Don't log health-check requests and responses.
|
||||||
- Enforce `IMGPROXY_WORKERS=1` when running in AWS Lambda.
|
- Enforce `IMGPROXY_WORKERS=1` when running in AWS Lambda.
|
||||||
|
- Reduce memory usage when scaling down animated images.
|
||||||
- (pro) If the `step` argument of the `video_thumbnail_tile` is negative, calculate `step` automatically.
|
- (pro) If the `step` argument of the `video_thumbnail_tile` is negative, calculate `step` automatically.
|
||||||
|
|
||||||
### Fix
|
### Fix
|
||||||
|
|||||||
@@ -162,6 +162,16 @@ func transformAnimated(ctx context.Context, img *vips.Image, po *options.Process
|
|||||||
if err = mainPipeline.Run(ctx, frame, po, nil); err != nil {
|
if err = mainPipeline.Run(ctx, frame, po, nil); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if r, _ := frame.GetIntDefault("imgproxy-scaled-down", 0); r == 1 {
|
||||||
|
if err = frame.CopyMemory(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if err = router.CheckTimeout(ctx); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = img.Arrayjoin(frames); err != nil {
|
if err = img.Arrayjoin(frames); err != nil {
|
||||||
|
|||||||
@@ -804,7 +804,7 @@ vips_strip(VipsImage *in, VipsImage **out, int keep_exif_copyright)
|
|||||||
(strcmp(name, "vips-loader") == 0) ||
|
(strcmp(name, "vips-loader") == 0) ||
|
||||||
(strcmp(name, "background") == 0) ||
|
(strcmp(name, "background") == 0) ||
|
||||||
(strcmp(name, "vips-sequential") == 0) ||
|
(strcmp(name, "vips-sequential") == 0) ||
|
||||||
(strcmp(name, "imgproxy-dpr-scale") == 0))
|
(vips_isprefix("imgproxy-", name)))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (keep_exif_copyright) {
|
if (keep_exif_copyright) {
|
||||||
|
|||||||
@@ -606,6 +606,10 @@ func (img *Image) Resize(wscale, hscale float64) error {
|
|||||||
return Error()
|
return Error()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if wscale < 1.0 || hscale < 1.0 {
|
||||||
|
C.vips_image_set_int(tmp, cachedCString("imgproxy-scaled-down"), 1)
|
||||||
|
}
|
||||||
|
|
||||||
C.swap_and_clear(&img.VipsImage, tmp)
|
C.swap_and_clear(&img.VipsImage, tmp)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
Reference in New Issue
Block a user