Get Image Dimensions from the Terminal


Here's how to get image dimensions from the terminal.

It doesn't take a lot. You have a few tools to choose from. Here's the command plus the output of 3:

exiftool

exiftool resources/public/heroes/balloons.webp
ExifTool Version Number         : 12.40
File Name                       : balloons.webp
Directory                       : resources/public/heroes
File Size                       : 353 KiB
File Modification Date/Time     : 2025:03:15 18:11:23-06:00
File Access Date/Time           : 2025:03:15 18:14:04-06:00
File Inode Change Date/Time     : 2025:03:15 18:14:04-06:00
File Permissions                : -rw-r--r--
File Type                       : WEBP
File Type Extension             : webp
MIME Type                       : image/webp
VP8 Version                     : 0 (bicubic reconstruction, normal loop)
Image Width                     : 2560
Horizontal Scale                : 0
Image Height                    : 1440
Vertical Scale                  : 0
Image Size                      : 2560x1440
Megapixels                      : 3.7

identify

identify resources/public/heroes/balloons.webp
resources/public/heroes/balloons.webp WEBP 2560x1440 2560x1440+0+0 8-bit sRGB 361522B 0.040u 0:00.034

file

file resources/public/heroes/balloons.webp
resources/public/heroes/balloons.webp: RIFF (little-endian) data, Web/P image, VP8 encoding, 2560x1440, Scaling: [none]x[none], YUV color, decoders should clamp