Goto main content

gd_new

Create a new image with GD.

GD_NEW

NAME

gd_new - Creates a new image with GD.

SYNOPSIS

gd_new (filename:"string", width:integer, height:integer, transparent:"string", format:"string", bgcolor:"string", truecolor:true|false);

DESCRIPTION

This function is used to create a new image with library GD.

To initialize a new image, you must specify a width and a height or a filename to load.

PARAMETERS

filename
Specifies the initial filename to load.
width
Specifies width of image to create.
height
Specifies height of image to create.
transparent
Specifies transparent color. Transparent color can be specified as bgcolor to use the backgound color. A color is specified as "#XXXXX" or as "255,255,255". Note that JPEG images do not support transparency, so this setting has no effect when writing JPEG images.
bgcolor
Specifies background color. A color is specified as "#XXXXX" or as "255,255,255".
format
Format of the file. This can be gif, jpg, png, gd, gd2, wbmp, xbm, xpm.
truecolor
truecolor, tells new() to create a truecolor GD::Image object. Truecolor images have 24 bits of color data (eight bits each in the red, green and blue channels respectively), allowing for precise photograph-quality color usage. If not specified, the image will use an 8-bit palette for compatibility with older versions of libgd.

RETURN

A pointer to GD structure. Will be used in other functions.

MODULES

To use this module, you must specify the following in /usr/local/website/site.conf:

Module gd {
        Library : "/usr/local/lib/libsngd.so"
        Init : "sngd_init"
}

EXAMPLES

im=gd_new(width:1000,height:1000,bgcolor:"#0000f0",truecolor:true);
im2=gd_new(filename:"/html/images/20130708-1944-londres.jpg",truecolor:true);
im3=gd_new(width:1000,height:1000,bgcolor:"#0000f0",truecolor:true);

SEE ALSO

AUTHOR

Written by Pierre Laplante and Caroline Laplante, <laplante@sednove.com>

MODIFICATIONS

1.0 2014-09-09 21:24:14 laplante@sednove.com

Edit

© 2024 extenso Inc. All rights reserved.