使用Objective-C将XMP数据嵌入到PNG中 [英] Embed XMP data to PNG with Objective-C

查看:494
本文介绍了使用Objective-C将XMP数据嵌入到PNG中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在iOS应用中将自定义XMP文件嵌入到PNG中。
到目前为止,我能够做的是编译生成Xcode项目的Adobe XMP工具包,然后我正确地编译了项目。



来自在那里我不知道如何在我的Xcode项目中使用该库以及如何使用它。我在互联网上找到的信息很少。



任何同样希望提供帮助的人?

解决方案

如果您下载了Adobe XMP Toolkit SDK,您可以在ModifyingXMP.cpp中找到编写XMP元数据的示例,以及在修改已写入XMP的文件中的示例ReadingXMP.cpp文件。请注意,我使用的是XMP-Toolkit-SDK-CC201607版本。



您需要稍后在iOS项目中包含静态文件和头文件。请仔细阅读有关如何生成它们的说明,特别是您需要哪种拱形。在我的例子中,我分别生成了[arm64,armv7,armv7s]和[x86_64],然后将它们组合在一起。



根据以下内容尝试修改ModifyingXMP.cpp你需要什么。将这些源代码作为Objective-C ++(扩展名为.mm)包含在iOS应用程序项目中。不要忘记包含头文件,libXMPCoreStatic.a文件,libXMPFilesStatic.a文件,制作桥接头,并配置项目以导入外部静态库。如果您不明白我在说什么,请查看以下链接:





我在XmpWriter.h上的实现:

  #import< Foundation / Foundation.h> 

@interface XmpWriter:NSObject

+(BOOL)writeXmp:(const char *)imageUrl Param1:(const char *)Param1 Param2:(float)param2 Param3 :(浮动)Param3;
+(BOOL)readXmp:(const char *)imageUrl;

@end

在我的XmpWriter.mm文件中,我修改了 createXMPFromRDF()接受我的参数,如:

  SXMPMeta createXMPFromRDF(const char * Param1,float Param2,float Param3)

我希望你能接近你想达到的目标从这里开始。


I need to embed a custom XMP file to a PNG in a iOS app. Until now, what I was able to do is to compile the Adobe XMP toolkit, that generated an Xcode project, then I compiled the project correctly.

From there I don't know how to use the library in my Xcode project and how to use it. I've found very little info about this on the Internet.

Anyone who did the same wishing to help?

解决方案

If you downloaded the Adobe XMP Toolkit SDK, you can find an example of writing the XMP metadata in "ModifyingXMP.cpp" and an example of reading the already XMP-written file in "ReadingXMP.cpp" file. Note that I am using XMP-Toolkit-SDK-CC201607 version.

You need static files and header files to be included in your iOS project later. Read the instructions carefully on how to generate them, specifically on what kind of archs you need. In my case, I generated [arm64, armv7, armv7s] and [x86_64] separately and then lipo them together later.

Try and modify "ModifyingXMP.cpp" according to what you need. Include these source codes into your iOS app project as Objective-C++ (with .mm extension). Don't forget to include the header file, libXMPCoreStatic.a file, libXMPFilesStatic.a file, make a bridging header, and configure your project to import external static libs. If you don't understand what I am talking about, check these links:

https://forums.adobe.com/thread/1360320

How can I use an .a static library in swift?

Here is what it looks like in my demo project:

My implementation on XmpWriter.h:

#import <Foundation/Foundation.h>

@interface XmpWriter : NSObject

+(BOOL) writeXmp:(const char *) imageUrl Param1:(const char *) Param1 Param2:(float) param2 Param3:(float) Param3;
+(BOOL) readXmp:(const char *) imageUrl;

@end

In my XmpWriter.mm file, I modify the createXMPFromRDF() to accept my parameters like:

SXMPMeta createXMPFromRDF(const char *Param1, float Param2, float Param3)

I hope you can get closer to what you want to achieve from here.

这篇关于使用Objective-C将XMP数据嵌入到PNG中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆