Renders rexpaintjs-fork Images into canvas images.
Install this module by running:
npm install --save adri326/rexpaintjs-render
Then, import the node module:
const render = require('rexpaintjs-render');
You can then quickly convert your Image
s 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
canvas
to@napi-rs/canvas
, ascanvas
has been failing to compile onnode>=22.11.0
for several months. - Remove
Image.render(options)
, userender(image, options)
instead. - Add typescript types through JSDoc. These require
rexpaintjs-fork>=0.2.6
and@types/node
to 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 tocanvas
for better performance