c++ - Exiftool 获取图像信息

标签 c++ objective-c exiftool

我正在尝试通过 Exiftool C++ 接口(interface)在我的 Objective-C 项目中提取图像元数据。 代码:

const char *fileName = "/Users/bbb/Desktop/photos/thumb1.jpg";
TagInfo *info = _tool->ImageInfo(fileName, NULL, 5);
NSLog(@"%@", info);

经过一些调试,我发现 isRunning == 0Command 没有执行——返回 -1

int ExifTool::Command(const char *cmd)
{
    int n;
    // check to make sure our exiftool process is still running
    int isRunning = IsRunning();
    if (!isRunning) return -1;
...

URL 有效且此处信息为 NULL。我究竟做错了什么?谢谢。

最佳答案

我已经弄清楚出了什么问题。 从此改变:

ExifTool *_tool = new ExifTool();

到:

ExifTool *_tool = new ExifTool([exifExecPath cStringUsingEncoding: NSASCIIStringEncoding]);

exifExecPath 是 exiftool exec 文件的确切位置——在我的例子中是 /usr/local/bin

关于c++ - Exiftool 获取图像信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51288144/

相关文章:

c++ - 区 block 链 Hyperledger 私钥漏洞

c++ - std::scientific 是否总是导致 float 的规范化科学计数法?

objective-c - 在Sharekit2.0中自定义发到facebook的帖子

linux - .png 图像的 exiftool : Warning: [minor] Ignored empty rdf:Seq list for dc:subject - 1159. png

c++ - atmega328P+ENC28J60运行12小时卡死

c++ - 如何使 QT 小部件从其父小部件更新修改后的属性?

objective-c - 什么是 QTCaptureScreenInput?

ios - 使用 Core Animation 的 UIView 翻转动画

image - 在命令行上从图像中删除所有元数据

PHP:exiftool 的基本用法