FastImage
Read an image's format and dimensions from its header.
sdsykes · Drawing and design
GitHub projectOpen source Open on GitHubHow to try it
With Ruby 3.2 available, install fastimage at version 2.4.3. Check a local synthetic PNG headed as 3 by 2 pixels.
What we tested
2.4.3. Check a local synthetic PNG headed as 3 by 2 pixels. The image probe returned PNG and the exact 3-by-2 dimensions.