Search code examples
delphifiremonkey

How to display correctly image with icc color profile embed?


Under delphi tokyo, If i try to show this image:

https://chromachecker.com/include/img/web_browser/redtruck_GBR.jpg

enter image description here

Inside a Timage then instead of a blue sky it's show a GREEN sky like below :

enter image description here

How in delphi we can show correctly picture with embed color profile ?


Solution

  • A complete answer and example is way too broad. But here's a rough outline what you need to do. See it as a starting point for further research.

    1. Get the color profile of your image. Either the EXIF data refers to a well known profile, or it is embedded in the image metadata.
    2. Get the color profile of the screen GetICMProfile
    3. Load the color profiles of the screen and your image: OpenColorProfile
    4. Create the color transform: CreateMultiProfileTransform
    5. Translate the colors: TranslateBitmapBits
    6. Clean up: CloseColorProfile, DeleteColorTransform