Skip to content

CMYK roundtrip via pipelineColourspace should not convert to sRGB internally #3620

Description

@Aminelahlou

Possible bug

With the code I provided in this repo https://github.com/Aminelahlou/sharpCmykTest we can see that color conversion happens even if I stated that pipelinecolorspace is cmyk and to colorspace is cmyk.

when I launch my script (as described below and in the git repo I made, I should get an image full of C:100 M:0 Y:0 K:0 values (same values than input image)

But here is the current behaviour:
When I launch node test-sharp.js I get a new image with values of C: 66 M: 18 Y:0 K:1

maybe I don't understand the docs but it seems sharp is doing a conversion here (either CMYK => (s)RGB => CMYK or CMYK=> CMYK) maybe there is also something I didn't understand in the docs but i have searched in issue 218 and did not found any answer.

Is this a possible bug in a feature of sharp, unrelated to installation?

  • Running npm install sharp completes without error.
  • Running node -e "require('sharp')" completes without error.

If you cannot confirm both of these, please open an installation issue instead.

Are you using the latest version of sharp?

  • I am using the latest version of sharp as reported by npm view sharp dist-tags.latest.

npm view sharp dist-tags.latest gives me 0.32 and in package-lock:

"sharp": {
"version": "0.32.0"
...
}

If you cannot confirm this, please upgrade to the latest version and try again before opening an issue.

If you are using another package which depends on a version of sharp that is not the latest, please open an issue against that package instead.

What is the output of running npx envinfo --binaries --system --npmPackages=sharp --npmGlobalPackages=sharp?

npx: installed 1 in 3.391s

  System:
    OS: Windows 10 10.0.19044
    CPU: (8) x64 Intel(R) Core(TM) i7-9700 CPU @ 3.00GHz
    Memory: 4.07 GB / 15.81 GB
  Binaries:
    Node: 14.15.1 - C:\Program Files\nodejs\node.EXE
    npm: 6.14.8 - C:\Program Files\nodejs\npm.CMD

What are the steps to reproduce?

Code:

const sharp = require("sharp");

const sharpInstance = sharp("./input/test-sharp-input.tif")
  .pipelineColourspace("cmyk")
  .toColourspace("cmyk")
  .toFile("./output/test-sharp-output.tif");

"./input/test-sharp-input.tif" contains a tiff image without any profile and full of CMYK pixel with Cyan value of 100 (other values are 0)
I have made a public repository at https://github.com/Aminelahlou/sharpCmykTest

What is the expected behaviour?

I should not make any color conversion wether SRGB=> CMYK CMYK=> CMYK or CMYK => SRGB.
and when I launch npm i and then node test-sharp.js I should get a new image in the output folder with exact same value which are Cyan:100 M:0 Y:0 K:0

Please provide a minimal, standalone code sample, without other dependencies, that demonstrates this problem

https://github.com/Aminelahlou/sharpCmykTest

const sharp = require("sharp");

const sharpInstance = sharp("./input/test-sharp-input.tif")
  .pipelineColourspace("cmyk")
  .toColourspace("cmyk")
  .toFile("./output/test-sharp-output.tif");

Please provide sample image(s) that help explain this problem

sample image is in the github repo in the input folder and is called test-sharp-input.tif

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions