I want to change the date-time related EXIF tags of some of my pictures because the time of my camera wasn't adjusted to daylight saving time. In trying to do so with GdPicture Pro OCX and the 4GL Progress everything goes fine except for 1 thing. It seems that the EXIF info isn't written back to the original file. If I use the "SaveAsJpeg"-method the EXIF data of the newly created file is set correctly, but the size of the picture is also increased. And I dont't want to change the picture at all. I only want to correct the EXIF-tags...
Where do I go wrong? Can anybody help me out?
TIA
Jeroen
PS 1: my Progress sample code, you should be able to read it!
Code: Select all
define variable chPicture as com-handle no-undo.
define variable iTags as integer no-undo.
define variable iCurTag as integer no-undo.
define variable iTagId as integer no-undo.
define variable cTagValue as character no-undo.
define variable cNewValue as character no-undo.
define variable iResult as integer no-undo.
create "GdpicturePro.cGdPicture" chPicture.
chPicture:SetLicenceNumber ("0332966657783387670301864"). /* June 2007 trial number */
chPicture:CreateImageFromFile ("C:\TestPic.jpg").
iTags = chPicture:TagsCount(). /* get the total number of tags present */
do iCurTag = 1 to iTags:
iTagId = chPicture:TagsGetId(iCurTag). /* Get the tag ID of the current Tag */
case iTagId:
when 306 or /* Tag: DateTime */
when 36867 or /* Tag: ExifDtOrig */
when 36868 then /* Tag: ExifDtDigitized */
do:
cTagValue = chPicture:TagsGetValue(iCurTag). /* Example: "2007:05:27 17:32:11" */
cNewValue = "2007:05:27 18:32:11". /* Add an hour to the timestamp */
iResult = chPicture:TagsWriteTypeASCII
( input-output iTagId by-pointer
, input-output cNewValue by-pointer
).
if iResult <> 0 then /* in case of an error... */
message "Error TagsWriteTypeASCII" view-as alert-box /* ... give message */
end. /* when 306 or when 36867 or when 36868 */
end. /* case iTagId: */
end. /* do iCurTag = 1 to iTags: */
iResult = chPicture:SaveAsJpeg
( "C:\TestPicNew.jpg"
, 100
).
if iResult <> 0 then /* in case of an error... */
message "Error SaveAsJpeg" view-as alert-box /* ... give message */
iResult = chPicture:CloseNativeImage().
if iResult <> 0 then /* in case of an error... */
message "Error CloseNativeImage" view-as alert-box. /* ... give message */
release object chPicture. /* Free the memory */