#!/usr/bin/env node

const sharp = require('sharp');

const input = process.argv[2];

if (!input) {
  console.error('Usage: image-info.js <image-path>');
  process.exit(1);
}

sharp(input)
  .metadata()
  .then(m => {
    console.log(`Size: ${m.width}x${m.height}`);
    console.log(`Format: ${m.format}`);
    if (m.density) console.log(`DPI: ${m.density}`);
    if (m.hasAlpha) console.log(`Alpha: yes`);
    if (m.orientation) console.log(`Orientation: ${m.orientation}`);
  })
  .catch(err => {
    console.error('Error:', err.message);
    process.exit(1);
  });
