Skip to content

Instantly share code, notes, and snippets.

@avdata99
Created December 23, 2019 02:16
Show Gist options
  • Save avdata99/e60d813a8e2903b62d89dc37eb25dd9b to your computer and use it in GitHub Desktop.
Save avdata99/e60d813a8e2903b62d89dc37eb25dd9b to your computer and use it in GitHub Desktop.
Add text to and image with imagemagick
# https://imagemagick.org/Usage/annotating/
original_image=$1
txt=$2 # texto a anotar
x1=$3 # Coord X (pixeles) donde empieza a escribir
y1=$4 # Coord Y (pixeles) donde empieza a escribir
color=$5 # ej 8808
prefix=$6 # prefijo del nombre de archivo
convert $1 \
-fill "#$5" -annotate +$x1+$y1 "$2" \
IMG-$6-$2.png
# con cuadrado de fondo para que se lea mejor
convert $1 \
-fill '#0008' -draw 'rectangle 205,128,414,145' \
-fill "#$5" -annotate +210+141 "$2" \
IMG-cuadro-$6-$2.png
# LO AGREGA ABAJO DE LA IMAGEN
convert $1 -background Khaki label:"$2" \
-gravity Center \
-append IMG-DOWN-$6-$2.png
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment