The Falcon Programming Language
A fast, easy and powerful programming language
Location: Developers community >> GD2 Library Binding >> Wiki docs
User ID:

GD2 Library Binding

What is GD2 for?

GD2 is a module binding LibGD, which is meant for offline/batch image manipulation. In short, it allows to deal with a set of very common image file formats, manipulate them and save them. Integrating it in a web server (i.e. through the Falcon Apache2 module), you can create server-side dynamic image generators, as in the following example:

Generated image
This is a PNG image dynamically generated through a server-side FTD script:

   load gd2

   img = GdImage( 200, 200 )

   blue = img.ColorAllocate( 10, 10, 90 )
   white = img.ColorAllocate( 0xff, 0xff, 0xff )

   font = gdFontGetMediumBold()

   for i = 1 to 10
       img.String( font, 5, i * 15 + 2, "Hello " + i + " times.", white )

   out = stdOut()
   img.Png( out )


The ability to create graphs from server data (i.e. DB entries) on the fly is quite precious, even when different techniques to generate graphics at the client site are now becoming common.

Go To Page...


Elapsed time: 0.028 secs. (VM time 0.022 secs.)