You have a (very) limited ability to do this in imwrite
: for JPEG it only accepts BitDepth
, Comment
, Mode
and Quality
. And Mode
and Quality
don't get returned from iminfo
.
In imwrite
you can do:
iminfo = imfinfo('Base_Pic.jpg')
imwrite(...,'BitDepth',iminfo.BitDepth, 'Comment',iminfo.Comment);
Other than that, there isn't a way to do this with Image Processing Toolbox/Matlab as far as I know. If you have TIFF or medical images there are a number of toolboxes that do it, but I haven't ever found any for jpeg, even on the File Exchange...
If you have exiftool
on your system, you can use
[status info]=system('exiftool -s Base_Pic.jpg');
info
now contains a list of tag names and tag values, e.g.:
ExifToolVersion : 8.75
FileName : Base_Pic.jpg
Directory : Pictures
FileSize : 2.0 MB
FileModifyDate : 2011:10:27 08:41:55+10:00
FilePermissions : rw-rw-r--
FileType : JPEG
MIMEType : image/jpeg
JFIFVersion : 1.01
ExifByteOrder : Big-endian (Motorola, MM)
Make : Apple
Model : iPhone 4
...
And if you split on colon :
you can write them back using exiftool -[TAG]=[VALUE]
, e.g. exiftool -Make=Apple -Model="iPhone 4" ...
.
Or you can copy them "all" in one foul hit:
system('exiftool -overwrite_original -tagsFromFile Base_Pic.jpg Updated_Image.jpg')