Fred's ImageMagick Scripts



    Licensing:

    Copyright © Fred Weinhaus

    My scripts are available free of charge for non-commercial (non-profit) use, ONLY.

    For use of my scripts in commercial (for-profit) environments or non-free applications, please contact me (Fred Weinhaus) for licensing arrangements. My email address is fmw at alink dot net.

    If you: 1) redistribute, 2) incorporate any of these scripts into other free applications or 3) reprogram them in another scripting language, then you must contact me for permission, especially if the result might be used in a commercial or for-profit environment.

    Usage, whether stated or not in the script, is restricted to the above licensing arrangements. It is also subject, in a subordinate manner, to the ImageMagick license, which can be found at: http://www.imagemagick.org/script/license.php

    Please read the Pointers For Use on my home page to properly install and customize my scripts.

TEXTEFFECT2


Converts large size text to an image with color, effects and styling.

Download Script

last modified: November 09, 2021



USAGE: texteffect2 -t "some text" [-f font] [-p pointsize] [-e effect] [-c colors] [-s style] [-m mirror] [-mf mirrorfade] [-sc strokecolor] [-gc glowcolor] [-tf texturefile] [-lw linewidth] [-hw hardshadowwidth] [-sw shadowwidth] [-gw glowwidth] [-i intensity] [-h hardness] [-mg mirrorgap] [-pd pad] [-bg bgcolor] [-r rounding] [-d direction] [-ct chrometype] [-rt resizetexture] [-fv fuzzvalueue] [-ff fadefactor] [-B brightness] [-C contrast] outfile

USAGE: texteffect2 [-help]

-t .... "some text" ........ text to use; enclose in double quotes
-f .... font ............... fontname; recommend a broad/wide font;
............................ default=Ubuntu-Bold
-p .... pointsize .......... pointsize for font; integer>0; default=200;
-e .... effect ............. effect for text: choices are normal, bevel and
............................ chrome; default=normal
-c .... colors ............. color or colors of text; default=red
-s .... style .............. text style; choices are: plain, stroke,
............................ hardshadow, shadow or glow; default=plain
-m .... mirror ............. mirror text; choices are: yes or no;
............................ default=no
-mf ... mirrorfade ......... fade the bottom of the mirror image; choices
............................ are yes or no; default=no
-sc ... strokecolor ........ stroke color; default=black
-gc ... glowcolor .......... glow color; default=black
-tf ... texturefile ........ path to texture file; default is no texture
-lw ... linewidth .......... stroke line width; integer>0; default=3
-hw ... hardshadowwidth .... hard shadow width; integer>0; default=5
-sw ... shadowwidth ........ shadow width; integer>0; default=5
-gw ... glowwidth .......... glow width; integer>0; default=7
-i .... intensity .......... intensity of shadow and glow; 0<=integer<=100;
............................ default=50
-h .... hardness ........... hardness of shadow and glow; 0<=integer<=100;
............................ default=50
-mg ... mirrorgap .......... gap between mirror top and bottom; integer>=0;
............................ default=0
-pd ... pad ................ pad of output; integer>=0; default=0
-bg ... bgcolor ............ background color; default=none
-r .... rounding ........... rounding for bevel and chrome; default for
............................ bevel=8; default for chrome=4
-d .... direction .......... direction for multi-color gradient rainbow
............................ when colors is more than one color; choices
............................ are: horizontal or vertical; default=horizontal
-ct ... chrometype ......... chrome type; choices are inner and outer;
............................ default=inner
-rt ... resizetexture ...... resize the texture to fit the text area or
............................ just crop at full resolution; choices are:
............................ yes (for resize) or no (for just crop);
............................ default=yes
-fv ... fuzzvalue .......... fuzz value as percent for trimming output;
............................ integer>=0; default=0
-ff ... fadefactor ......... fade factor for mirror fade; 0<=float<=1;
............................ default=0.5
-B .... brightness ......... brightness change for output;
............................ -100<=integer<=100; default=0
-C .... contrast ........... contrast change for output;
............................ -100<=integer<=100; default=0

PURPOSE: To convert large size text to an image with color, effects and styling.

DESCRIPTION: TEXTEFFECT2 converts large size text to an image with color, effects and styling. Effect choices include: normal, bevel and chrome. Style choices include: plain, stroke, hardshadow, shadow and glow.

ARGUMENTS:

-t "some text" ... The text to use. Required parameter. Be sure to enclose it in double quotes.

-f font ... FONT is the desired font for the text. Recommend using a broad (wide) font. The default=Ubuntu-Bold.

-p pointsize ... POINTSIZE is the desired pointsize for the font. The output image will be generated to the size consistent with this pointsize (apart from any padding added). The default is 200.

-e effect ... EFFECT is the effect for the text. The choices are: normal, bevel or chrome. The default=normal.

-c colors ... COLOR(S) to apply to the text. Any single or list of colors may be used. If more than one color is provide, a gradient or rainbow style will be applied to the text. Multiple colors take precedent over a textfile. The default is skyblue. See http://imagemagick.org/script/color.php for color definition.

-s style ... STYLE is the style applied to the text. The choices are: plain, stroke, hardshadow, shadow or glow. The default=plain.

-m mirror ... MIRROR applies a mirror style to the text. The choices are: yes or no. The default=no.

-mf mirrorfade ... MIRRORFADE fades the bottom of the mirror image. The choices are yes or no. The default=no.

-sc strokecolor ... STROKECOLOR is the stroke color. The default=black.

-gc glowcolor ... GLOWCOLOR is the glow color. The default=black.

-tf texturefile ... TEXTUREFILE is the path to a texture file that will be applied to the text. The default is no texture file. Multiple colors take precedent over a texture file. A texture file take precedent over a single color.

-lw linewidth ... LINEWIDTH is the outline stroke thickness in pixels. Values are integers greater than 0. The default=3.

-hw hardshadowwidth ... HARDSHADOWWIDTH is the hardshadow thickness in pixels. Values are integers greater than 0. The default=5. Hardshadow color is black.

-sw shadowwidth ... SHADOWWIDTH is the (soft) shadow thickness in pixels. Values are integers greater than 0. The default=5. Shadow color is black.

-gw glowwidth ... GLOWWIDTH is the glow thickness in pixels. Values are integers greater than 0. The default=5.

-i intensity ... INTENSITY is the intensity of the shadow or glow. Values are 0<=integers<=100. The default=50

-h hardness ... HARDNESS is the hardness (darkness) of the shadow or glow. Values are 0<=integesr<=100. The default=50.

-mg mirrorgap ... MIRRORGAP is the gap between the mirror top and bottom. Values are integers>=0. The default=0

-pd pad PAD is the padding of the output. Values are integers>=0. The default=0.

-bg bgcolor ... BGCOLOR is the background color. The default=none (transparent).

-r rounding ... ROUNDING is the rounding applied for the bevel and chrome effects. Values are integers>0. The default for bevel=8 and the default for chrome=4.

-d direction ... DIRECTION is the direction for the multi-color gradient or rainbow when colors is more than one color. The choices are: horizontal or vertical. The default=horizontal.

-ct chrometype ... CHROMETYPE is the chrome type. The choices are: inner or outer. The default=inner.

-rt resizetexture ... RESIZETEXTURE is the the chhoice to either resize the texture to fit the text area or just crop the center of the texture at full resolution. The choices are: yes (for resize) or no (for just crop). The default=yes (resize texturefile).

-fv fuzzvalue ... FUZZVALUE is the fuzz value expressed as percent value (without the % symbol) for trimming of the output. Values are 0<=integers<=100. The default=0.

-ff fadefactor ... FADEFACTOR is the fade factor for the mirror fade. Values are 0<=floats<=1. The default=0.5. Smaller values make more of the text transparent and so fade faster. A value of 1 produces a linear fade from the top of the mirror section to its bottom.

-B brightness ... BRIGHTNESS is the brightness change for the output. Values are -100<=integers<=100. The default=0.

-C contrast ... CONTRAST is the contrast change for the output. Values are -100<=integers<=100. The default=0.

CAVEAT: No guarantee that this script will work on all platforms, nor that trapping of inconsistent parameters is complete and foolproof. Use At Your Own Risk.


EXAMPLES


Normal Text Effects

 

Normal Single Color Plain Text
Arguments:
-t "normal" -e normal -s plain -f Ubuntu-Bold -p 200 -c red -bg none

 

Normal Single Color Stroke Text
Arguments:
-t "normal" -e normal -s stroke -f Ubuntu-Bold -p 200 -c red -sc blue -lw 3 -bg none

 

Normal Single Color Hardshadow Text
Arguments:
-t "normal" -e normal -s hardshadow -f Ubuntu-Bold -p 200 -c red -hw 5 -bg none

 

Normal Single Color Shadow Text
Arguments:
-t "normal" -e normal -s shadow -f Ubuntu-Bold -p 200 -c red -sw 5 -bg none

 

Normal Single Color Glow Text
Arguments:
-t "normal" -e normal -s glow -f Ubuntu-Bold -p 200 -c red -gc red -gw 7 -bg none

 

Normal Single Color Stroke Mirror Text
Arguments:
-t "normal" -e normal -s stroke -f Ubuntu-Bold -p 200 -c "red" -lw 3 -m yes -mf yes -mg 20 -bg none

 

Normal Texture Plain Text
Arguments:
-t "normal" -e normal -s plain -f Ubuntu-Bold -p 200 -tf "CrackedTexture1920x1080.png" -bg none

 

Normal Texture Stroke Text
Arguments:
-t "normal" -e normal -s stroke -f Ubuntu-Bold -p 200 -tf "CrackedTexture1920x1080.png" -sc black -lw 3 -bg none

 

Normal Texture Hardshadow Text
Arguments:
-t "normal" -e normal -s hardshadow -f Ubuntu-Bold -p 200 -tf "CrackedTexture1920x1080.png" -hw 5 -bg none

 

Normal Texture Shadow Text
Arguments:
-t "normal" -e normal -s shadow -f Ubuntu-Bold -p 200 -tf "CrackedTexture1920x1080.png" -sw 5 -bg none

 

Normal Texture Glow Text
Arguments:
-t "normal" -e normal -s glow -f Ubuntu-Bold -p 200 -tf "CrackedTexture1920x1080.png" -gc black -gw 7 -bg none

 

Normal Multi-Color Plain Text
Arguments:
-t "normal" -e normal -s plain -f Ubuntu-Bold -p 200 -c "red lime" -bg none

 

Normal Multi-Color Stroke Text
Arguments:
-t "normal" -e normal -s stroke -f Ubuntu-Bold -p 200 -c "red lime" -sc blue -lw 3 -bg none

 

Normal Multi-Color Hardshadow Text
Arguments:
-t "normal" -e normal -s hardshadow -f Ubuntu-Bold -p 200 -c "red lime" -hw 5 -bg none

 

Normal Multi-Color Shadow Text
Arguments:
-t "normal" -e normal -s shadow -f Ubuntu-Bold -p 200 -c "red lime" -sw 5 -bg none

 

Normal Multi-Color Color Glow Text
Arguments:
-t "normal" -e normal -s glow -f Ubuntu-Bold -p 200 -c "red lime" -gc black -gw 7 -bg none

 



Bevel Text Effects

 

Bevel Single Color Plain Text
Arguments:
-t "bevel" -e bevel -s plain -f Ubuntu-Bold -p 200 -c red -bg none

 

Bevel Single Color Stroke Text
Arguments:
-t "bevel" -e bevel -s stroke -f Ubuntu-Bold -p 200 -c red -sc blue -lw 3 -bg none

 

Bevel Single Color Hardshadow Text
Arguments:
-t "bevel" -e bevel -s hardshadow -f Ubuntu-Bold -p 200 -c red -hw 5 -bg none

 

Bevel Single Color Shadow Text
Arguments:
-t "bevel" -e bevel -s shadow -f Ubuntu-Bold -p 200 -c red -sw 5 -bg none

 

Bevel Single Color Glow Text
Arguments:
-t "normal" -e bevel -s glow -f Ubuntu-Bold -p 200 -c red -gc red -gw 7 -bg none

 

Bevel Texture Plain Text
Arguments:
-t "bevel" -e bevel -s plain -f Ubuntu-Bold -p 200 -tf "CrackedTexture1920x1080.png" -bg none

 

Bevel Texture Stroke Text
Arguments:
-t "bevel" -e bevel -s stroke -f Ubuntu-Bold -p 200 -tf "CrackedTexture1920x1080.png" -sc black -lw 3 -bg none

 

Bevel Texture Hardshadow Text
Arguments:
-t "bevel" -e bevel -s hardshadow -f Ubuntu-Bold -p 200 -tf "CrackedTexture1920x1080.png" -hw 5 -bg none

 

Bevel Texture Shadow Text
Arguments:
-t "bevel" -e bevel -s shadow -f Ubuntu-Bold -p 200 -tf "CrackedTexture1920x1080.png" -sw 5 -bg none

 

Bevel Texture Glow Text
Arguments:
-t "bevel" -e bevel -s glow -f Ubuntu-Bold -p 200 -tf "CrackedTexture1920x1080.png" -gc black -gw 7 -bg none

 

Bevel Multi-Color Plain Text
Arguments:
-t "bevel" -e bevel -s plain -f Ubuntu-Bold -p 200 -c "red blue" -bg none

 

Bevel Multi-Color Stroke Text
Arguments:
-t "bevel" -e bevel -s stroke -f Ubuntu-Bold -p 200 -c "red blue" -sc black -lw 3 -bg none

 

Bevel Multi-Color Hardshadow Text
Arguments:
-t "bevel" -e bevel -s hardshadow -f Ubuntu-Bold -p 200 -c "red blue" -hw 5 -bg none

 

Bevel Multi-Color Shadow Text
Arguments:
-t "bevel" -e bevel -s shadow -f Ubuntu-Bold -p 200 -c "red blue" -sw 5 -bg none

 

Bevel Multi-Color Color Glow Text
Arguments:
-t "bevel" -e bevel -s glow -f Ubuntu-Bold -p 200 -c "red lime" -gc black -gw 7 -bg none

 



Chrome Text Effects

 

Chrome Single Color Plain Text
Arguments:
-t "chrome" -e chrome -s plain -f Ubuntu-Bold -p 200 -c red -bg none

 

Chrome Single Color Stroke Text
Arguments:
-t "chrome" -e chrome -s stroke -f Ubuntu-Bold -p 200 -c red -sc blue -lw 3 -bg none

 

Chrome Single Color Hardshadow Text
Arguments:
-t "chrome" -e chrome -s hardshadow -f Ubuntu-Bold -p 200 -c red -hw 5 -bg none

 

Chrome Single Color Shadow Text
Arguments:
-t "chrome" -e chrome -s shadow -f Ubuntu-Bold -p 200 -c red -sw 5 -bg none
Chrome Single Color Glow Text
Arguments:
-t "chrome" -e chrome -s glow -f Ubuntu-Bold -p 200 -c red -gc red -gw 7 -bg none

 



What the script does is as follows:

  • Determines the output size by drawing the text once and trimming
  • Creates an image from the text with the specified font, pointsize, effect, style and colors

This is equivalent to the following IM commands for the case of effect=normal and style=plain:

  • buff=`convert xc: -format "%[fx:round(3*($strokewidth+$glowamt+$shadowamt+$hardshadowamt)/2)]" info:`
  • size=`convert -background none -font "$font" -pointsize $pointsize -gravity west -fill $colors \
    label:"$text" -bordercolor none -border ${buff} -format "%wx%h" info:`
  • eval 'convert -background none -size $size -font "$font" \
    -pointsize $pointsize -fill $colors -gravity west label:"$text" \
    -fuzz $fuzzvalue% -trim +repage \
    $tmpA1'
  • convert $tmpA1 \
    -background $bgcolor -flatten \
    -gravity center -bordercolor $bgcolor -border $pad \
    "$outfile"