Skip to content

Instantly share code, notes, and snippets.

@raveensrk
Created August 27, 2023 15:09
Show Gist options
  • Save raveensrk/dbdaa2e2681b53243aa78d74d4a7bd20 to your computer and use it in GitHub Desktop.
Save raveensrk/dbdaa2e2681b53243aa78d74d4a7bd20 to your computer and use it in GitHub Desktop.
How to square fit image using Bash and FFMPEG
#!/usr/bin/env bash
name=$(strip_extension "$1")
output_file_name="${name}-square.jpg"
ffmpeg -i "$1" -vf "scale='min(1080,iw)':'min(1080,ih)',pad=1080:1080:(1080-iw)/2:(1080-ih)/2" "$output_file_name"
echo "$output_file_name"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment