Saving images with wide gamut color profile

25 views (last 30 days)
Brandon
Brandon on 24 Dec 2025 at 21:19
Answered: Brandon on 25 Dec 2025 at 3:34
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

Brandon
Brandon on 25 Dec 2025 at 3:34
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)

Walter Roberson
Walter Roberson on 24 Dec 2025 at 22:12
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.

Products

Community Treasure Hunt

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

Start Hunting!