GD v2

 

Process images using GD Graphics Library.

miyako/4d-plugin-gd-v2

status:=GD Filter(image;filters)
Parameter
Type
Description
image
PICTURE
filters
COLLECTION
status
OBJECT

gdImageSaveAlpha is always set to 1.

Each filter object must have a filter property which should be one of the constants listed below. Additional parameters are shown in the description part:

Image Filters

Constant Type Description
IMG_FILTER_NONE LONGINT 0
IMG_FILTER_NEGATE LONGINT 1 gdImageNegate
IMG_FILTER_GRAYSCALE LONGINT 2 gdImageGrayScale
IMG_FILTER_EDGEDETECT LONGINT 3 gdImageEdgeDetectQuick
IMG_FILTER_EMBOSS LONGINT 4 gdImageEmboss
IMG_FILTER_GAUSSIAN_BLUR LONGINT 5 gdImageCopyGaussianBlurred(radius,sigma)
IMG_FILTER_SELECTIVE_BLUR LONGINT 6 gdImageSelectiveBlur
IMG_FILTER_MEAN_REMOVAL LONGINT 7 gdImageMeanRemoval
IMG_FILTER_SMOOTH LONGINT 8 gdImageSmooth(weight)
IMG_FILTER_CONTRAST LONGINT 9 gdImageContrast(contrast)
IMG_FILTER_BRIGHTNESS LONGINT 10 gdImageBrightness(brightness)
IMG_FILTER_SCATTER LONGINT 11 gdImageScatter(sub;plus)
IMG_FILTER_PIXELATE LONGINT 12 gdImagePixelate(size;mode)
IMG_FILTER_COLORIZE LONGINT 13 gdImageColor(red;green;blue;alpha)
IMG_FILTER_CONVOLUTION LONGINT 14 gdImageConvolution(matrix;div;offset)
status:=GD Animate(images;delay)
Parameter
Type
Description
images
COLLECTION
delay
LONGINT
status
OBJECT
status:=GD Rotate(image;angles{;options})
Parameter
Type
Description
image
PICTURE
angles
COLLECTION
angle (degrees), width, height
options
OBJECT
status
OBJECT

Pass a collection of objects in angles. If the width and height are omitted, the new size is calculated automatically.

sx = abs(gdImageSX(gd_in) * cos(radian)) + abs(gdImageSY(gd_in) * sin(radian));
sy = abs(gdImageSX(gd_in) * sin(radian)) + abs(gdImageSY(gd_in) * cos(radian));

status contains a collection (images). Each element is an object that contains an image and an angle property.

Be default, the images are returned in .png format with alpha channel. Alternatively, pass an options object with red green blue alpha to set the fill colour.