Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(PureBasic) Update a String Property in XMPDemonstrates how to open a JPG or TIF image file, access the XMP metadata, and update the value of a string property. (If the string property does not already exist, it is created.)
IncludeFile "CkXml.pb" IncludeFile "CkXmp.pb" Procedure ChilkatExample() ; This example assumes the Chilkat API to have been previously unlocked. ; See Global Unlock Sample for sample code. xmp.i = CkXmp::ckCreate() If xmp.i = 0 Debug "Failed to create object." ProcedureReturn EndIf ; Load a JPG or TIF image file. success.i = CkXmp::ckLoadAppFile(xmp,"qa_data/xmp/AJ_123642_1511.tif") If success <> 1 Debug CkXmp::ckLastErrorText(xmp) CkXmp::ckDispose(xmp) ProcedureReturn EndIf Debug "Num embedded XMP docs: " + Str(CkXmp::ckNumEmbedded(xmp)) ; This example assumes that XMP metadata is already present in the image file. If CkXmp::ckNumEmbedded(xmp) = 0 Debug "No XMP metadata already exists.." CkXmp::ckDispose(xmp) ProcedureReturn EndIf ; Get the XMP metadata. xml.i xml = CkXmp::ckGetEmbedded(xmp,0) ; Show the XML: Debug CkXml::ckGetXml(xml) ; Update (overwrite) a string property. CkXmp::ckAddSimpleStr(xmp,xml,"NumberofTimes","123") success = CkXmp::ckSaveAppFile(xmp,"qa_output/updated.tif") If success <> 1 Debug CkXmp::ckLastErrorText(xmp) CkXmp::ckDispose(xmp) ProcedureReturn EndIf Debug "Success." CkXmp::ckDispose(xmp) ProcedureReturn EndProcedure |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.