Metallic effect

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Metallic effect

Post by anthony »

Snibgo... why the two separate blurs on the inptu text? I understand one blur, or even a linear blur, but not the two blurs.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Metallic effect

Post by snibgo »

I was replicating the steps from the Gimp tutorial in the OP, showing how each step could be implemented in IM.
snibgo's IM pages: im.snibgo.com
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Metallic effect

Post by anthony »

Okay. Just wondering if you did it to get a specific edge gradient style or something.

I have placed the example in IM Examples, Compound Fonts, at the very bottom
http://www.imagemagick.org/Usage/fonts/#metalic
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Metallic effect

Post by snibgo »

The idea in the Gimp tutorial was that the first blur rounds the ends of the letters. The level could be a threshold. For the metallic effect, the important part is the second blur (added to whatever blur effect remains after the "level").

Since writing that script, I have realised that it doesn't need "identify" to find the size. I used that for the "gradient:", which needs "-size", but instead I can clone the image and use

Code: Select all

-sparse-color Bilinear "0,0 White %%[fx:w-1],0 White 0,%%[fx:h-1] Black %%[fx:w-1],%%[fx:h-1] Black"
snibgo's IM pages: im.snibgo.com
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Metallic effect

Post by anthony »

snibgo wrote:The idea in the Gimp tutorial was that the first blur rounds the ends of the letters. The level could be a threshold. For the metallic effect, the important part is the second blur (added to whatever blur effect remains after the "level").
Okay I understand. it is simply a rounding blur and threshold (using level) followed by the actual blur for the metalllic effect.

Of course some fonts do not need that first 'rounding effect'.

Hmmm increasing that initial rounding effect, could make a animation that causes the text to look like it is melting and puddling into one large blob!
snibgo wrote:Since writing that script, I have realised that it doesn't need "identify" to find the size. I used that for the "gradient:", which needs "-size", but instead I can clone the image and use

Code: Select all

-sparse-color Bilinear "0,0 White %%[fx:w-1],0 White 0,%%[fx:h-1] Black %%[fx:w-1],%%[fx:h-1] Black"

IMv7 can already to directly set -size from an existing image

You could have used Barycentric with only three point.

Or even only two points. -sparse color will automatically calculate a perpendicular third point for barycentric gradients
making linear gradients much easier.

Code: Select all

-sparse-colors Barycentric "0,0 White  0,%[fx:h-1] Black"

Also I find using shaped masks a lot easier to work with than having to mask results constantally using CopyOpacity,
The -alpha operators make using shaped masks a lot easier than you would expect. The only problem with them are alpha channel adjustments using -level

Okay updated the IM Example of this effect to....

Code: Select all

# Generate a blured input font shaped mask
# first blur-level is a rounding or 'puddling' effect
# the second blur is the important one for the metallic effect.
convert -background none -pointsize 160 -font Candice label:" Anthony " \
        -blur 0x5 -channel A -level 40%,60% +channel \
        -blur 0x3    metallic_input.png

# Metallic Color Lookup Table
convert \
  -size 1x1000 gradient:  -gamma 0.9 \
  -function Sinusoid 2.25,0,0.5,0.5 \
  \( gradient:'rgb(100%,100%,80%)-black' -gamma 1 \) \
  +swap \
  -compose Overlay -composite \
  -rotate 90 \
  metallic_clut.png

# Give blurred font a metallic look
#  * first create a vertial gradient
#  * then merge this with a 'shade' reflective gradient
#  * before applying the color to the resulting gradient
#  * finally add a shadow.
convert metallic_input.png -set colorspace RGB \
  \( -clone 0 -alpha off \
     -sparse-color Barycentric "0,0 White  0,%[fx:h-1] Black" \
     -alpha on \
  \) \
  \( -clone 0 -alpha extract -shade 135x45 -auto-gamma -auto-level \
     -alpha on -channel A -level 0%x10% +channel \
  \) \
  -delete 0 -compose Overlay -composite \
  metallic_clut.png -clut  -set colorspace sRGB \
  \
  \( +clone -background navy -shadow 80x2+5+5 \
  \) +swap -background None -compose Over -layers merge \
  \
  -trim +repage metallic.png
The -set colorspace sRGB is needed to make a on screen "display" result the same as the one that appears in a web browser. (image will appear in a few hours)
Image


Hmmm I probably should move the 'Aqua' Effect' techniaue that is in advanced to 'Compound fonts'.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
takwing1hk
Posts: 1
Joined: 2018-02-01T18:40:48-07:00
Authentication code: 1152

Re: Metallic effect

Post by takwing1hk »

can this be done via php without calling the convert executable?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Metallic effect

Post by fmw42 »

You can likely do it with Imagick. But it calls ImageMagick. What do you mean without the convert executable. Do you mean no use of ImageMagick at all? Do you mean using only PHP and HTML5 and such. If the latter, then you should ask your question on another forum, since people on this forum are not specialists in such other tools.
Post Reply