Saving images with wide gamut color profile

I was doing some colorimetry and wanted to use MATLAB to generate some images. If I save an image to my disk using the imwrite() function, it produces an image in the sRGB color format. That's not good enough for me as my monitor supports P3, which contains many more colors. Is there a way to write an image in MATLAB with a specific color profile that isn't sRGB?

 Réponse acceptée

Brandon
Brandon le 25 Déc 2025
Here's what I ended up doing:
I wrote the image as a png file in regular sRGB format and then used a command line tool to attach the color profile to the image:
imwrite(img, "test.png");
setenv('PATH', [getenv('PATH') ':/opt/homebrew/bin']);
system('exiftool -"icc_profile<=DisplayP3.icc" test.png');
Here /opt/homebrew/bin is where exiftool is installed on my mac and DisplayP3.icc is the color profile which I downloaded from ICC's website.

Plus de réponses (1)

Walter Roberson
Walter Roberson le 24 Déc 2025

1 vote

The only thing I see is using imwrite() to write tiff with colorspace cielab or icclab; or to use the tiff library to do the same thing.

Produits

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by