Renders rexpaintjs-fork Images into canvas images.
Install this module by running:
npm install --save adri326/rexpaintjs-renderThen, import the node module:
const render = require('rexpaintjs-render');You can then quickly convert your Images into Image instances with the imported render method:
const fs = require("fs");
let buffer = fs.readFileSync("your_file.xp");
rexpaint(buffer, (err, data) => {
if (err) {
throw new Error(err);
}
render(data, {output: "your_file.png"}); // writes the image to `your_file.png`!
});1.0.0:- Switch from
canvasto@napi-rs/canvas, ascanvashas been failing to compile onnode>=22.11.0for several months. - Remove
Image.render(options), userender(image, options)instead. - Add typescript types through JSDoc. These require
rexpaintjs-fork>=0.2.6and@types/nodeto work properly. - Fix default background colors being passed as numbers to
canvas. - Fix
render()crashing if the image has no layers.
- Switch from
0.3.0: switch tocanvasfor better performance