我想删除除“版权”之外的所有图像元数据。我正在使用这个的 exiftool。这个命令是“exiftool -all= -tagsFromFile @ -copyright Tunis_Bab_Souika_1899.jpg”。但是当我在 java 应用程序中执行此操作时.它以某种方式删除了所有标签。
这是代码片段-
val outputConsumer = ArrayListOutputConsumer()
val exiftoolCmd = ExiftoolCmd()
exiftoolCmd.setOutputConsumer(outputConsumer)
val operation = ETOperation()
println("File name" + sourceImage.toFile().absolutePath)
operation.addImage(sourceImage.toFile().absolutePath)
// exiftool -all= -tagsFromFile @ -copyright Tunis_Bab_Souika_1899.jpg
operation.addRawArgs("-all=")
operation.addRawArgs("-tagsFromFile @")
operation.addRawArgs("-copyright")
println("About to execute")
try {exiftoolCmd.run(operation)
println("Inside try")
} catch (e: java.lang.Exception) {
throw RuntimeException(e)
}
val output = outputConsumer.output
.stream()
.map { obj: String -> obj.trim { it <= ' ' } }
.collect(toList())
println("ooutput$output")
回答我的问题 - 这对我有用 -
operation.delTags("all")
operation.tagsFromFile("@")
operation.getTags("copyright")
operation.addImage(sourceImage.toFile().absolutePath)
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句