Here is how to embed an ICC color profile in JPEG file.
Step 1. Download Phil Harvey's ExifTool from https://exiftool.org: for PC the "Windows Executable" and for Mac the Perl library.
Step 2. Change the ExifTool name: for PC from exiftool(-k).exe to exiftool.exe and for Mac from exiftool to exiftool.pl.
Step 3. Locate the ICC color profiles on your hard disk. The file names of some of the most common profiles are sRGB Profile.icc and AdobeRGB1998.icc.
Step 4. Execute the code below, in which you adapt the paths of your image, ExifTool and ICC profile files.
Note: If you wish to embed an ICC color profile in a TIFF file, follow Steve Eddins's advices at https://blogs.mathworks.com/steve/2009/10/20/embedding-an-icc-profile-into-a-tiff-file/.
% Image file location (change as needed).
image_url = fullfile('image_path','image.jpg');
% ICC color profile file location (change as needed).
icc_url = fullfile('icc_profiles_path','icc_profile.icc');
% ExifTool file location (change as needed).
if ispc
exiftool_url = fullfile('exiftool_path','exiftool.exe');
else
exiftool_url = fullfile('exiftool_path','exiftool.pl');
end
% Copy ICC color profile from ICC definition file into image file.
icc_embed_status = system(...
[ '"', exiftool_url, ...
'" -q -tagsFromFile "', ...
icc_url, '" -ICC_Profile "', ...
image_url,'"' ]);
% Delete image backup file produced by exiftool.
if icc_embed_status == 0
delete([image_url,'_original'])
else
icc_status = 'No ICC color profiles embeded in JPEG files.';
end