> I can call this function with success (returns true), but the metadata of
> the output image still does not change. What am I doing wrong?
Nothing. By the way, you didn't specify which output format you tried as it can make a difference. But most drivers will ignore metadata domains other than the main one, and even if they do take into account (for example the GeoTIFF driver), they will copy the metadata in a generic form, and do not encode it regarding the EXIF or XMP standards, which is probably what you want.