- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在开发一个 .opus 音乐库软件,它将音频/视频文件转换为 .opus 文件并自动用元数据标记它们。
该程序的早期版本已将专辑封面保存为二进制数据,这显然是由 exiftool
揭示的。
问题是,当我使用 -b
选项运行命令以二进制形式输出数据时,整个内容看起来都是二进制的。我不确定如何让程序解析它。我有点期待像 Picture : 11010010101101101011...
这样的条目。
如何解析图片数据,以便为新版本的程序重建图像? (我在 Kubuntu 18.04 上使用 Java8_171)
最佳答案
看起来您正在尝试在文本编辑器中打开原始字节,这当然会让您大吃一惊,因为这些原始字节不代表任何文本编辑器都可以显示的字符。我可以从 exiftool 的输出中看到,您可以知道图像的长度(以字节为单位)。如果您知道文件中的起始字节位置,那么只需一点 Java 代码就可以使您的任务相对简单。如果您可以获得文件中图像的起始位置,您应该能够执行以下操作:
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.*;
public class SaveImage {
public static void main(String[] args) throws IOException {
byte[] imageBytes;
try (RandomAccessFile binaryReader =
new RandomAccessFile("your-file.xxx", "r")) {
int dataLength = 0; // Assign this the byte length shown in your
// post instead of zero
int startPos = 0; // I assume you can find this somehow.
// If it's not at the beginning
// change it accordingly.
imageBytes = new byte[dataLength];
binaryReader.read(imageBytes, startPos, dataLength);
}
try (InputStream in = new ByteArrayInputStream(imageBytes)) {
BufferedImage bImageFromConvert = ImageIO.read(in);
ImageIO.write(bImageFromConvert,
"jpg", // or whatever file format is appropriate
new File("/path/to/your/file.jpg"));
}
}
}
关于java - 从 exiftool 读取二进制图片数据?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51350425/
我有一个 MP4 文件 Title元数据: exiftool movie.mp4 这使: Audio Bits Per Sample : 16 Audio Sample Rate
但它就在那里。 有什么想法吗? 当我尝试从图像文件获取元数据时会发生这种情况(这是运行 shell 脚本的 AppleScript): on getMetaData(filePath) -->get
我试图在数百个文件中搜索关键字“Description”,然后输出包含该关键字的文件的名称。 执行一个简单的 exiftool * | grep Description (在 UNIX 中)给我文件中
我有很多以日期格式命名的照片,但 EXIF 日期不匹配。 例如2016-12-16_20-20-29.jpg 运行它们 EXIFTOOL我几乎可以覆盖日期,但它与确切的日期格式不匹配。 exiftoo
我目前在终端/cmd 中使用诸如 exiftool -FileModifyDate(<)datetimeoriginal 等标签... 我从 icloud 切换,元数据中的日期是 exif(意思是 f
我一直在整理我的家庭照片,包括一些来 self 父亲的恢复备份驱动器的照片。许多照片被命名为 file000268.jpg 等,所以我研究了重命名实用程序,并最终选择了 exiftool,因为我可以在
我正在尝试通过 Exiftool C++ 接口(interface)在我的 Objective-C 项目中提取图像元数据。代码: const char *fileName = "/Users/bbb/
我想使用 ExifTool 批量写入以前保存在文本文件中的元数据。 假设我有一个包含以下 JPEG 文件的目录: 001.jpg 002.jpg 003.jpg 004.jpg 005.jpg 然后我
我正在开发一个 .opus 音乐库软件,它将音频/视频文件转换为 .opus 文件并自动用元数据标记它们。 该程序的早期版本已将专辑封面保存为二进制数据,这显然是由 exiftool 揭示的。 问题是
我正在尝试使用 Exiftool 读取 illustrator 文件元数据值。我按照下面的方法尝试过。 File[] images = new File("filepath").listFiles()
我正在尝试在 Java 中复制以下命令,以捕获 zip 中某些文件的文件名。 ExifTool.exe -a -ZipFileName C:\Users\Name\Downloads\file.zip
我对使用 java api 或类似的东西解析 exiftool 结果很感兴趣。 我一直在研究,但我没有找到任何例子。例如,我如何在我的 java 项目中获得这些结果? ExifTool Version
我有一些没有颜色配置文件的 .jpg 文件,我想使用 exiftool 将它们设置为特定的颜色配置文件。 我需要提供什么参数才能执行此操作? 最佳答案 对于 exiftool 添加颜色配置文件,您需要
我有一些 MP4 视频没有媒体创建日期和时间,因为它们是用 Instagram 相机录制的。我想设置日期和时间,我发现我可以用 Exiftool 软件做到这一点。我知道该软件通过键入命令行来工作,但我
我正在用 Haskell 编写一个程序,需要来自媒体文件的元数据,例如运行时、艺术家、大小、名称、版权、高度...... 基本上我需要获取这些信息并用它创建一些pdf,但我找不到一种方法来获取“60s
有人知道如何通过执行一次 exiftool 来获取多个 JSon 文件吗?我可以从我的目录生成一个 JSon 文件,其中包含该文件夹内文件的所有元数据,但我想为每个文件生成一个。我还想将生成的所有文件
我正在使用 ProcessBuilder 将 exiftool 的输出打印到文件中。我正在尝试在 .opus 文件上运行此命令:exiftool Aero.opus > Aero.txt。这在终端中运
我想使用 exiftool 从我的照片和视频中扫描 EXIF 标签。它是一个 perl 可执行文件。对此进行推断的最佳方法是什么?是否已经有任何 Python 库可以执行此操作?或者我应该直接调用可执
我正在尝试在 golang 中做 bash 等价物: cat image.jpg | exiftool -author=some_auth - > updated_image.jpg exiftool
我是新来的 exiftool并且不知道我是否可以在包含该文件的位置放置一个 URL,而不是一个文件。我可以吗? 例如: exiftool http://www.edfr.com/images/wert
我是一名优秀的程序员,十分优秀!