Thanks. I managed to run in on Android.
Given I have some swift code. Read a file from mac folder and listing some metadata tags
let url = URL(fileURLWithPath: "/Library/Desktop Pictures/Mojave.heic")
let source = CGImageSourceCreateWithURL(url as CFURL, nil)!
let metadata = CGImageSourceCopyMetadataAtIndex(source, 0, nil)!
let tags = CGImageMetadataCopyTags(metadata) as! [CGImageMetadataTag]
for tag in tags {
guard let name = CGImageMetadataTagCopyName(tag) as String?,
let value = CGImageMetadataTagCopyValue(tag) as? String
else {
continue
}
print(name, value)
}
let xmpData = CGImageMetadataCreateXMPData(metadata, nil)
let xmp = String(data: xmpData! as Data, encoding: .utf8)!
print(xmp)
Thanks. I managed to run in on Android. Given I have some swift code. Read a file from mac folder and listing some metadata tags
Result
How can I achieve it with java