@lowdep/img-info
v1.0.0
Published
Image metadata CLI — dimensions, format, color space, EXIF — no ImageMagick, zero dependencies, works on Windows
Maintainers
Readme
img-info
Image metadata from the terminal — no ImageMagick, no native deps, works on Windows.
Reads format headers directly from binary data to extract dimensions, color space, bit depth, file size, and EXIF data (for JPEGs).
Supported Formats
| Format | Dimensions | Color Space | Bit Depth | EXIF | |---|---|---|---|---| | PNG | ✓ | ✓ | ✓ | — | | JPEG | ✓ | ✓ | — | ✓ (make, model, orientation) | | GIF | ✓ | Indexed | — | — | | WebP | ✓ (lossy/lossless/extended) | RGB/RGBA | — | — | | BMP | ✓ | ✓ | ✓ | — | | ICO | All sizes listed | — | — | — | | SVG | ✓ (from attributes) | Vector | — | — |
Install
npm install -g img-infoOr without installing:
npx img-info logo.pngUsage
img-info <file> [file2 ...]
img-info --json <file>Examples
# Single file
img-info logo.png
# Multiple files
img-info *.jpg
# JSON output (pipe-friendly)
img-info banner.webp --json
# Batch audit a directory
ls *.png | xargs img-infoExample Output
logo.png /path/to/logo.png
Format PNG
Dimensions 1200 × 630 px 16:9
Color space RGBA
Bit depth 8
File size 142.3 KB (145,792 bytes)
Modified 5/27/2026, 10:30:00 AM
photo.jpg /path/to/photo.jpg
Format JPEG
Dimensions 4032 × 3024 px 4:3
Color space YCbCr (RGB)
File size 3.21 MB (3,366,912 bytes)
Modified 5/26/2026, 4:15:00 PM
EXIF
make Apple
model iPhone 15 Pro
orientation NormalJSON output (--json):
{
"file": "/path/to/logo.png",
"format": "PNG",
"width": 1200,
"height": 630,
"fileSize": 145792,
"colorSpace": "RGBA",
"bitDepth": 8
}How It Works
img-info reads only the first 64KB of each file and parses the format-specific binary header:
- PNG: reads
IHDRchunk at offset 16 (8-byte signature + 8-byte chunk header) - JPEG: scans for
SOF0/SOF1/SOF2markers; readsAPP1for EXIF IFD - GIF: reads
GIF87a/GIF89aheader, width/height at bytes 6–9 (little-endian) - WebP: reads
RIFF…WEBPcontainer, parsesVP8/VP8L/VP8Xsub-chunks - BMP: reads DIB header starting at byte 14
- ICO: reads directory entries listing all embedded icon sizes
- SVG: scans first 2KB for
width=,height=, andviewBox=attributes
No child processes. No native binaries. No network.
License
MIT
Keywords
image metadata · image dimensions · png size · jpeg dimensions · exif · imagemagick alternative · identify image · width height · zero dependencies · cli
Built to solve, shared to help — Rushabh Shah 🛠️✨
One of 40+ zero-dependency developer CLI tools — no node_modules, ever.
