0

I used LiveTrace on an raster and obtained vector graphics with shades of grey. I exported as SVG and coded a conversion of those shades of gray to an opacity of black so I can easily colorize the image, e.g. change all colors to shades of red, magenta, etc. The conversion is:

# Find the opacity that turns the saturated color into this shade
gray_int = int(gray2letter, 16)
opacity = ' opacity="%0.2f"' % (1 - (gray_int / 256))

The conversion is very accurate: in the image below, I cut the design in solid colors in half and aligned it with the design with opacity, so the half with solid colors is on the left and the half with opacity is on the right. The colors are the same inside the canvas and outside the canvas the right-hand side looks darker because the background color in the Illustrator GUI is darker.

screenshot showing accurate color conversion to tints

Yet, when I export each design independently as PNG, the one with opacity looks darker. Although the paths are the same and the colors look the same, the export algorithm seems to dilate the darker colors with opacity and they take more space. It's subtle: I can only see it in a viewer with seamless transition between the two images. To emphasize the difference without such a tool, I circled one patch that is larger in the export of the design with opacity.

PNG export with solid colors

PNG export with opacity

I am running macOS Mojave 10.14.6 and Adobe Illustrator CS5 15.1.0.

Why the discrepancy in the PNG export between solid and transparent colors?

  • 1
    Anti-aliasing... – Scott Feb 29 at 23:42
  • @Scott That's intriguing. Why does anti-aliasing behave differently with solid versus transparent colors? – miguelmorin Mar 1 at 8:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.