Skip to content
代码片段 群组 项目
未验证 提交 11b74147 编辑于 作者: Greg Wainer's avatar Greg Wainer 提交者: GitHub
浏览文件

Fix/webp exif little endian (#4061)

* Fix for isLittleEndian flag in parseExifData.

* Add break after reading first exif chunk in getWebpMetadata.
上级 6ab8cad2
No related branches found
No related tags found
无相关合并请求
......@@ -49,7 +49,7 @@ export function getPngMetadata(file) {
function parseExifData(exifData) {
// Check for the correct TIFF header (0x4949 for little-endian or 0x4D4D for big-endian)
const isLittleEndian = new Uint16Array(exifData.slice(0, 2))[0] === 0x4949;
const isLittleEndian = String.fromCharCode(...exifData.slice(0, 2)) === "II";
// Function to read 16-bit and 32-bit integers from binary data
function readInt(offset, isLittleEndian, length) {
......@@ -134,6 +134,7 @@ export function getWebpMetadata(file) {
let index = value.indexOf(':');
txt_chunks[value.slice(0, index)] = value.slice(index + 1);
}
break;
}
offset += 8 + chunk_length;
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册