HEIC: modify Metadata

I'am developing an Application where you can set a Rating (Starrating) for your images and filter them if the user activates this option.

With JPG Images I had my struggle because of a strange "Err-1" Error which I got when submitting my changes of the Image to the PhotoLibrary, but I could workaround this issue, as it seemed to be connected with the Orientation value.


But now after HEIC was released, I again get the same Error when I want to change the Starrating ("kCGImagePropertyIPTCStarRating"). My workaround with the Orientation didnt work here too. Also I tried setting the "kCGImagePropertyExifUserComment" which also failed with the strange Error "ERR-1".


When I tried changing the UserComment Value of a JPEG everything was fine.


Could anybody find a way to modify Heic Metadata? Or is this a Bug in the PhotoLibrary?

A Little Background

HEIC images can store image properties, but in many cases the metadata of a HEIC image is stored as EXIF or XMP metadata. That may be the metadata you need to edit.

Here is a little discussion and some code on getting EXIF data for an image: https://developer.apple.com/forums/thread/19881

Editing Image Metadata in Apple's Ecosystem

Regardless of the metadata type you are aiming to edit, Apple's Image I/O framework should help you get the job done: https://developer.apple.com/documentation/imageio

Apple's description of the Image I/O framework: "Read and write most image file formats. Manage color and access image metadata."


HEIC: modify Metadata
 
 
Q