Created
October 2, 2025 17:08
-
-
Save fidepus/fa046299378c58867e9fbc05ec3080a7 to your computer and use it in GitHub Desktop.
Pretty Instagram borders
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # Usage: | |
| # squarefit.sh input.jpg [output.jpg] | |
| # Or batch: | |
| # squarefit.sh *.jpg | |
| # Needs imagemagick installed | |
| set -euo pipefail | |
| W=1080 | |
| H=1350 | |
| OUTDIR="IG_Exports" | |
| # Create output folder if it doesn't exist | |
| mkdir -p "$OUTDIR" | |
| process_one() { | |
| in="$1" | |
| base="$(basename "${in%.*}")" | |
| out="${OUTDIR}/${base}_IG.jpg" | |
| magick \ | |
| \( "$in" -auto-orient -resize ${W}x${H}^ -gravity center -extent ${W}x${H} -blur 0x24 \) \ | |
| \( "$in" -auto-orient -resize x${H} \) \ | |
| -gravity center -compose over -composite \ | |
| -strip -colorspace sRGB -quality 92 "$out" | |
| echo "Made: $out" | |
| } | |
| if [[ $# -eq 0 ]]; then | |
| echo "Drag files onto this script or run: squarefit.sh input.jpg" | |
| exit 1 | |
| fi | |
| for f in "$@"; do | |
| process_one "$f" | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This will create an image and turn it into a the correct format for an Instagram feed post, using a blurred and zoomed in version of the same image as a border.