Object built-in object

ObjectImage

Image processing objects, used to convert, draw, store and other operations on images

Image object belongs togdmodule, create:

1 2
var img = gd.create(640, 480); var img1 = gd.load(data);

inheritance relationship

member properties

width

Integer, query image width

1
readonly Integer Image.width;

height

Integer, query image height

1
readonly Integer Image.height;

format

Integer, query the image source format, the result isgd.PNG,gd.JPEG,gd.GIF,gd.BMP,gd.WEBP

1
readonly Integer Image.format;

type

Integer, query image type, the result isgd.TRUECOLOR,gd.PALETTE

1
readonly Integer Image.type;

colorsTotal

Integer, query the total number of colors in the image color table

1
readonly Integer Image.colorsTotal;

transparent

Integer, query and set the specified color to be transparent

1
Integer Image.transparent;

progressive

Boolean, query and set whether the image is progressive, only supports jpeg format

1
Boolean Image.progressive;

alphaBlending

Boolean, query and set whether to calculate the alpha layer when drawing, the default is true

1
Boolean Image.alphaBlending;

member function

getData

Return image data according to the specified format

1 2
Buffer Image.getData(Integer format = gd.PNG, Integer quality = 85) async;

Call parameters:

  • format: Integer, specifies the format of the returned data, the allowed value isgd.PNG,gd.JPEG,gd.GIF,gd.BMP,gd.WEBP, the default isgd.PNG
  • quality: Integer, when the format isgd.JPEGorgd.WEBPis used to specify the compression quality. The default is 85. This parameter is ignored in other formats.

Return results:

  • Buffer, returns formatted data

save

Store image data into a stream object in the specified format

1 2 3
Image.save(Stream stm, Integer format = gd.PNG, Integer quality = 85) async;

Call parameters:

  • stm:Stream, specify the stream object to be stored
  • format: Integer, specifies the format of the returned data, the allowed value isgd.PNG,gd.JPEG,gd.GIF,gd.BMP,gd.WEBP, the default isgd.PNG
  • quality: Integer, when the format isgd.JPEGorgd.WEBPis used to specify the compression quality. The default is 85. This parameter is ignored in other formats.

Save the image data to the specified file in the specified format, and the file will be forcibly overwritten.

1 2 3
Image.save(String fname, Integer format = gd.PNG, Integer quality = 85) async;

Call parameters:

  • fname: String, specify the file name
  • format: Integer, specifies the format of the returned data, the allowed value isgd.PNG,gd.JPEG,gd.GIF,gd.BMP,gd.WEBP, the default isgd.PNG
  • quality: Integer, when the format isgd.JPEGis used to specify the compression quality. The default is 85. This parameter is ignored in other formats.

colorAllocate

Apply for a color number for the specified color, forgd.PALETTEImage, color number is palette index, forgd.TRUECOLORImage, color number is rgb encoded value

1 2 3
Integer Image.colorAllocate(Integer red, Integer green, Integer blue);

Call parameters:

  • red: Integer, red component, range is 0-255
  • green: Integer, green component, range is 0-255
  • blue: Integer, blue component, range is 0-255

Return results:

  • Integer, returns the color number, or -1 if unsuccessful.

Apply for a color number for the specified color, forgd.PALETTEImage, color number is palette index, forgd.TRUECOLORImage, color number is rgb encoded value

1
Integer Image.colorAllocate(Integer color);

Call parameters:

  • color: Integer, combined color value, can begd.color, gb.rgb,gd.rgbafunction generation

Return results:

  • Integer, returns the color number, or -1 if unsuccessful.

colorAllocateAlpha

Apply for a color number for the specified color and transparency, forgd.PALETTEImage, color number is palette index, forgd.TRUECOLORImage, color number is rgba encoded value

1 2 3 4
Integer Image.colorAllocateAlpha(Integer red, Integer green, Integer blue, Number alpha);

Call parameters:

  • red: Integer, red component, range is 0-255
  • green: Integer, green component, range is 0-255
  • blue: Integer, blue component, range is 0-255
  • alpha: Number, transparent component, ranging from 0-1.0

Return results:

  • Integer, returns the color number, or -1 if unsuccessful.

Apply for a color number for the specified color and transparency, forgd.PALETTEImage, color number is palette index, forgd.TRUECOLORImage, color number is rgba encoded value

1
Integer Image.colorAllocateAlpha(Integer color);

Call parameters:

  • color: Integer, combined color value, can begd.color, gb.rgb,gd.rgbafunction generation

Return results:

  • Integer, returns the color number, or -1 if unsuccessful.

colorClosest

Find the closest color number for the specified color, forgd.PALETTEImage, color number is palette index, forgd.TRUECOLORImage, color number is rgb encoded value

1 2 3
Integer Image.colorClosest(Integer red, Integer green, Integer blue);

Call parameters:

  • red: Integer, red component, range is 0-255
  • green: Integer, green component, range is 0-255
  • blue: Integer, blue component, range is 0-255

Return results:

  • Integer, returns the color number, or -1 if unsuccessful.

Find the closest color number for the specified color, forgd.PALETTEImage, color number is palette index, forgd.TRUECOLORImage, color number is rgb encoded value

1
Integer Image.colorClosest(Integer color);

Call parameters:

  • color: Integer, combined color value, can begd.color, gb.rgb,gd.rgbafunction generation

Return results:

  • Integer, returns the color number, or -1 if unsuccessful.

colorClosestHWB

Find the closest color number for the specified color. This method uses Hue/White/Black calculation to find the closest color. Forgd.PALETTEImage, color number is palette index, forgd.TRUECOLORImage, color number is rgb encoded value

1 2 3
Integer Image.colorClosestHWB(Integer red, Integer green, Integer blue);

Call parameters:

  • red: Integer, red component, range is 0-255
  • green: Integer, green component, range is 0-255
  • blue: Integer, blue component, range is 0-255

Return results:

  • Integer, returns the color number, or -1 if unsuccessful.

Find the closest color number for the specified color. This method uses Hue/White/Black calculation to find the closest color. Forgd.PALETTEImage, color number is palette index, forgd.TRUECOLORImage, color number is rgb encoded value

1
Integer Image.colorClosestHWB(Integer color);

Call parameters:

  • color: Integer, combined color value, can begd.color, gb.rgb,gd.rgbafunction generation

Return results:

  • Integer, returns the color number, or -1 if unsuccessful.

colorClosestAlpha

Find the closest color number for the specified color and transparency, forgd.PALETTEImage, color number is palette index, forgd.TRUECOLORImage, color number is rgba encoded value

1 2 3 4
Integer Image.colorClosestAlpha(Integer red, Integer green, Integer blue, Number alpha);

Call parameters:

  • red: Integer, red component, range is 0-255
  • green: Integer, green component, range is 0-255
  • blue: Integer, blue component, range is 0-255
  • alpha: Number, transparent component, ranging from 0-1.0

Return results:

  • Integer, returns the color number, or -1 if unsuccessful.

Find the closest color number for the specified color and transparency, forgd.PALETTEImage, color number is palette index, forgd.TRUECOLORImage, color number is rgba encoded value

1
Integer Image.colorClosestAlpha(Integer color);

Call parameters:

  • color: Integer, combined color value, can begd.color, gb.rgb,gd.rgbafunction generation

Return results:

  • Integer, returns the color number, or -1 if unsuccessful.

colorExact

Find the color number corresponding to the specified color, forgd.PALETTEImage, color number is palette index, forgd.TRUECOLORImage, color number is rgb encoded value

1 2 3
Integer Image.colorExact(Integer red, Integer green, Integer blue);

Call parameters:

  • red: Integer, red component, range is 0-255
  • green: Integer, green component, range is 0-255
  • blue: Integer, blue component, range is 0-255

Return results:

  • Integer, returns the color number, or -1 if unsuccessful.

Find the color number corresponding to the specified color, forgd.PALETTEImage, color number is palette index, forgd.TRUECOLORImage, color number is rgb encoded value

1
Integer Image.colorExact(Integer color);

Call parameters:

  • color: Integer, combined color value, can begd.color, gb.rgb,gd.rgbafunction generation

Return results:

  • Integer, returns the color number, or -1 if unsuccessful.

colorExactAlpha

Find the color number corresponding to the specified color and transparency, forgd.PALETTEImage, color number is palette index, forgd.TRUECOLORImage, color number is rgba encoded value

1 2 3 4
Integer Image.colorExactAlpha(Integer red, Integer green, Integer blue, Number alpha);

Call parameters:

  • red: Integer, red component, range is 0-255
  • green: Integer, green component, range is 0-255
  • blue: Integer, blue component, range is 0-255
  • alpha: Number, transparent component, ranging from 0-1.0

Return results:

  • Integer, returns the color number, or -1 if unsuccessful.

Find the color number corresponding to the specified color and transparency, forgd.PALETTEImage, color number is palette index, forgd.TRUECOLORImage, color number is rgba encoded value

1
Integer Image.colorExactAlpha(Integer color);

Call parameters:

  • color: Integer, combined color value, can begd.color, gb.rgb,gd.rgbafunction generation

Return results:

  • Integer, returns the color number, or -1 if unsuccessful.

colorResolve

Find the color number corresponding to the specified color. If the color does not exist, apply for a new color number for it. Forgd.PALETTEImage, color number is palette index, forgd.TRUECOLORImage, color number is rgb encoded value

1 2 3
Integer Image.colorResolve(Integer red, Integer green, Integer blue);

Call parameters:

  • red: Integer, red component, range is 0-255
  • green: Integer, green component, range is 0-255
  • blue: Integer, blue component, range is 0-255

Return results:

  • Integer, returns the color number, or -1 if unsuccessful.

Find the color number corresponding to the specified color. If the color does not exist, apply for a new color number for it. Forgd.PALETTEImage, color number is palette index, forgd.TRUECOLORImage, color number is rgb encoded value

1
Integer Image.colorResolve(Integer color);

Call parameters:

  • color: Integer, combined color value, can begd.color, gb.rgb,gd.rgbafunction generation

Return results:

  • Integer, returns the color number, or -1 if unsuccessful.

colorResolveAlpha

Find the color number corresponding to the specified color and transparency. If the color does not exist, apply for a new color number for it. Forgd.PALETTEImage, color number is palette index, forgd.TRUECOLORImage, color number is rgba encoded value

1 2 3 4
Integer Image.colorResolveAlpha(Integer red, Integer green, Integer blue, Number alpha);

Call parameters:

  • red: Integer, red component, range is 0-255
  • green: Integer, green component, range is 0-255
  • blue: Integer, blue component, range is 0-255
  • alpha: Number, transparent component, ranging from 0-1.0

Return results:

  • Integer, returns the color number, or -1 if unsuccessful.

Find the color number corresponding to the specified color and transparency. If the color does not exist, apply for a new color number for it. Forgd.PALETTEImage, color number is palette index, forgd.TRUECOLORImage, color number is rgba encoded value

1
Integer Image.colorResolveAlpha(Integer color);

Call parameters:

  • color: Integer, combined color value, can begd.color, gb.rgb,gd.rgbafunction generation

Return results:

  • Integer, returns the color number, or -1 if unsuccessful.

colorDeallocate

Release the specified color number. The released color number will be replaced after applying again.

1
Image.colorDeallocate(Integer color);

Call parameters:

  • color: Integer, specifies the color number to be released

clip

Set the drawing clipping window. After setting, all drawings will be clipped inside the window.

1 2 3 4
Image.clip(Integer x1, Integer y1, Integer x2, Integer y2);

Call parameters:

  • x1: Integer, the upper left x coordinate of the clipping window
  • y1: Integer, upper left y coordinate of the clipping window
  • x2: Integer, the lower right x coordinate of the clipping window
  • y2: Integer, the lower right y coordinate of the clipping window

getPixel

Query the color of a specified point

1 2
Integer Image.getPixel(Integer x, Integer y);

Call parameters:

  • x: Integer, specifies the x coordinate of the query
  • y: Integer, specifies the y coordinate of the query

Return results:

  • Integer, returns the color number of the specified point

getTrueColorPixel

Query the true color of the specified position point

1 2
Integer Image.getTrueColorPixel(Integer x, Integer y);

Call parameters:

  • x: Integer, specifies the x coordinate of the query
  • y: Integer, specifies the y coordinate of the query

Return results:

  • Integer, returns the color number of the specified point

setPixel

Draw a point at the specified location

1 2 3
Image.setPixel(Integer x, Integer y, Integer color);

Call parameters:

  • x: Integer, specifies the x coordinate of the drawing point
  • y: Integer, specifies the y coordinate of the drawing point
  • color: Integer, specifies the color number of the drawing point

setThickness

Set the width of the line. The default width when drawing lines using line, rectangle, arc and other methods is one pixel. You can use this method to change the width of the line.

1
Image.setThickness(Integer thickness);

Call parameters:

  • thickness: Integer, the width of the drawn line

line

Draw a line at the specified location

1 2 3 4 5
Image.line(Integer x1, Integer y1, Integer x2, Integer y2, Integer color);

Call parameters:

  • x1: Integer, specifies the starting x coordinate of the line drawing
  • y1: Integer, specifies the starting y coordinate of the line drawing
  • x2: Integer, specifies the end x-coordinate of the line drawing
  • y2: Integer, specifies the end y coordinate of the line drawing
  • color: Integer, specifies the color number of the line drawing

rectangle

Draw a rectangle at the specified location

1 2 3 4 5
Image.rectangle(Integer x1, Integer y1, Integer x2, Integer y2, Integer color);

Call parameters:

  • x1: Integer, specifies the x coordinate of the upper left corner
  • y1: Integer, specifies the y coordinate of the upper left corner
  • x2: Integer, specifies the x coordinate of the lower right corner
  • y2: Integer, specifies the y coordinate of the lower right corner
  • color: Integer, specifies the color number of the rectangle

filledRectangle

Draws a filled rectangle at the specified location

1 2 3 4 5
Image.filledRectangle(Integer x1, Integer y1, Integer x2, Integer y2, Integer color);

Call parameters:

  • x1: Integer, specifies the x coordinate of the upper left corner
  • y1: Integer, specifies the y coordinate of the upper left corner
  • x2: Integer, specifies the x coordinate of the lower right corner
  • y2: Integer, specifies the y coordinate of the lower right corner
  • color: Integer, specifies the color number of the rectangle

polygon

Draws a polygon based on given points

1 2
Image.polygon(Array points, Integer color);

Call parameters:

  • points: Array, an array containing polygon points, such as [[1, 1], [1, 10], [10, 15], [10, 20]]
  • color: Integer, specifies the color number of the rectangle

openPolygon

Draws an open polygon based on the given points

1 2
Image.openPolygon(Array points, Integer color);

Call parameters:

  • points: Array, an array containing polygon points, such as [[1, 1], [1, 10], [10, 15], [10, 20]]
  • color: Integer, specifies the color number of the rectangle

filledPolygon

Draws a filled polygon based on the given points

1 2
Image.filledPolygon(Array points, Integer color);

Call parameters:

  • points: Array, an array containing polygon points, such as [[1, 1], [1, 10], [10, 15], [10, 20]]
  • color: Integer, specifies the color number of the rectangle

ellipse

draw an ellipse

1 2 3 4 5
Image.ellipse(Integer x, Integer y, Integer width, Integer height, Integer color);

Call parameters:

  • x: Integer, x-coordinate of the ellipse center
  • y: Integer, y coordinate of the ellipse center
  • width: Integer, width of ellipse
  • height: Integer, the height of the ellipse
  • color: Integer, specifies the color number of the rectangle

filledEllipse

Draw a filled ellipse

1 2 3 4 5
Image.filledEllipse(Integer x, Integer y, Integer width, Integer height, Integer color);

Call parameters:

  • x: Integer, x-coordinate of the ellipse center
  • y: Integer, y coordinate of the ellipse center
  • width: Integer, width of ellipse
  • height: Integer, the height of the ellipse
  • color: Integer, specifies the color number of the rectangle

arc

draw a fan shape

1 2 3 4 5 6 7
Image.arc(Integer x, Integer y, Integer width, Integer height, Integer start, Integer end, Integer color);

Call parameters:

  • x: Integer, x-coordinate of the sector center
  • y: Integer, y-coordinate of the sector center
  • width: Integer, the width of the ellipse where the sector is located
  • height: Integer, the height of the ellipse where the sector is located
  • start: Integer, the starting angle of the sector, ranging from 0-360
  • end: Integer, the angle at which the sector ends, ranging from 0-360
  • color: Integer, specifies the color number of the rectangle

filledArc

Draw a filled sector

1 2 3 4 5 6 7 8
Image.filledArc(Integer x, Integer y, Integer width, Integer height, Integer start, Integer end, Integer color, Integer style = gd.ARC);

Call parameters:

  • x: Integer, x-coordinate of the sector center
  • y: Integer, y-coordinate of the sector center
  • width: Integer, the width of the ellipse where the sector is located
  • height: Integer, the height of the ellipse where the sector is located
  • start: Integer, the starting angle of the sector, ranging from 0-360
  • end: Integer, the angle at which the sector ends, ranging from 0-360
  • color: Integer, specifies the color number of the rectangle
  • style: Integer, specifies the style of the fan shape, the allowed values ​​aregd.ARC,gd.CHORD,gd.NOFILL,gd.EDGEDand combinations thereof

fill

Fill the enclosed area starting from the specified point

1 2 3
Image.fill(Integer x, Integer y, Integer color);

Call parameters:

  • x: Integer, x coordinate to start filling
  • y: Integer, y coordinate to start filling
  • color: Integer, specify the fill color number

fillToBorder

Fills the enclosed area within the border of the specified color starting from the specified point

1 2 3 4
Image.fillToBorder(Integer x, Integer y, Integer borderColor, Integer color);

Call parameters:

  • x: Integer, x coordinate to start filling
  • y: Integer, y coordinate to start filling
  • borderColor: Integer, specifies the color number of the border
  • color: Integer, specify the fill color number

colorReplace

Replaces the specified color in the image with a new color

1 2
Image.colorReplace(Integer src, Integer dst) async;

Call parameters:

  • src: Integer, specify the color to be replaced
  • dst: Integer, specify new color

clone

Copy the current image into a new image

1
Image Image.clone() async;

Return results:

  • Image, returns the copied new image object

resample

Stretch the image to create a new size

1 2
Image Image.resample(Integer width, Integer height) async;

Call parameters:

  • width: Integer, specifies the width of the stretch
  • height: Integer, specifies the height of the stretch

Return results:

  • Image, returns a new image object

crop

Cut part of an image into a new image

1 2 3 4
Image Image.crop(Integer x, Integer y, Integer width, Integer height) async;

Call parameters:

  • x: Integer, the upper left x coordinate of the clipping window
  • y: Integer, upper left y coordinate of the clipping window
  • width: Integer, the width of the clipping window
  • height: Integer, the height of the clipping window

Return results:

  • Image, returns the cropped image

flip

Mirror current image

1
Image.flip(Integer dir = gd.HORIZONTAL) async;

Call parameters:


rotate

Rotate current image

1
Image.rotate(Integer dir) async;

Call parameters:


convert

Convert current image type

1
Image.convert(Integer color = gd.TRUECOLOR) async;

Call parameters:


copy

Copy an area from an image to a specified location

1 2 3 4 5 6 7
Image.copy(Image source, Integer dstX, Integer dstY, Integer srcX, Integer srcY, Integer width, Integer height) async;

Call parameters:

  • source: Image, source image object
  • dstX: Integer, specifies the x coordinate of the copy target
  • dstY: Integer, specifies the y coordinate of the copy target
  • srcX: Integer, specifies the x coordinate of the upper left corner of the copy source
  • srcY: Integer, specifies the y coordinate of the upper left corner of the copy source
  • width: Integer, specifies the width of the copy
  • height: Integer, specifies the height of the copy

copyMerge

Copy an area from an image to a specified location

1 2 3 4 5 6 7 8
Image.copyMerge(Image source, Integer dstX, Integer dstY, Integer srcX, Integer srcY, Integer width, Integer height, Integer percent) async;

Call parameters:

  • source: Image, source image object
  • dstX: Integer, specifies the x coordinate of the copy target
  • dstY: Integer, specifies the y coordinate of the copy target
  • srcX: Integer, specifies the x coordinate of the upper left corner of the copy source
  • srcY: Integer, specifies the y coordinate of the upper left corner of the copy source
  • width: Integer, specifies the width of the copy
  • height: Integer, specifies the height of the copy
  • percent: Integer, specifies the transparency of the overlay

copyMergeGray

Copies a grayscale overlay of an area from an image to a specified location

1 2 3 4 5 6 7 8
Image.copyMergeGray(Image source, Integer dstX, Integer dstY, Integer srcX, Integer srcY, Integer width, Integer height, Integer percent) async;

Call parameters:

  • source: Image, source image object
  • dstX: Integer, specifies the x coordinate of the copy target
  • dstY: Integer, specifies the y coordinate of the copy target
  • srcX: Integer, specifies the x coordinate of the upper left corner of the copy source
  • srcY: Integer, specifies the y coordinate of the upper left corner of the copy source
  • width: Integer, specifies the width of the copy
  • height: Integer, specifies the height of the copy
  • percent: Integer, specifies the transparency of the overlay

copyResized

Stretch an area in an image and copy it to a specified location

1 2 3 4 5 6 7 8 9
Image.copyResized(Image source, Integer dstX, Integer dstY, Integer srcX, Integer srcY, Integer dstW, Integer dstH, Integer srcW, Integer srcH) async;

Call parameters:

  • source: Image, source image object
  • dstX: Integer, specifies the x coordinate of the copy target
  • dstY: Integer, specifies the y coordinate of the copy target
  • srcX: Integer, specifies the x coordinate of the upper left corner of the copy source
  • srcY: Integer, specifies the y coordinate of the upper left corner of the copy source
  • dstW: Integer, specifies the copied stretch width
  • dstH: Integer, specifies the copied extrusion height
  • srcW: Integer, specifies the copied source width
  • srcH: Integer, specifies the source height of the copy

copyResampled

Stretch an area in an image and copy it to a specified location. Different from copyResized, this method will dither the image when stretching.

1 2 3 4 5 6 7 8 9
Image.copyResampled(Image source, Integer dstX, Integer dstY, Integer srcX, Integer srcY, Integer dstW, Integer dstH, Integer srcW, Integer srcH) async;

Call parameters:

  • source: Image, source image object
  • dstX: Integer, specifies the x coordinate of the copy target
  • dstY: Integer, specifies the y coordinate of the copy target
  • srcX: Integer, specifies the x coordinate of the upper left corner of the copy source
  • srcY: Integer, specifies the y coordinate of the upper left corner of the copy source
  • dstW: Integer, specifies the copied stretch width
  • dstH: Integer, specifies the copied extrusion height
  • srcW: Integer, specifies the copied source width
  • srcH: Integer, specifies the source height of the copy

copyRotated

Rotate an area in an image and copy it to a specified location

1 2 3 4 5 6 7 8
Image.copyRotated(Image source, Number dstX, Number dstY, Integer srcX, Integer srcY, Integer width, Integer height, Number angle) async;

Call parameters:

  • source: Image, source image object
  • dstX: Number, specifies the x-coordinate of the copy target
  • dstY: Number, specifies the y coordinate of the copy target
  • srcX: Integer, specifies the x coordinate of the upper left corner of the copy source
  • srcY: Integer, specifies the y coordinate of the upper left corner of the copy source
  • width: Integer, specifies the width of the copy
  • height: Integer, specifies the height of the copy
  • angle: Number, specifies the angle of rotation

filter

Apply the filter filterType to the image and pass in the required parameters according to the filter type

1 2 3 4 5
Image.filter(Integer filterType, Number arg1 = 0, Number arg2 = 0, Number arg3 = 0, Number arg4 = 0) async;

Call parameters:

  • filterType: Integer, filter type
  • arg1: Number, parameters required for the filter: smoothing level of SMOOTH, brightness level of BRIGHTNESS, contrast level of CONTRAST, red score of COLORIZE
  • arg2: Number, filter parameters required: green score of COLORIZE
  • arg3: Number, filter parameters required: blue score of COLORIZE
  • arg4: Number, filter parameters required: transparency alpha score of COLORIZE

The parameter filterType can be the following values:

  • MEAN_REMOVAL, using the average removal method to achieve the contour effect
  • EDGEDETECT, use edge detection to highlight the edges of the image
  • EMBOSS, to embosse the image
  • SELECTIVE_BLUR, blurry image
  • GAUSSIAN_BLUR, blur the image using Gaussian algorithm
  • NEGATE, invert all colors in the image
  • GRAYSCALE, convert the image to grayscale
  • SMOOTH, make the image smoother, use arg1 to set the smoothness level
  • BRIGHTNESS, change the brightness of the image, use arg1 to set the brightness level, the value range is -255~255
  • CONTRAST, change the contrast of the image, use arg1 to set the contrast level, the value range is 0~100
  • COLORIZE, change the hue of the image, use arg1, arg2, and arg3 to specify the red, blue, and green scores respectively. The range of each color is 0~255, arg4 is the transparency, and the value returned is 0~127

affine

Affine the current image according to the given matrix

1 2 3 4 5
Image Image.affine(Array affine, Integer x = -1, Integer y = -1, Integer width = -1, Integer height = -1) async;

Call parameters:

  • affine: Array, affine matrix, composed of 6 numbers of double type
  • x: Integer, the x-coordinate of the origin of the optional clipping area
  • y: Integer, the y-coordinate of the origin of the optional clipping area
  • width: Integer, the width of the optional clipping area
  • height: Integer, the height of the optional clipping area

Return results:

  • Image, returns the affine image

The parameter affine is an array:

1 2 3
affine = [a0, a1, b0, b1, a2, b2]; x ' = a0x + a1y + a2; y ' = b0x + b1y + b2;

gaussianBlur

Gaussian blur the current image

1
Image.gaussianBlur(Integer radius) async;

Call parameters:

  • radius: Integer, blur radius

toString

Returns the string representation of the object. Generally, "[Native Object]" is returned. The object can be re-implemented according to its own characteristics.

1
String Image.toString();

Return results:

  • String, returns the string representation of the object

toJSON

Returns a JSON format representation of the object, generally returning a collection of readable properties defined by the object.

1
Value Image.toJSON(String key = "");

Call parameters:

  • key: String, not used

Return results:

  • Value, returns a value containing JSON serializable