bash - Imagemagick caption text with shadow on top of resized image in one command -
i'm making quick bash/imagemagick script that
- takes image
- crops , resizes image
- overlays shadow of caption text sized box
- 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"
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
Post a Comment