mirror of
https://github.com/imgproxy/imgproxy.git
synced 2025-10-05 11:19:45 +02:00
Disable processing in linear colorspace by default
This commit is contained in:
@@ -152,6 +152,7 @@ type config struct {
|
|||||||
EnforceWebp bool
|
EnforceWebp bool
|
||||||
EnableClientHints bool
|
EnableClientHints bool
|
||||||
|
|
||||||
|
UseLinearColorspace bool
|
||||||
DisableShrinkOnLoad bool
|
DisableShrinkOnLoad bool
|
||||||
|
|
||||||
Keys []securityKey
|
Keys []securityKey
|
||||||
@@ -269,6 +270,7 @@ func init() {
|
|||||||
boolEnvConfig(&conf.EnforceWebp, "IMGPROXY_ENFORCE_WEBP")
|
boolEnvConfig(&conf.EnforceWebp, "IMGPROXY_ENFORCE_WEBP")
|
||||||
boolEnvConfig(&conf.EnableClientHints, "IMGPROXY_ENABLE_CLIENT_HINTS")
|
boolEnvConfig(&conf.EnableClientHints, "IMGPROXY_ENABLE_CLIENT_HINTS")
|
||||||
|
|
||||||
|
boolEnvConfig(&conf.UseLinearColorspace, "IMGPROXY_USE_LINEAR_COLORSPACE")
|
||||||
boolEnvConfig(&conf.DisableShrinkOnLoad, "IMGPROXY_DISABLE_SHRINK_ON_LOAD")
|
boolEnvConfig(&conf.DisableShrinkOnLoad, "IMGPROXY_DISABLE_SHRINK_ON_LOAD")
|
||||||
|
|
||||||
hexEnvConfig(&conf.Keys, "IMGPROXY_KEY")
|
hexEnvConfig(&conf.Keys, "IMGPROXY_KEY")
|
||||||
|
@@ -200,4 +200,5 @@ imgproxy can send logs to syslog, but this feature is disabled by default. To en
|
|||||||
### Miscellaneous
|
### Miscellaneous
|
||||||
|
|
||||||
* `IMGPROXY_BASE_URL`: base URL prefix that will be added to every requested image URL. For example, if the base URL is `http://example.com/images` and `/path/to/image.png` is requested, imgproxy will download the source image from `http://example.com/images/path/to/image.png`. Default: blank.
|
* `IMGPROXY_BASE_URL`: base URL prefix that will be added to every requested image URL. For example, if the base URL is `http://example.com/images` and `/path/to/image.png` is requested, imgproxy will download the source image from `http://example.com/images/path/to/image.png`. Default: blank.
|
||||||
|
* `IMGPROXY_USE_LINEAR_COLORSPACE`: when `true`, imgproxy will process images in linear colorspace. This will slow down processing. Note that images won't be fully processed in linear colorspace while shrink-on-load is enabled (see below).
|
||||||
* `IMGPROXY_DISABLE_SHRINK_ON_LOAD`: when `true`, disables shrink-on-load for JPEG and WebP. Allows to process the whole image in linear colorspace but dramatically slows down resizing and increases memory usage when working with large images.
|
* `IMGPROXY_DISABLE_SHRINK_ON_LOAD`: when `true`, disables shrink-on-load for JPEG and WebP. Allows to process the whole image in linear colorspace but dramatically slows down resizing and increases memory usage when working with large images.
|
||||||
|
@@ -316,7 +316,7 @@ func transformImage(ctx context.Context, img **C.VipsImage, data []byte, po *pro
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
convertToLinear := scale != 1 || po.Dpr != 1
|
convertToLinear := conf.UseLinearColorspace && (scale != 1 || po.Dpr != 1)
|
||||||
|
|
||||||
if convertToLinear {
|
if convertToLinear {
|
||||||
if err = vipsLinearColourspace(img); err != nil {
|
if err = vipsLinearColourspace(img); err != nil {
|
||||||
|
Reference in New Issue
Block a user