@retraigo/image-size@1.0.0Built and signed on GitHub ActionsBuilt and signed on GitHub Actions
Built and signed on GitHub Actions
latest
retraigo/image-sizeThis package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers




JSR Score
100%
Published
a year ago (1.0.0)
import { getImageFormat, type ImageFormat } from "./src/format.ts"; import { getImageSize } from "./src/size.ts"; type ImageInfo = { width: number; height: number; format: ImageFormat; shape: () => [number, number]; }; /** * Get image format and size from byte array. * @param bytes Byte array of image file. * @returns Image width, height, format. */ export function getImageInfo(bytes: Uint8Array): ImageInfo { const format = getImageFormat(bytes); const size = getImageSize(bytes, format); return { width: size.width, height: size.height, format, shape() { return [size.width, size.height]; }, }; }