LeoHsiao1 / pyexiv2

Read and write image metadata, including EXIF, IPTC, XMP, ICC Profile.
GNU General Public License v3.0
196 stars 39 forks source link

Deleting custom attribute #99

Closed MosGeo closed 1 year ago

MosGeo commented 1 year ago

I was wondering if it is possible to delete one or more custom attributes in xmp. I see that right now, we can clear the xmp. I don't know if this is technically feasible or not.

LeoHsiao1 commented 1 year ago

According to the tutorial, you can assign None to remove a tag:

img.modify_xmp({'Xmp.xmp.Rating': None})
MosGeo commented 1 year ago

Ahh perfect. Sorry for noticing that. So it actually removes the key :) Nice!

I was actually doing that (thinking it is a good a substitute for removing the key). In my retrieval function, I am forcing to return None if the key is not there so I didn't notice that it was actually removed.