Skip to main content
Participant
May 24, 2016
Question

Modify XMP from a Photoshop C++ plugin

  • May 24, 2016
  • 2 replies
  • 876 views

I would like to modify XMP data from a Photoshop C++ automation plugin.

The samples provide in the Adobe XMP-Toolkit-SDK are designed to use the compiled XMPCore.lib or XMPCoreStatic.lib files that are generated from the XMPCore source. Unfortunately, Photoshop ignores my plugin when I compile it with either of these lib files as an additional dependency.

Should I dynamically load and use the functions in AdobeXMP.dll (in the Photoshop root directory) instead? If so, is there an example available that shows how to do this?

Any help would be greatly appreciated.

This topic has been closed for replies.

2 replies

June 16, 2016

Please elaborate what you're trying to do with this plugin. For Example: Are you trying to modify metadata from the file present on the filesystem? or directly from photoshop?

Also, please share a sample plugin for us to reproduce the issue.

Adobe Employee
June 2, 2016

It would help if you can share more information about any exceptions being thrown when your plugin is being loaded by Photoshop. Is SXMPMeta::Initialize() call failing? If your plugin links against XMPCoreStatic.lib, then you don't need AdobeXMP.dll at all.

Participant
June 2, 2016

I'm starting with a custom C automation (8li) project that compiles and runs fine in Photoshop (on Windows).

Then I add the following to the project .h file

#define TXMP_STRING_TYPE std::string

#define XMP_INCLUDE_XMPFILES 0

#include "public/include/XMP.incl_cpp"

#include "public/include/XMP.hpp"

I also add (to the project properties) the path to the XMP-Toolkit-SDK directory as an "Additional include Directory"

Finally, I add the line "SXMPMeta::Initialize();" in the plugin startup section - for debugging only.

When I try to compile the project with XMPCoreStatic.lib an "Additional Dependencies", I get a bunch of link errors, such as;

XMPCoreStatic.lib(XMPUtils.obj) : error LNK2019: unresolved external symbol "void __cdecl MD5Init(struct MD5_CTX *)" (?MD5Init@@YAXPAUMD5_CTX@@@Z) referenced in function "public: static void __cdecl XMPU...

When I try to compile with XMPCore.lib, it seems to compile fine. However, when I start Photoshop, it completely ignores this version of the 8li plugin. In the Photoshop System Info popup, I notice: "Plug-ins that failed to load: NONE"

My original thought was that it was not possible to link from a dynamic project (8li, dll) to a static lib - but this is just a guess.

Not knowing how to debug, I thought it might be easier to use C++ wrappers around AdobeXMP.dll (which is included in the Photoshop distribution). Another dead end.

I finally decided to write my own (very simply) XMP parser and writer to get around this issue, but I much prefer to use the official tools provided by Adobe. If it could be helpful to others, I would be happy to continue trying to debug this issue.

Thanks