Write image info using imwrite or other method

How to write imag info when writing an image. I can read the image info from one file using imfinfo but I can not find a way to wirte the info when writing the image, e.g., I have an image A and I want to write its info to an other image say B (as image properties/details).
Specifically, I want to write campera properties, e.g., exposure time, f-stop etc from one image to an other image
A_img_info=imfinfo('A.jpg');
A_img_info= A_img_info.DigitalCamera;
A_expTimes =A_img_info.ExposureTime;
%say B is an other image and write the A_expTimes to B
imwrite(B,'B.jpg') %how to write A_expTimes in the properties?

 채택된 답변

Walter Roberson
Walter Roberson 2021년 8월 4일

1 개 추천

You cannot do that using imwrite().
Most of what you want to write is EXIF information. MATLAB does not support writing EXIF information.
See https://www.mathworks.com/matlabcentral/fileexchange/42000-run_exiftool for a File Exchange Contribution that invokes an external program to do the writing.

추가 답변 (1개)

KSSV
KSSV 2021년 8월 4일

0 개 추천

Read the documentation, thre are options mentioned to write into image.

댓글 수: 5

Abdulllah
Abdulllah 2021년 8월 4일
편집: Abdulllah 2021년 8월 4일
Can you kindly, update the last statement to include the exposure time when writing? I could not find it in the documentation. I am trying below statement however, it is thowring error.
imwrite(B,'B.jpg','jpg','ExposureTime','1.0')
imwrite(B,'B.jpg','jpg','comment','ExposureTime = 1.0')
Abdulllah
Abdulllah 2021년 8월 4일
편집: Abdulllah 2021년 8월 4일
Is it possible to include the all the information from imfinfo as a struct instead of separately adding each comment type. For example, In my above code I want to write all the information from image A to image B. I tried,
imwrite(B,'B.jpg','jpg','comment',A_img_info)
Abdulllah
Abdulllah 2021년 8월 4일
편집: Abdulllah 2021년 8월 4일
imwrite(B,'B.jpg','jpg','comment','ExposureTime = 1.0')
The statement executed, however, it did not write the values in the properties/details.
You will not be able to use imwrite() to write properties such as Exposure Time. In JPEG files, those are recorded as EXIF information, which is structured binary data. For example, Exposure Time is EXIF binary tag 0x829A https://www.awaresystems.be/imaging/tiff/tifftags/privateifd/exif/exposuretime.html

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Images에 대해 자세히 알아보기

제품

릴리스

R2018b

질문:

2021년 8월 4일

댓글:

2021년 8월 4일

Community Treasure Hunt

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

Start Hunting!

Translated by