Read real image dimensions from the bytes

FeatureSecurityService
Shipped
August 25, 2026 at 4:19 PM UTC
Author
Kamo
Commit
f1364ab

Nothing here trusts the page. An HTML width attribute is a layout instruction, not a fact about the file -- a 2400px logo is routinely declared width="180" and a tracking pixel width="600" -- so scoring on the page's numbers ranks a spacer above a real logo. Hand-written rather than ImageIO because ImageIO reads none of the three formats that matter most here: SVG (the best answer for the compact slot), ICO (what /favicon.ico always is) and WebP (what a modern site serves everything as). Two details worth keeping: an ICO is a container and the LARGEST entry is reported, since the first is usually 16x16; and an SVG is measured by viewBox rather than width, which is routinely "100%" and says nothing about the artwork's proportions.

All changes

Like what you see shipping?

Every one of these updates lands in your workspace automatically. Start free and watch it grow week after week.

Start Free ForeverView Pricing