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?

 Accepted Answer

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.

More Answers (1)

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.

Categories

Products

Asked:

on 24 Dec 2025

Answered:

on 25 Dec 2025

Community Treasure Hunt

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

Start Hunting!