Skip to content

Commit

Permalink
Sync #4061 (#172)
Browse files Browse the repository at this point in the history
  • Loading branch information
huchenlei committed Jul 19, 2024
1 parent a99a833 commit cb9042f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/scripts/pnginfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export function getFlacMetadata(file: File): Promise<Record<string, string>> {

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) {
Expand Down Expand Up @@ -117,6 +117,7 @@ export function getWebpMetadata(file) {
let index = value.indexOf(":");
txt_chunks[value.slice(0, index)] = value.slice(index + 1);
}
break;
}

offset += 8 + chunk_length;
Expand Down

0 comments on commit cb9042f

Please sign in to comment.