UNPKG

image-size

Version:

get dimensions of any image file

9 lines (8 loc) • 282 B
import { readInt32LE, readUInt32LE, toUTF8String } from './utils.js'; export const BMP = { validate: (input) => toUTF8String(input, 0, 2) === 'BM', calculate: (input) => ({ height: Math.abs(readInt32LE(input, 22)), width: readUInt32LE(input, 18), }), };