Posts

Showing posts from June, 2024

How to Square Images Without Cropping or Downscaling with FFmpeg

Image
set -xef input=$1 dirpath=$(dirname "$input") file_name=$(basename "$input") file_ext="${file_name##*.}" file_name="${file_name%.*}" blurred="$dirpath/blurred-$file_name.$file_ext" output="$dirpath/output-$file_name.$file_ext" width=$(ffprobe -v error -select_streams v:0 -show_entries stream=width -of csv=p=0 "$input") height=$(ffprobe -v error -select_streams v:0 -show_entries stream=height -of csv=p=0 "$input") longer_side="$height" diff_side=$(($height - $width)) # Determine longer side if [ "$width" -gt "$height" ]; then longer_side="$width" diff_side=$(($width - $height)) fi # Calculate canvas dimensions with padding padding=$((50+$diff_side/2)) canvas_side=$((longer_side + 2 * padding)) ffmpeg -i "$input" -vf "scale=$(($canvas_side*2)):-1,gblur=sigma=15,crop=$canvas_side:$canvas_side" -y "$blurred" ffmpeg -i "$

Transliterate Script: Convert Text Across Multiple Languages with Ease

Image

SMS Counter: Automatically Detect Encoding, Character Count, and PDU!

Image