bash - Imagemagick caption text with shadow on top of resized image in one command -


i'm making quick bash/imagemagick script that

  1. takes image
  2. crops , resizes image
  3. overlays shadow of caption text sized box
  4. overlays white caption text sized same back

and puts final image.

i able resized image background , shadow of text on top. however, haven't been yet able white text on top of shadow text.

how can achieve desired output in single imagemagick command (and without png offset gimp complains when open result image)?

the code:

#!/bin/bash  text="beef meatball filet mignon, andouille biltong sausage kielbasa. landjaeger pancetta shankle, ham hock beef corned beef kevin meatball beef ribs short ribs. landjaeger biltong shoulder, salami brisket shank bresaola leberkas tail corned beef jowl ham pig. venison pork loin capicola ham hock pastrami, turducken ground round prosciutto landjaeger bacon t-bone."  image="abstract-waves-on-a-blue-background.jpg"  width=1024 height=768  padding=100  text_width=$(( $width-$padding )) text_height=$(( $height-$padding ))  convert \     -size "${text_width}x${text_height}" \     -background none \     -gravity center \     -fill white \     caption:"${text}" \     -background none \     -shadow 80x3+0+0 \     +repage \     \( \     "${image}" \     -resize "${width}x${height}^" \     -gravity center \     -crop "${width}x${height}+0+0" \     \) \     +swap \     -gravity center \     -composite \     "output.png" 

this output i'm getting: bad output output i'd like: good output

you close... think need this:

#!/bin/bash  text="beef meatball filet mignon, andouille biltong sausage kielbasa. landjaeger pancetta shankle, ham hock beef corned beef kevin meatball beef ribs short ribs. landjaeger biltong shoulder, salami brisket shank bresaola leberkas tail corned beef jowl ham pig. venison pork loin capicola ham hock pastrami, turducken ground round prosciutto landjaeger bacon t-bone."  image="bg.png"  width=1024 height=768  padding=100  text_width=$(( $width-$padding )) text_height=$(( $height-$padding ))  convert \     -size "${text_width}x${text_height}" \     -background none \     -gravity center \     -fill white \     caption:"${text}" \( +clone -shadow 80x3+0+0 \) +swap -layers merge \     +repage \     \( \     "${image}" \     -resize "${width}x${height}^" \     -gravity center \     -crop "${width}x${height}+0+0" \     \) \     +swap \     -gravity center \     -composite +repage \     "output.png" 

Comments

Popular posts from this blog

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

serialization - Convert Any type in scala to Array[Byte] and back -

SonarQube Plugin for Jenkins does not find SonarQube Scanner executable -