Goto main content

gd_resize

Resize a GD image.

GD_RESIZE

NAME

gd_resize - Resizes a GD image.

SYNOPSIS

gd_resize (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 call with this new GD structure.

pourc and dw,dh are mutually exclusive.

gd_resize can also be called as gd_resampled which interpolates pixel.

PARAMETERS

srcx,srcy
Initial coordinates in the source image.
srcw,srch
Width and Height of source image.
dstx,dsty
Initial coordinates 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 specified, 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 specify as bgcolor to use the backgound color. A color is specify 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
Specify background color. A color is specify 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);

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.