info

Display comprehensive image information and metadata including dimensions, format, color space, file size, and EXIF data.

Usage

Terminal
$ mediaproc image info <input> [options]

Description

The info command provides a quick way to inspect image files and retrieve detailed information about their properties, dimensions, format, and metadata. Perfect for verifying image specifications, checking file integrity, and extracting technical details before processing.

Options

OptionTypeDefaultDescription
<input>stringrequiredInput image file path
--jsonflag-Output information in JSON format
-v, --verboseflag-Show all available metadata including EXIF

Examples

Basic Usage

Terminal
$ mediaproc image info photo.jpg
File: photo.jpg
Size: 2.45 MB (2,570,240 bytes)
Dimensions: 4032 × 3024 pixels
Format: JPEG
Color Space: srgb
Channels: 3
$ mediaproc image info image.png --json
$ mediaproc image info photo.jpg -v
$ mediaproc image info picture.webp

Scripting with JSON Output

Terminal
$ WIDTH=$(mediaproc image info photo.jpg --json | jq -r '.format.width')
$ echo $WIDTH
4032
Terminal
$ HAS_ALPHA=$(mediaproc image info image.png --json | jq -r '.format.hasAlpha')
$ echo $HAS_ALPHA
true
Terminal
$ SIZE=$(mediaproc image info photo.jpg --json | jq -r '.file.size')
$ echo $SIZE
2570240

Batch Information Gathering

Terminal
$ for img in *.jpg; do echo "=== $img ==="; mediaproc image info "$img"; echo; done
=== photo1.jpg ===
Size: 2.1 MB • 3840×2160 • JPEG
=== photo2.jpg ===
Size: 1.8 MB • 3264×2448 • JPEG
Terminal
$ for img in *.png; do mediaproc image info "$img" --json >> images-info.json; done
✓ Exported metadata for 23 images

Information Displayed

Standard Mode

File Information:

  • File name and full path
  • File size (formatted: KB, MB, GB)
  • Raw file size in bytes

Image Details:

  • Format type (JPEG, PNG, WebP, etc.)
  • Dimensions (width × height in pixels)
  • Aspect ratio (calculated)
  • Color space (RGB, sRGB, CMYK, Grayscale)
  • Number of channels
  • Bit depth per channel
  • Alpha channel presence
  • Density/DPI (if available)
  • Orientation value (1-8)

Verbose Mode (-v)

Everything from standard mode plus:

EXIF Metadata:

  • Camera make and model
  • Capture date and time
  • ISO speed
  • Aperture (f-number)
  • Shutter speed
  • Focal length
  • Software used
  • GPS coordinates (if available)

Color Profile:

  • ICC profile data
  • Color space information

Additional Metadata:

  • IPTC data
  • XMP data

Output Examples

Standard Output

ℹ️ photo.jpg ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 📁 File Information Path: /path/to/photo.jpg Size: 2.45 MB 🖼️ Image Details Format: JPEG Dimensions: 4032 × 3024 pixels Aspect Ratio: 1.33 Color Space: srgb Channels: 3 Bit Depth: uchar Alpha Channel: No Density: 72 DPI

JSON Output

{
  "file": {
    "name": "photo.jpg",
    "path": "/path/to/photo.jpg",
    "size": 2568903,
    "sizeFormatted": "2.45 MB"
  },
  "format": {
    "type": "jpeg",
    "width": 4032,
    "height": 3024,
    "space": "srgb",
    "channels": 3,
    "depth": "uchar",
    "density": 72,
    "hasAlpha": false,
    "orientation": 1
  },
  "exif": null
}

Use Cases

Quality Verification

Terminal
$ mediaproc image info product.jpg
Dimensions: 2400×1800 • Format: JPEG • Size: 1.2 MB
Image Resolution Check
$ WIDTH=$(mediaproc image info image.jpg --json | jq -r '.format.width')
$ if [ $WIDTH -lt 1920 ]; then echo "Image too small for web"; fi
Image too small for web

Pre-Processing Inspection

$ mediaproc image info source.png
Terminal
$ mediaproc image info artwork.tiff -v
Format: TIFF
Color Space: cmyk
Bit Depth: 16-bit
✓ Ready for print

Batch Quality Control

Terminal
$ for img in uploads/*.jpg; do
$ INFO=$(mediaproc image info "$img" --json)
$ WIDTH=$(echo $INFO | jq -r '.format.width')
$ HEIGHT=$(echo $INFO | jq -r '.format.height')
$ if [ $WIDTH -lt 800 ] || [ $HEIGHT -lt 600 ]; then
$ echo "$img: Too small ($WIDTH×$HEIGHT)"
$ fi
$ done
uploads/thumb1.jpg: Too small (640×480)
uploads/thumb2.jpg: Too small (720×540)

Metadata Extraction

Terminal
$ mediaproc image info photo.jpg -v
File: photo.jpg
Size: 2.45 MB
Dimensions: 4032×3024
Camera: Canon EOS 5D Mark IV
ISO: 400 • f/2.8 • 1/250s
Focal Length: 85mm
Terminal
$ mediaproc image info image.jpg --json > metadata.json
✓ Metadata exported to metadata.json

Technical Details

Supported Formats

All Sharp-supported formats:

  • JPEG/JPG
  • PNG
  • WebP
  • AVIF
  • TIFF
  • GIF
  • SVG
  • HEIF/HEIC

Color Spaces

  • sRGB: Standard RGB (most common)
  • RGB: Generic RGB
  • CMYK: Print color space
  • Lab: Device-independent
  • Grayscale: Single channel
  • B-W: Black and white

Orientation Values

EXIF orientation tag (1-8):

  • 1: Normal (no rotation)
  • 2: Flipped horizontally
  • 3: Rotated 180°
  • 4: Flipped vertically
  • 5: Rotated 90° CW + flipped
  • 6: Rotated 90° CW
  • 7: Rotated 90° CCW + flipped
  • 8: Rotated 90° CCW

JSON Integration

Parse with jq

Terminal
$ mediaproc image info img.jpg --json | jq '.format | {width, height}'
{
"width": 3840,
"height": 2160
}
Terminal
$ ORIENTATION=$(mediaproc image info photo.jpg --json | jq -r '.format.orientation')
$ echo $ORIENTATION
6
Terminal
$ SIZE_MB=$(mediaproc image info img.png --json | jq -r '.file.size / 1024 / 1024')
$ echo $SIZE_MB
2.45

Parse with Node.js

const { execSync } = require("child_process");

const info = JSON.parse(
  execSync("mediaproc image info photo.jpg --json").toString(),
);

console.log(`Dimensions: ${info.format.width}×${info.format.height}`);
console.log(`Format: ${info.format.type}`);
console.log(`Size: ${info.file.sizeFormatted}`);

Parse with Python

import json
import subprocess

result = subprocess.run(
    ['mediaproc', 'image', 'info', 'photo.jpg', '--json'],
    capture_output=True,
    text=True
)

info = json.loads(result.stdout)
print(f"Dimensions: {info['format']['width']}×{info['format']['height']}")

Tips

  • Use --json for scripting and automation workflows
  • Verbose mode shows camera EXIF data from photos
  • Pipe JSON to jq for easy parsing and filtering
  • Combine with batch to inspect multiple files efficiently
  • Check orientation before rotating to avoid double-rotation
  • Verify color space before converting for print vs web
  • Use in CI/CD to validate uploaded image specifications

Troubleshooting

No EXIF data shown

  • Not all images have EXIF data
  • EXIF may have been stripped during processing
  • Use verbose mode (-v) to check for EXIF
  • Try a specialized EXIF tool for detailed parsing

JSON parse errors

  • Ensure JSON output is complete
  • Check for error messages before JSON
  • Validate JSON with jq or online validator

File not found

  • Check file path is correct
  • Verify file extension is supported
  • Use absolute paths to avoid confusion

See Also

  • stats - Technical image statistics
  • metadata - Manage EXIF/IPTC/XMP metadata
  • batch - Process multiple images
  • convert - Format conversion

Found an issue? Help us improve this page.

Edit on GitHub →