Object built-in object

Object Image

Image processing objects, used to convert, draw, and store images

The Image object belongs to the gd module and is created:

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

Inheritance

Member attributes

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 is gd.PNG , gd.JPEG , gd.GIF , gd.BMP , gd.WEBP

1
readonly Integer Image.format;

type

Integer, query the image type, the result is gd.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 as transparent

1
Integer Image.transparent;

progressive

Boolean, query and set whether the image is progressive or not, when only jpeg format is supported

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 in the specified format

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

Call parameters:

  • format : Integer, specify the format of the returned data, allowed values ​​are gd.PNG , gd.JPEG , gd.GIF , gd.BMP , gd.WEBP , the default is gd.PNG
  • quality : Integer, used to specify the compression quality when the format is gd.JPEG or gd.WEBP , the default is 85, other formats ignore this parameter

Return result:

  • Buffer , returns formatted data

save

Store the image data in the stream object according to 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, specify the format of the returned data, allowed values ​​are gd.PNG , gd.JPEG , gd.GIF , gd.BMP , gd.WEBP , the default is gd.PNG
  • quality : Integer, used to specify the compression quality when the format is gd.JPEG or gd.WEBP , the default is 85, other formats ignore this parameter

Save the image data in the specified file according to the specified format, 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, specify the format of the returned data, allowed values ​​are gd.PNG , gd.JPEG , gd.GIF , gd.BMP , gd.WEBP , the default is gd.PNG
  • quality : Integer, used to specify the compression quality when the format is gd.JPEG , the default is 85, other formats ignore this parameter

colorAllocate

Apply for a color number for the specified color. For gd.PALETTE image, the color number is the palette index; for gd.TRUECOLOR image, the color number is the rgb coded value

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

Call parameters:

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

Return result:

  • Integer , returns the color number, returns -1 if not successful

Apply for a color number for the specified color. For gd.PALETTE image, the color number is the palette index; for gd.TRUECOLOR image, the color number is the rgb coded value

1
Integer Image.colorAllocate(Integer color);

Call parameters:

  • color : Integer, combined color value, can be generated by functions such as gd.color , gb.rgb, gd.rgba

Return result:

  • Integer , return the color number, return -1 if not successful

colorAllocateAlpha

Apply for a color number for the specified color and transparency. For gd.PALETTE image, the color number is the palette index, and for gd.TRUECOLOR image, the color number is the rgba coded value

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

Call parameters:

  • red : Integer, the red component, the range is 0-255
  • green : Integer, the green component, the range is 0-255
  • blue : Integer, the blue component, the range is 0-255
  • alpha : Number, the transparency component, the range is 0-1.0

Return result:

  • Integer , returns the color number, returns -1 if not successful

Apply for a color number for the specified color and transparency. For gd.PALETTE image, the color number is the palette index, and for gd.TRUECOLOR image, the color number is the rgba coded value

1
Integer Image.colorAllocateAlpha(Integer color);

Call parameters:

  • color : Integer, combined color value, can be generated by functions such as gd.color , gb.rgb, gd.rgba

Return result:

  • Integer , return the color number, return -1 if not successful

colorClosest

Find the closest color number for the specified color. For gd.PALETTE images, the color number is the palette index; for gd.TRUECOLOR images, the color number is the rgb coded value

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

Call parameters:

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

Return result:

  • Integer , return the color number, return -1 if not successful

Find the closest color number for the specified color. For gd.PALETTE images, the color number is the palette index; for gd.TRUECOLOR images, the color number is the rgb coded value

1
Integer Image.colorClosest(Integer color);

Call parameters:

  • color : Integer, combined color value, can be generated by functions such as gd.color , gb.rgb, gd.rgba

Return result:

  • Integer , return the color number, return -1 if not successful

colorClosestHWB

Find the closest color number for the specified color. This method uses Hue/White/Black to find the closest color. For gd.PALETTE image, the color number is the palette index, and for gd.TRUECOLOR image, the color number is rgb Coded value

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

Call parameters:

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

Return result:

  • Integer , return the color number, return -1 if not successful

Find the closest color number for the specified color. This method uses Hue/White/Black to find the closest color. For gd.PALETTE images, the color number is the palette index, and for gd.TRUECOLOR images, the color number is rgb. Coded value

1
Integer Image.colorClosestHWB(Integer color);

Call parameters:

  • color : Integer, combined color value, can be generated by functions such as gd.color , gb.rgb, gd.rgba

Return result:

  • Integer , return the color number, return -1 if not successful

colorClosestAlpha

Find the closest color number for the specified color and transparency. For gd.PALETTE image, the color number is the palette index, and for gd.TRUECOLOR image, the color number is the rgba encoding value

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

Call parameters:

  • red : Integer, the red component, the range is 0-255
  • green : Integer, the green component, the range is 0-255
  • blue : Integer, the blue component, the range is 0-255
  • alpha : Number, the transparency component, the range is 0-1.0

Return result:

  • Integer , returns the color number, returns -1 if not successful

Find the closest color number for the specified color and transparency. For gd.PALETTE image, the color number is the palette index, and for gd.TRUECOLOR image, the color number is the rgba encoding value

1
Integer Image.colorClosestAlpha(Integer color);

Call parameters:

  • color : Integer, combined color value, can be generated by functions such as gd.color , gb.rgb, gd.rgba

Return result:

  • Integer , return the color number, return -1 if not successful

colorExact

Find the color number corresponding to the specified color. For gd.PALETTE image, the color number is the palette index; for gd.TRUECOLOR image, the color number is the rgb coded value

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

Call parameters:

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

Return result:

  • Integer , returns the color number, returns -1 if not successful

Find the color number corresponding to the specified color. For gd.PALETTE image, the color number is the palette index; for gd.TRUECOLOR image, the color number is the rgb coded value

1
Integer Image.colorExact(Integer color);

Call parameters:

  • color : Integer, combined color value, can be generated by functions such as gd.color , gb.rgb, gd.rgba

Return result:

  • Integer , returns the color number, returns -1 if not successful

colorExactAlpha

Find the specified color and the color number corresponding to transparency. For gd.PALETTE image, the color number is the palette index, and for gd.TRUECOLOR image, the color number is the rgba code value

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

Call parameters:

  • red : Integer, the red component, the range is 0-255
  • green : Integer, the green component, the range is 0-255
  • blue : Integer, the blue component, the range is 0-255
  • alpha : Number, the transparency component, the range is 0-1.0

Return result:

  • Integer , return the color number, return -1 if not successful

Find the specified color and the color number corresponding to transparency. For gd.PALETTE image, the color number is the palette index, and for gd.TRUECOLOR image, the color number is the rgba code value

1
Integer Image.colorExactAlpha(Integer color);

Call parameters:

  • color : Integer, combined color value, can be generated by functions such as gd.color , gb.rgb, gd.rgba

Return result:

  • Integer , returns the color number, returns -1 if not successful

colorResolve

Find the color number corresponding to the specified color. If the color does not exist, apply for a new color number. For gd.PALETTE image, the color number is the palette index, and for gd.TRUECOLOR image, the color number is the rgb coded value

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

Call parameters:

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

Return result:

  • Integer , return the color number, return -1 if not successful

Find the color number corresponding to the specified color. If the color does not exist, apply for a new color number. For gd.PALETTE image, the color number is the palette index, and for gd.TRUECOLOR image, the color number is the rgb code value.

1
Integer Image.colorResolve(Integer color);

Call parameters:

  • color : Integer, combined color value, can be generated by functions such as gd.color , gb.rgb, gd.rgba

Return result:

  • Integer , return the color number, return -1 if not successful

colorResolveAlpha

Find the specified color and the color number corresponding to the transparency. If the color does not exist, apply for a new color number. For gd.PALETTE images, the color number is the palette index, and for gd.TRUECOLOR images, the color number is rgba encoding Value

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

Call parameters:

  • red : Integer, the red component, the range is 0-255
  • green : Integer, the green component, the range is 0-255
  • blue : Integer, the blue component, the range is 0-255
  • alpha : Number, the transparency component, the range is 0-1.0

Return result:

  • Integer , returns the color number, returns -1 if not successful

Find the specified color and the color number corresponding to the transparency. If the color does not exist, apply for a new color number. For gd.PALETTE images, the color number is the palette index, and for gd.TRUECOLOR images, the color number is rgba encoding Value

1
Integer Image.colorResolveAlpha(Integer color);

Call parameters:

  • color : Integer, combined color value, can be generated by functions such as gd.color , gb.rgb, gd.rgba

Return result:

  • Integer , return the color number, return -1 if not successful

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, specify the color number to be released

clip

Set the cut window of drawing, after setting, all drawing will be cut 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, the upper left y coordinate of the clipping window
  • x2 : Integer, the lower right x coordinate of the clipping window
  • y2 : Integer, the bottom right y coordinate of the clipping window

getPixel

Query the color of the specified point

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

Call parameters:

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

Return result:

  • Integer , returns the color number of the specified point

getTrueColorPixel

Query the true color of the specified position

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

Call parameters:

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

Return result:

  • Integer , returns the color number of the specified point

setPixel

Draw a point at the specified position

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

Call parameters:

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

setThickness

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

1
Image.setThickness(Integer thickness);

Call parameters:

  • thickness : Integer, the width of the line

line

Draw a line at the specified position

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

Call parameters:

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

rectangle

Draw a rectangle at the specified position

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

Call parameters:

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

filledRectangle

Draw a filled rectangle at the specified position

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

Call parameters:

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

polygon

Draw a polygon based on a given point

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, specify the color number of the rectangle

openPolygon

Draw an open polygon based on a given point

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, specify the color number of the rectangle

filledPolygon

Draw a filled polygon based on the given point

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, specify the color number of the rectangle

ellipse

Draw an oval

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

Call parameters:

  • x : Integer, the x coordinate of the center of the ellipse
  • y : Integer, the y coordinate of the center of the ellipse
  • width : Integer, the width of the ellipse
  • height : Integer, the height of the ellipse
  • color : Integer, specify 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, the x coordinate of the center of the ellipse
  • y : Integer, the y coordinate of the center of the ellipse
  • width : Integer, the width of the ellipse
  • height : Integer, the height of the ellipse
  • color : Integer, specify the color number of the rectangle

arc

Draw a fan

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, the x coordinate of the center of the sector
  • y : Integer, the y coordinate of the center of the sector
  • 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 angle at which the sector starts, the range is 0-360
  • end : Integer, the angle at which the sector ends, the range is 0-360
  • color : Integer, specify 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, the x coordinate of the center of the sector
  • y : Integer, the y coordinate of the center of the sector
  • 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 angle at which the sector starts, the range is 0-360
  • end : Integer, the angle at which the sector ends, the range is 0-360
  • color : Integer, specify the color number of the rectangle
  • style : Integer, specify the style of the fan, the allowed values ​​are gd.ARC , gd.CHORD , gd.NOFILL , gd.EDGED and their combinations

fill

Fill the enclosed area from the specified point

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

Call parameters:

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

fillToBorder

Fill the enclosed area within the border of the specified color from the specified point

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

Call parameters:

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

colorReplace

Replace the specified color in the image with the 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 as a new image

1
Image Image.clone() async;

Return result:

  • Image , return the copied new image object

resample

Generate a new size image based on the image stretch

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

Call parameters:

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

Return result:

  • Image , return a new image object

crop

Cut part of the 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, the upper left y coordinate of the clipping window
  • width : Integer, the width of the cut window
  • height : Integer, the height of the clipping window

Return result:

  • Image , returns the cut out 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:

  • dir : Integer, rotation direction, allowed values ​​are gd.LEFT , gd.RIGHT

convert

Convert current image type

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

Call parameters:


copy

Copy an area from an image to the 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, specify the x coordinate of the copy destination
  • dstY : Integer, specify the y coordinate of the copy destination
  • srcX : Integer, specify the x coordinate of the upper left corner of the copy source
  • srcY : Integer, specify the y coordinate of the upper left corner of the copy source
  • width : Integer, specify the width of the copy
  • height : Integer, specify the height of the copy

copyMerge

Copy an area from an image to the 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, specify the x coordinate of the copy destination
  • dstY : Integer, specify the y coordinate of the copy destination
  • srcX : Integer, specify the x coordinate of the upper left corner of the copy source
  • srcY : Integer, specify the y coordinate of the upper left corner of the copy source
  • width : Integer, specify the width of the copy
  • height : Integer, specify the height of the copy
  • percent : Integer, specifies the transparency of the overlay

copyMergeGray

Copy the gray coverage of an area from an image to the specified position

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, specify the x coordinate of the copy destination
  • dstY : Integer, specify the y coordinate of the copy destination
  • srcX : Integer, specify the x coordinate of the upper left corner of the copy source
  • srcY : Integer, specify the y coordinate of the upper left corner of the copy source
  • width : Integer, specify the width of the copy
  • height : Integer, specify the height of the copy
  • percent : Integer, specifies the transparency of the overlay

copyResized

Stretch an area in an image and copy it to the specified position

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, specify the x coordinate of the copy destination
  • dstY : Integer, specify the y coordinate of the copy destination
  • srcX : Integer, specify the x coordinate of the upper left corner of the copy source
  • srcY : Integer, specify the y coordinate of the upper left corner of the copy source
  • dstW : Integer, specify the stretched width of the copy
  • dstH : Integer, specify the stretch height of the copy
  • srcW : Integer, specify the source width of the copy
  • srcH : Integer, specify the source height of the copy

copyResampled

Stretch an area of ​​an image and copy it to the specified position. Unlike copyResized, this method will dither the image when it is stretched.

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, specify the x coordinate of the copy destination
  • dstY : Integer, specify the y coordinate of the copy destination
  • srcX : Integer, specify the x coordinate of the upper left corner of the copy source
  • srcY : Integer, specify the y coordinate of the upper left corner of the copy source
  • dstW : Integer, specify the stretched width of the copy
  • dstH : Integer, specify the stretch height of the copy
  • srcW : Integer, specify the source width of the copy
  • srcH : Integer, specify the source height of the copy

copyRotated

Rotate an area in an image and copy it to the specified position

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, specify the x coordinate of the copy destination
  • dstY : Number, specify the y coordinate of the copy destination
  • srcX : Integer, specify the x coordinate of the upper left corner of the copy source
  • srcY : Integer, specify the y coordinate of the upper left corner of the copy source
  • width : Integer, specify the width of the copy
  • height : Integer, specify the height of the copy
  • angle : Number, specify 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, required parameters for the filter: SMOOTH smoothing level, BRIGHTNESS brightness level, CONTRAST contrast level, COLORIZE red score
  • arg2 : Number, the required parameters of the filter: the green score of COLORIZE
  • arg3 : Number, the required parameters of the filter: the blue score of COLORIZE
  • arg4 : Number, the required parameters of the filter: the alpha score of the transparency of COLORIZE

The parameter filterType can be the following values:

  • MEAN_REMOVAL , use the average removal method to achieve the contour effect
  • EDGEDETECT , use edge detection to highlight the edges of the image
  • EMBOSS , make the image embossed
  • SELECTIVE_BLUR , blur the image
  • GAUSSIAN_BLUR , blur the image with 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 transparency, and the return value is 0~127

affine

According to the given matrix, affine the current image

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 double numbers
  • 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 region
  • width : Integer, optional width clipping area
  • height : Integer, the height optional clipping area

Return result:

  • 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 processing on the current image

1
Image.gaussianBlur(Integer radius) async;

Call parameters:

  • radius : Integer, blur radius

toString

Returns the string representation of the object, generally returns "[Native Object]", the object can be re-implemented according to its own characteristics

1
String Image.toString();

Return result:

  • String , returns the string representation of the object

toJSON

Returns the JSON format representation of the object, generally returns a collection of readable attributes defined by the object

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

Call parameters:

  • key : String, unused

Return result:

  • Value , returns a value containing JSON serializable