question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Resized Display P3 image includes Display P3 color profile but it is missing color information

See original GitHub issue

I’m working on adding wide color support to my application.

I’ve got my pipeline from device -> server -> Amazon S3 working and I can successfully upload images with the Display P3 color profile from device to S3 without a loss of color information, retaining the color profile. I use libvips on my Go server as well, in order to do some initial processing.

Once the images are stored in S3, I have Sharp running in a Lambda function for Cloudfront origin requests to the S3 bucket. I have verified that a vanilla Cloudfront distribution is able to serve the wide color images correctly, but when they pass through Sharp resizing they lose color information.

I’m on the latest version, v0.29, and I’m using the attached canary image to test (it is an image that shows up in Display P3 but disappears in sRGB).

Original Canary Broken by Sharp

If you download and inspect the images, you can see that the resulting image has the Display P3 profile but it has lost the color information.

I’m using the pipelineColorspace(“rgb16”) operator, and specifying the output icc profile. Is there something else I’m doing wrong here? Thanks!

Relevant code:

  S3.getObject({ Bucket: bucket, Key: originalKey })
    .promise()
    .then((data) =>
      Sharp(data.Body)
        .pipelineColorspace("rgb16")
        .resize(width, height)
        .withMetadata({ icc: iccProfilePath })
        .toColorspace("srgb") // I have tried with and without this line to the same result.
        .toFormat(format)
        .toBuffer()
    )
    .then((buffer) =>
      S3.putObject({
        Body: buffer,
        Bucket: bucket,
        ContentType: contentType,
        Key: newKey,
      }).promise()
    )
    .then(function () {
      console.log("Redirecting to resized at: " + `/${newKey}`);
      const response = {
        status: "301",
        statusDescription: "Moved Permanently",
        headers: {
          location: [
            {
              key: "Location",
              value: `/${newKey}`,
            },
          ],
        },
      };
      callback(null, response);
    })
    .catch((err) => callback(err));

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
lovellcommented, Sep 7, 2021

v0.29.1 is now available - thank you for reporting this.

1reaction
lovellcommented, Aug 28, 2021

Thanks, and sorry you were correct, the P3 profile is present in the GitHub image (I was looking at a previously downloaded image from a different issue with a very similar filename, d’oh).

I can reproduce the problem locally, and will need to spend a little time to debug exactly what’s happening.

In terms of the built-in “p3” profile in libvips, this is DisplayP3, which is hopefully the more useful/common flavour.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Re: How to color-manage Display P3 image file - Adobe Support ...
Use the embedded profile (instead of the working space)?. Will you be making edits in this profile space? Convert the document's colors…
Read more >
How to start designing assets in Display P3 - Discover
Open Sketch on your Mac. · Create a new file. · Go to File > Change Color Profile (or use the keyboard command...
Read more >
What are color profiles? And why do they matter? - Sketch
Wondering what color profiles are and which one to apply to your designs? We've got you covered. Learn the difference between Display P3...
Read more >
SRGB or Display P3 for exporting?
All edits the same only difference is color space upon export. P3. P3.jpg. You can only see EXIF info for this image if...
Read more >
Apple Display P3 Color Profile Support? - EFI Communities
Recently I have received two jobs that when I import the PDF file through CWS and print some of the images are very...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found