линкомаулия soft for free
Welcome Phrase


What is Glitter?

Somebody from you would say what Glitter is a movie of 2001 with Mariah Carey in the role of young singer (IMDB - Glitter). It's true but our question is about other Glitter what meaning something like "It's such a clear night that the sky is glittering with stars, do come and look" or just "All is not gold that glitters" :) You can also view various meanings of this word on Wikipedia. With these meanings I'll follow the article below to explain how to create Glitter Text yourself with help of PHP and ImageMagick. Let's start!

ImageMagick and Animated Text

On ImageMagick Site you can find use of this incredible tool to create sorts of graphics, animations, convertions and various effects. Generally, ImageMagick is a library of Image Processing Alogorithms. These can be access via the command line, and shell/dos scripts. I've used it in PHP with "exec" function. But you may not limit to PHP language, you can use C, C++, Perl, Ruby, PHP, etc, etc, etc. (see ImageMagick API's)

The default way ImageMagick handles the output of a image list is to generate a multi-page image. See details on ImageMagick v6 Examples -- Animation Basics page. Also we'll need to use Text to Image Handling. If we can tile text with any image and combine this action with animation then we can create exactly what we need - Glitter Text if in advance we have set of fonts and set of glitter graphics.

Tile example:
convert -size 320x100 xc:lightblue -font 'path_to_font.ttf'
-pointsize 72 -tile 'path_to_tile_graphics.gif' -stroke Black
-strokewidth 2 -gravity center -draw "text 0,0 'Anthony'" test_image.gif

You can just leave out these lines and go to direct code of glitter making. I'm trying to explain here how did I came to this idea.

Animation example:
convert rose: -compose Screen \
\( -clone 0 stars1.gif -composite \) \
\( -clone 0 stars2.gif -composite \) \
\( -clone 0 stars3.gif -composite \) \
-delete 0 -set delay 25 -layers Optimize rose_sparkle.gif

I think examples above are quite enough to understand the main idea and to create Code for Glitter Making yourself. If you still not tired to read this article then I'm very appreciate this and hope you will find here exactly the same what you looked for a long time ago :)

Glitter Text from Command Line

Rely on described above I've created Tool for Creating Glitter Text and this is time to explain and show my command line. It just one line. Don't you believe? Look!

For example, you have following glitter graphics:

Glitter

Parameters for this tile are:
tile.gif[0] GIF 61x29 61x29+0+0 PseudoClass 256c 8-bit 6.64844kb
tile.gif[1] GIF 61x29 61x29+0+0 PseudoClass 256c 8-bit 6.64844kb
tile.gif[2] GIF 61x29 61x29+0+0 PseudoClass 256c 8-bit 6.64844kb

I'll use following Comic font (comic.ttf) what you can download from your fonts folder (in Windows OS) or you can use any of True Type fonts with .ttf extension.

Comic Font

My command line will be look like this:
-background transparent \
-font 'comic.ttf' \
-pointsize 72 \
label:'Glitter Text' \
-stroke black -strokewidth 2 \
\
\( -clone 0 -tile 'tile.gif[0]' \
    -stroke black -strokewidth 2 \
    -gravity center -annotate +0+0 'Glitter Text' \) \
\( -clone 0 -tile 'tile.gif[1]' \
    -stroke black -strokewidth 2 \
    -gravity center -annotate +0+0 'Glitter Text' \) \
\( -clone 0 -tile 'tile.gif[2]' \
    -stroke black -strokewidth 2 \
    -gravity center -annotate +0+0 'Glitter Text' \) \
\
-delete 0 -set delay 15 -loop 0 -trim +repage \
-layers Optimize 'result.gif'

Resulg Glitter

I forget to say what you should know time of delay of your glitter animation what you can determine with help of identify command with -verbose attribute:
identify -verbose tile.gif
It's all. Nothing to say and nothing to add, just one command line! ;)

If you want to code this on PHP then see continuation below.

Making Glitter: PHP Code Example

exec("/usr/bin/identify -verbose '{$tile}'", $result); $result = implode(' ', $result); preg_match("/delay\:\s*([0-9]+)x.*?scene\:[0-9\s]+of\s+([0-9]+)/msi", $result, $matches); $glitter['delay'] = $matches[1]; $glitter['scenes'] = $matches[2]; $string = " -background transparent" . " -font '{$font}'". " -pointsize {$attr['fontsize']}". " label:'{$attr['text']}'". ($attr['strokesize'] ? " -stroke black -strokewidth {$attr['strokesize']}" : ""). ""; for($i=0; $i<$glitter['scenes']; $i++) { $string .= " \( -clone 0 -tile '{$tile}[{$i}]'". ($attr['strokesize'] ? " -stroke black -strokewidth {$attr['strokesize']}" : ""). " -gravity center -annotate +0+0 '{$attr['text']}' \)"; } $string .= " -delete 0 -set delay {$glitter['delay']} -loop 0 -trim +repage". " -layers Optimize '{$respath}'"; exec("/usr/bin/convert {$string}");

I've shown code to you without any comments cause I think you are expert in PHP. If not, then post comment on digg.com and I'll reply to you. Also code above is not all of my php code, some small issues was omitted. For details see how it works on my glitter site.

Use of Glitter Text in Social Networks

Good, now we have created some glitter text, but how we can use it? There are a lot of use of created glitter - the main of use is a social network sites like MySpace, Xanga, Hi5, Facebook, Orkut or any other forum or blog where you can post comments with HTML Code or BBCode.

Glitters in social networks are very welcoming in area of young people and not only young :) Myspace (or any other social network) graphics are also a part of the decoration to your account. The comments are sayings in pictures or air bubbles and things like that.

Future of Glitter Graphics

The online Internet life of a today's user is full of diverse attractions and also it follows with very strict standards. It's disciplined and fomalized.

Glitter became a trademark of today's amateur aesthetics, and I'm certain that in the future sparkly graphics will become a symbol of our times, like "Under Construction" signs for the 90's. Glitter is everywhere (in the universe of user-generated pages), it has become a meta category.

List of Sites working with Graphics

There are many sites what working with Social Graphics like Glitter text, Glitter words, Graphics, Animations, Helloween Text, wallpapers, screensavers and lot of other categories. Some of them you can find on our Affiliates page. Enjoy!