1
0
mirror of https://github.com/imgproxy/imgproxy.git synced 2025-10-30 23:08:02 +02:00

Fix trimming of CMYK images

This commit is contained in:
DarthSim
2022-06-23 17:59:04 +06:00
parent a44e8dc94b
commit 7a5074187e
4 changed files with 39 additions and 18 deletions

View File

@@ -8,6 +8,10 @@ import (
)
func importColorProfile(pctx *pipelineContext, img *vips.Image, po *options.ProcessingOptions, imgdata *imagedata.ImageData) error {
if pctx.iccImported {
return nil
}
if err := img.Rad2Float(); err != nil {
return err
}

View File

@@ -11,6 +11,11 @@ func trim(pctx *pipelineContext, img *vips.Image, po *options.ProcessingOptions,
return nil
}
// We need to import color profile before trim
if err := importColorProfile(pctx, img, po, imgdata); err != nil {
return err
}
if err := img.Trim(po.Trim.Threshold, po.Trim.Smart, po.Trim.Color, po.Trim.EqualHor, po.Trim.EqualVer); err != nil {
return err
}