lovell / lovell/sharp

Enhancement: support custom (non sRGB) output ICC profiles and colourspaces

Open
#1,323 37 comments 18 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
JavaScript
Stars
32.7k
Forks
1.4k
Avg merge
1d 14h
Merged PRs (30d)
5

Description

This will convert pixel values using a provided ICC profile and attach that profile to the output image metadata.

It should assume the profile is RGB. If e.g. a CMYK profile is required, `toColourspace` must be used in addition.

Convert to and attach custom RGB output profile (proposed):
```javascript
sharp(input)
.withMetadata({ profile: '/path/to/rgb.icc' })
...
```

Convert to and attach existing RGB output profile (proposed):
```javascript
sharp(rgbInput)
.toColourspace('rgb')
.withMetadata()
...
```

Convert to and attach custom CMYK output profile (proposed):
```javascript
sharp(input)
.toColourspace('cmyk')
.withMetadata({ profile: '/path/to/cmyk.icc' })
...
```

Convert to and attach existing (or default if missing) CMYK output profile (proposed):
```javascript
sharp(cmykInput)
.toColourspace('cmyk')
.withMetadata()
...
```

The `icc_export`, or `icc_transform` when no input profile, operation can be used for this.

The current existing behaviour, as in the following examples, will remain.

Convert to sRGB without embedded profile (existing behaviour):
```javascript
sharp(input)
...
```

Convert to and attach existing sRGB output profile (existing behaviour):
```javascript
sharp(input)
.withMetadata()
...
```

See #1324 for custom *input* profile support.

See #218 for previous discussion on this and related features.

See #734 for a related enhancement that this might address.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the sharp withMetadata and toColourspace entry points and the libvips icc_export and icc_transform operations named in the issue. Compare the existing sRGB profile behavior with the proposed custom RGB and CMYK cases. Done means the documented examples work while existing sRGB behavior remains unchanged; no files or tests are named here.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
computer-graphics
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.