I have a working application to change some of the metadata of my scanned images. This was working good, until we added a pre-process to automatically crop the borders of the images with GIMP console.
We change multiple fields in the EXIF data, and this still works correct. But if I want to change any IPTC field, I get the error "Property is corrupted."
For the non cropped images, I can change EXIF and IPTC without any problem. For the cropped images, I can change EXIF without any problem. If I change anything in IPTC info, I get an exception.
Am I doing something wrong? Or is there maybe an other solution on how to change the EXIF/IPTC data of the images?
As found in other posts, I extract the BitmapMetadata from the image. And I clone it, to be editable. After that I add padding to be able to add extra information.
As far as I can see, there looks nothing wrong with the metadata. And in other tools like IrfanView or EXIFTool, I can change the IPTC Headline correct.
I have created a test project where the issue is shown. Included with an example image before and after crop.
If isJpg Then
oMetaData.SetQuery("/app13/{ushort=0}/{ulonglong=61857348781060}/iptc/{str=Headline}", "TEST_HEADLINE")
Else
oMetaData.SetQuery("/ifd/{ushort=33723}/{str=Headline}", "TEST_HEADLINE")
End If
System.ArgumentException: Property is corrupted. ---> System.Runtime.InteropServices.COMException: The bitmap property size is invalid. (Exception from HRESULT: 0x88982F42)