How to add 'Description' to '.jpeg'?
2 次查看(过去 30 天)
显示 更早的评论
Once I've generated a plot and saved it as .jpeg, I'd like to add a description to it i.e.:
- 'This plot was created with script version 01'
The code for saving the plot is simple:
x = 0:0.1:4
fig(1) = figure
plot(x,x.^3)
saveas(fig(1),'fig.jpg')
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/171416/image.png)
And then I tried to access the image info to modify it but to no avail:
fileName = 'fig.jpg';
i = imread(fileName)
info = imfinfo(fileName)
info.Comment = 'Made with script version 1';
imwrite(i,'figC.jpg')
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/171417/image.png)
QUESTIONS:
- Is what I'm trying possible?
- If so, how?
Many thanks.
2 个评论
采纳的回答
C.J. Harris
2018-3-20
If you're only interested in the 'Comment' field, then you can set it directly:
imwrite(i,'figC.jpg', 'Comment', 'Made with script version 1')
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Interactive Control and Callbacks 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!