5 ms·
Yep, that's a viable solution. GIF and PNG include the dimensions in the first few bytes. JPEG is a little more complex, but you don't need to download much of
by elektronaut 11y ago
Yep, that's a viable solution. GIF and PNG include the dimensions in the first few bytes. JPEG is a little more complex, but you don't need to download much of the file to get dimensions.
I've used fastimage with success: https://github.com/sdsykes/fastimage https://github.com/sdsykes/fastimage
- Gigablah 11y agoFor nodejs there's https://github.com/netroy/image-size https://github.com/netroy/image-size From testing with 1800+ image URLs, you can almost certainly get the dimensions within the first 64kb.