: Why are the colors of certain PNG files getting distorted when opened in Illustrator? I was trying to open an iPhone screenshot in Illustrator, but for some reason the colors are distorted.
I was trying to open an iPhone screenshot in Illustrator, but for some reason the colors are distorted. If I open the same file in any other application (Photoshop, GIMP, Preview, etc.) the colors are rendered fine. The curious thing is that this only occurs with certain screenshots, as I tested a screenshot of the home screen as well, which Illustrator opened without distorting the colors.
Though, with GIMP, a dialog does pop up stating:
The image 'IMG_1199.PNG' has and embedded color profile:
Display P3
Convert the image to the RGB working space (sRGB built-in)?
With the option to either keep or convert the color profile; which makes me think Illustrator may not recognize the aforementioned color profile.
Here is the original image directly from the phone [left] and the image opened (then saved) from Illustrator [right]:
Update
Converting the color profile in GIMP, saving, then opening the file again in Illustrator does fix the issue. This seems to confirm my suspicion that the Display P3 color profile is the issue, which changes my question somewhat: how can I open the image in Illustrator without first converting the image beforehand?
This seems like it may be a bug in Illustrator, so I have submitted a bug report to Adobe. I will update if the report is conclusive, or if Adobe provides a solution.
More posts by @Gail6891361
2 Comments
Sorted by latest first Latest Oldest Best
What probably happens: The screenshot is a 16-bit png, but illustrator reads it as an 8-bit png, using only the 8 lower (!) bits.
Explanation
For the following explanation we assume that the screenshot is an 16-bit grayscale image, that is every pixel is a number between
black = 0 = 0x0000 = 0b 0000 0000 0000 0000
and
(16-bit) white = 2^16-1 = 65535 = 0xFFFF = 0b 1111 1111 1111 1111.
(0x denotes hexadecimal numbers and 0b denotes binary numbers)
Illustrator seems to load only 8 of these 16 bits, unfortunately the wrong ones, that is the least significant ones. Choosing the least significant bits is the only problem.
0b #### #### #### ####
_______/ _______/
discarded loaded
After the import, illustrator will scale the interpretation (which number is white, which is black) according to the new maximum number:
(8-bit) white = 2^8-1 = 255 = 0xFF = 0xb 1111 1111.
Assume one of our pixels had the value 0b 1111 1111 0000 00001 = 0xFF01 = 65281, that is nearly white. After the import, the value will be 0b 0000 0001 = 0x01 = 1, that is nearly black.
It's like "rounding" 999.001 to 001 – completely wrong!
Simulation
How can we be sure, that the described problem is our problem?
We simulate the bug!
The following python program loads the 16-bit screenshot as described above.
(Please don't judge me, it's my very first python program.)
#! /usr/bin/python
import numpy as np
import cv2
# load picture
img = cv2.imread('screen.png', 3)
# assert (by hand) that picture is loaded as 16 bit image
print img.dtype
# simulate the bug
img[:,:] &= 0x00FF # use only 8 least significant bits
img[:,:] <<= 8 # rescale
# save the picture
cv2.imwrite('bug.png',img)
the result bug.png
Click here for original size, and here to compare with OP's version.
As we can see, our simulation yields exactly the same result.
Workaround
I only can think of one workaround (since I do not use illustrator):
Convert your screenshots to 8-bit pngs
GraphicsMagick and/or ImageMagick are console tools which are convinient for this job. The following command converts to 8-bit pngs:
convert original.png -depth 8 converted.png
Now that is some funky issue.
GIMP already give us some clue, confirming the suspicion that it is something with the color profile of the screenshot.
Converting it your everyday sRGB and 8bit per channel may avoid Illustrator to mess things up on trying to pull it as CMYK.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.