-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ICC profiles in PNG images generated by Figma have truncated iCCP chunks #4128
Comments
The input image contains a P3 ICC profile. https://sharp.pixelplumbing.com/api-output#keepiccprofile sharp('img.png')
.resize({ width: 800 })
.keepIccProfile()
.toFile("out.png"); |
I tried the above code, but it didn't work. |
I took a closer look and the compressed {
format: 'png',
width: 738,
height: 1758,
space: 'srgb',
channels: 4,
depth: 'uchar',
density: 216,
isProgressive: false,
hasProfile: false,
hasAlpha: true
} When using libvips compiled with support for libpng there is an ICC profile available, so my best guess would be that this relates to randy408/libspng#14. Do you know the source of this image? Perhaps the compressed zlib stream within the Please can you report this issue upstream at https://github.com/randy408/libspng |
The DEFLATE stream within the $ exiftool -icc_profile -b x.png
Warning: Error inflating iCCP - x.png |
@kleisauke Thanks for confirming my suspicions, I'm not sure how libpng manages to inflate the truncated profile though 🤷 |
@lovell Thank you for the information. I exported a PNG image with the P3 Color profile using Figma. In Sharp, it shows ![]() |
@richhost Thank you, in that case please can you report this to Figma. |
@richhost Were you able to report this to Figma? If so, what did they say? |
@richhost Have you had any response from Figma? @jake-figma Wearing your Figma Developer Advocate hat, are you able to provide any insight into this? The summary is that it appears Figma is currently exporting PNG images with corrupt P3 ICC profiles. Thank you. |
@lovell Unfortunately, I have not received any response from Figma, and the problem still persists. If @jake-figma sees this message, I would greatly appreciate if he could help follow up on this issue. |
Possible bug
Is this a possible bug in a feature of sharp, unrelated to installation?
npm install sharp
completes without error.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?
sharp
as reported bynpm view sharp dist-tags.latest
.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
?Does this problem relate to file caching?
The default behaviour of libvips is to cache input files, which can lead to
EBUSY
orEPERM
errors on Windows.Use
sharp.cache(false)
to switch this feature off.sharp.cache(false)
does not fix this problem.Does this problem relate to images appearing to have been rotated by 90 degrees?
Images that contain EXIF Orientation metadata are not auto-oriented. By default, EXIF metadata is removed.
To auto-orient pixel values use the parameter-less
rotate()
operation.To retain EXIF Orientation use
keepExif()
.Using
rotate()
orkeepExif()
does not fix this problem.What are the steps to reproduce?
My operating system is macOS, and I use a display with P3 color.
What is the expected behaviour?
Keep the original colors.
Please provide sample image(s) that help explain this problem
original image:

output image:

The text was updated successfully, but these errors were encountered: