GD_MERGE
NAME
gd_merge - Merge a GD image.
SYNOPSIS
gd_merge(gdsrc:variable, gddst:variable, srcx:integer, srcy:integer, srcw:integer, srch:integer, dstx:integer,dsty:integer,dstw:integer,dsth:integer,angle:integer,gray:true|false, transparent:"string", bgcolor:"string",pourc:integer, truecolor:true|false);
DESCRIPTION
This function is used to merge a GD image.
gd_merge really create a new image if gddst is not specify, so it return the new GD structure. The old GD structure is still valid. gd_free must be call with this new GD structure.
gd_merge is almost identical to gd_resize, except that it merges the two images by an amount specified in the last parameter. If the last parameter is 100, then it will function identically to resize - the source image replaces the pixels in the destination. If, however, the pct parameter is less than 100, then the two images are merged. With pct = 0, no action is taken.
This feature is most useful to highlight sections of an image by merging a solid color with pct = 50:
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.
- gray
- When merging images it preserves the hue of the source by converting the destination pixels to grey scale before the copy operation.
- dstw,dsth
- Width and Height in the destination image.
- pourc
- Merge image width this pourcentage. Default pourcentage 100.
- gdsrc
- Variable must hold a return value from gd_new.
- angle
- Angle to rotate 0 to 360.
- 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
- Specify 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 use 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=<{
%include "/includes/gd.sn";
remove("/html/images/rot1.jpg");
remove("/html/images/rot2.jpg");
imsrc=gd_new(filename:"/html/images/20130708-1944-londres.jpg",truecolor:true);
imdst=gd_new(width:1000,height:1000,bgcolor:Blue,truecolor:true);
gd_merge(gdsrc:imsrc, gddst:imdst,srcx:400,srcy:400,srcw:800,srch:800,dstx:50,dsty:50,pourc:45,gray:true);
gd_write(gd:imsrc,format:"jpg",filename:"/html/images/rot1.jpg");
gd_write(gd:imdst,format:"jpg",filename:"/html/images/rot2.jpg",quality:100);
gd_free(imsrc);
gd_free(imdst);
SEE ALSO
AUTHOR
Written by Pierre Laplante, <laplante@sednove.com>
MODIFICATIONS
1.0 2014-09-09 21:24:14 laplante@sednove.com
2015-04-06 laplante@sednove.com Set pourc default to 100.
Edit