#!/bin/bash
INPUT="$*"
CONVERT='magick'

for file in $INPUT; do
    if [[ -f "$file" && "${file##*.}" == "webp" ]]; then
        output="${file%.webp}.jpg"
        convert "$file" "$output"
        echo "Converted: $file -> $output"
    else
        echo "Skipping: $file (not a .webp file)"
    fi
done

