How can I embed an ICC color profile in a JPEG file?

31 ビュー (過去 30 日間)
Vlad Atanasiu
Vlad Atanasiu 2020 年 7 月 17 日
回答済み: Vlad Atanasiu 2020 年 7 月 17 日
Matlab (R2020a) offers no native option to embed ICC color profiles in JPEG files. How can I do it?

採用された回答

Vlad Atanasiu
Vlad Atanasiu 2020 年 7 月 17 日
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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImport, Export, and Conversion についてさらに検索

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by