function

gd_resampled . gd . sncode

VERSIONlatest Resize a GD image.

GD_RESAMPLED(1e)

NAME

gd_resampled - Resizes a GD image.

SYNOPSIS

gd_resampled (gdsrc:variable, gddst:variable, srcx:integer, srcy:integer, srcw:integer, srch:integer, dstx:integer,dsty:integer,dstw:integer,dsth:integer, transparent:"string", bgcolor:"string",pourc:float, truecolor:true|false);

DESCRIPTION

This function is used to resize a GD image.

gd_resize really creates a new image if gddst is not specified, so it returns the new GD structure. The old GD structure is still valid. gd_free must be called with this new GD structure.

pourc and dw,dh are mutually exclusive.

gd_resize can also be called as gd_resampled which interpolate pixel.

PARAMETERS

srcx,srcy
Initial coordinate in the source image.
srcw,srch
Width and Height or source image.
dstx,dsty
Initial coordinate in the destination image.
dstw,dsth
Width and Height in the destination image.
pourc
Resizes image width this pourcentage.
gdsrc
Variable must hold a return value from gd_new.
gddst
Variable must hold a return value from gd_new. If this is not specify, a new image is created.
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.
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".

RETURN

A pointer to the new 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

res=<{
        remove("/html/images/resize1.gif");
        remove("/html/images/resize2.gif");
        remove("/html/images/resize3.gif");
        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);
        gd_resize(gdsrc:im2,gddst:im,dstx:50,dsty:50, dstw:800, dsth:800);
        gd_resampled(gdsrc:im2,gddst:im3,dstx:50,dsty:50, dstw:800, dsth:800);
        gd_write(gd:im,format:"gif",filename:"/html/images/resize1.gif");
        gd_write(gd:im2,format:"gif",filename:"/html/images/resize2.gif");
        gd_write(gd:im3,format:"gif",filename:"/html/images/resize3.gif");
        gd_free(im);
        gd_free(im2);
        gd_free(im3);

AUTHOR

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