我正在尝试通过 Exiftool C++ 接口(interface)在我的 Objective-C 项目中提取图像元数据。 代码:
const char *fileName = "/Users/bbb/Desktop/photos/thumb1.jpg";
TagInfo *info = _tool->ImageInfo(fileName, NULL, 5);
NSLog(@"%@", info);
经过一些调试,我发现 isRunning == 0
和 Command
没有执行——返回 -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/