@syngrisi/syngrisi
Version:
Syngrisi - Visual Testing Tool
16 lines • 476 B
JavaScript
// src/server/utils/imageUtils.ts
var getPngDimensions = (buffer) => {
if (buffer.length < 24) {
throw new Error("Buffer too small to be a PNG");
}
if (buffer.readUInt32BE(0) !== 2303741511 || buffer.readUInt32BE(4) !== 218765834) {
throw new Error("Invalid PNG signature");
}
const width = buffer.readUInt32BE(16);
const height = buffer.readUInt32BE(20);
return { width, height };
};
export {
getPngDimensions
};
//# sourceMappingURL=imageUtils.js.map