### openFromURL(url, asSmart) Source: https://github.com/yikuansun/headlessphotopea/blob/master/docs.md Opens a file in Photopea from a provided URL. ```APIDOC ## openFromURL(url, asSmart) ### Description Open a file in Photopea from a URL. ### Parameters - **url** (*) - Required - url of asset. make sure it can be accessed cross-origin. - **asSmart** (boolean) - Required - open as smart object? ### Returns - Promise - true, once the file is opened. ``` -------------------------------- ### loadAsset(buff) Source: https://github.com/yikuansun/headlessphotopea/blob/master/docs.md Opens a file in Photopea from a buffer. ```APIDOC ## loadAsset(buff) ### Description Open a file in Photopea. ### Parameters - **buff** (Buffer) - Required - file to load into Photopea. ### Returns - Promise - true, once the file is loaded. ``` -------------------------------- ### isInitialized() Source: https://github.com/yikuansun/headlessphotopea/blob/master/docs.md Checks if the Photopea window is initialized and ready. ```APIDOC ## isInitialized() ### Description Wait for window to be initialized. ### Returns - Promise - true when Photopea is ready. ``` -------------------------------- ### addBinaryAsset(buff) Source: https://github.com/yikuansun/headlessphotopea/blob/master/docs.md Loads a file into Photopea. This method is kept for backwards compatibility and functions the same as loadAsset. ```APIDOC ## addBinaryAsset(buff) ### Description Loads a file into Photopea. This method is kept for backwards compatibility and functions the same as loadAsset. ### Parameters - **buff** (Buffer) - Required - file to load into Photopea. ### Returns - Promise - true, once the file is loaded. ``` -------------------------------- ### runScript(script) Source: https://github.com/yikuansun/headlessphotopea/blob/master/docs.md Executes a script within the Photopea environment. ```APIDOC ## runScript(script) ### Description Run a script in Photopea. ### Parameters - **script** (string) - Required - script to run. ### Returns - Array - output from Photopea, ending with "done". ``` -------------------------------- ### emergencyRestart() Source: https://github.com/yikuansun/headlessphotopea/blob/master/docs.md Restarts the browser instance in an emergency situation. ```APIDOC ## emergencyRestart() ### Description Restart the browser in an emergency situation. ### Returns - Promise ``` -------------------------------- ### destroy() Source: https://github.com/yikuansun/headlessphotopea/blob/master/docs.md Terminates the current browser window instance. ```APIDOC ## destroy() ### Description Kill this window. ### Returns - Promise ``` -------------------------------- ### screenshot(fName) Source: https://github.com/yikuansun/headlessphotopea/blob/master/docs.md Saves a debugging screenshot to the specified file path. ```APIDOC ## screenshot(fName) ### Description Save a debugging screenshot to file. ### Parameters - **fName** (string) - Required - Absolute path name of the file. ### Returns - Promise ``` -------------------------------- ### logMessage(msg) Source: https://github.com/yikuansun/headlessphotopea/blob/master/docs.md Logs a message to the system log. ```APIDOC ## logMessage(msg) ### Description Log a message. ### Parameters - **msg** (string) - Required - Line to save to log. ### Returns - void ``` -------------------------------- ### exportImage(type) Source: https://github.com/yikuansun/headlessphotopea/blob/master/docs.md Exports the current document as an image buffer. ```APIDOC ## exportImage(type) ### Description Return the document image as a Buffer. ### Parameters - **type** ("png", "jpg", "webp") - Required - type of image to export. ### Returns - Promise - image as a Buffer. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.