Skip to content

Instantly share code, notes, and snippets.

@FERR1TE
Last active September 6, 2022 09:00
Show Gist options
  • Save FERR1TE/e5a3cfdebbff25dd3988c6712a658b1c to your computer and use it in GitHub Desktop.
Save FERR1TE/e5a3cfdebbff25dd3988c6712a658b1c to your computer and use it in GitHub Desktop.
#!/bin/sh
# Resizes images with a bounding box that matches Telegram's sticker requirement without making them stretched or adding bars.
# Argument 1: input file (PNG)
# Argument 2: output file (PNG)
ffmpeg -i $1 -vf 'scale=if(gte(a\,512/512)\,min(512\,iw)\,-2):if(gte(a\,512/512)\,-2\,min(512\,ih))' $2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment