Skip to content

Canvas.toTempFilePath ​

JS
    Canvas.toTempFilePath(Object object)

Saves the current canvas content as a temporary file.

Parameters

  • Object object: Input parameters. See the table below for details.

object properties:

PropertyTypeRequiredDefaultDescription
xnumberNo0X coordinate of the top-left corner of the canvas region to capture
ynumberNo0Y coordinate of the top-left corner of the canvas region to capture
widthnumberNocanvas widthWidth of the canvas region to capture
heightnumberNocanvas heightHeight of the canvas region to capture
destWidthnumberNocanvas widthWidth of the output file; the captured region will be stretched or compressed to this value; only effective when fileType is jpg
destHeightnumberNocanvas heightHeight of the output file; the captured region will be stretched or compressed to this value; only effective when fileType is jpg
fileTypestringNopngType of the output file; only png and jpg are supported
qualitynumberNo1.0Quality of the jpg image; only effective when fileType is jpg. Valid range is 0.0 (lowest) - 1.0 (highest), excluding 0. Values out of range are treated as 1.0
successfunctionNoCallback function for a successful API call
failfunctionNoCallback function for a failed API call
completefunctionNoCallback function for when the API call ends

Parameters of the success callback function

  • Object res: Returns the temporary file information

Temporary file information properties:

PropertyTypeDescription
tempFilePathstringTemporary file path generated by canvas (local path)