|
@@ -18,7 +18,11 @@ func importColorProfile(pctx *pipelineContext, img *vips.Image, po *options.Proc
|
|
|
|
|
|
convertToLinear := config.UseLinearColorspace && (pctx.wscale != 1 || pctx.hscale != 1)
|
|
|
|
|
|
- if convertToLinear || !img.IsRGB() {
|
|
|
+ if img.IsLinear() {
|
|
|
+ // The image is linear. If we keep its ICC, we'll get wrong colors after
|
|
|
+ // converting it to sRGB
|
|
|
+ img.RemoveColourProfile()
|
|
|
+ } else if convertToLinear || !img.IsRGB() {
|
|
|
if err := img.ImportColourProfile(); err != nil {
|
|
|
return err
|
|
|
}
|