diff --git a/__test__/helper.ts b/__test__/helper.ts
new file mode 100755
index 00000000..1fdc5015
--- /dev/null
+++ b/__test__/helper.ts
@@ -0,0 +1,27 @@
+import jimp from 'jimp-compact'
+
+/**
+ * Convert image to RGBA pixels Array
+ * Traverse the pixels in the order from left to right and top to bottom.
+ *
+ * @param {Buffer} imgBuffer
+ * @param {Number} width image width
+ * @param {Number} height image height
+ * @returns {Array}, e.g. [255, 0, 0, 255, 255, 0, 0, 255]
+ */
+async function jimpToRgbaPixels(imgBuffer: Buffer, width: number, height: number) {
+ const result = await jimp.read(imgBuffer)
+ const pixels = []
+ for (let y = 0; y < height; y++) {
+ for (let x = 0; x < width; x++) {
+ const pixel = jimp.intToRGBA(result.getPixelColor(x, y))
+ pixels.push(pixel.r)
+ pixels.push(pixel.g)
+ pixels.push(pixel.b)
+ pixels.push(pixel.a)
+ }
+ }
+ return pixels
+}
+
+export { jimpToRgbaPixels }
diff --git a/__test__/index.spec.ts b/__test__/index.spec.ts
index a81721a1..9054c413 100755
--- a/__test__/index.spec.ts
+++ b/__test__/index.spec.ts
@@ -6,6 +6,24 @@ import jimp from 'jimp-compact'
import { Resvg, renderAsync } from '../index'
+import { jimpToRgbaPixels } from './helper'
+
+test('svg to RGBA pixels Array', async (t) => {
+ const svg = ``
+ const resvg = new Resvg(svg)
+ const pngData = resvg.render()
+ const pngBuffer = pngData.asPng()
+
+ const originPixels = pngData.pixels.toJSON().data
+ const pixelArray = await jimpToRgbaPixels(pngBuffer, pngData.width, pngData.height)
+
+ t.is(originPixels.length, pixelArray.length)
+ t.is(originPixels.toString(), pixelArray.toString())
+})
+
test('fit to width', async (t) => {
const filePath = '../example/text.svg'
const svg = await fs.readFile(join(__dirname, filePath))
diff --git a/__test__/wasm.spec.ts b/__test__/wasm.spec.ts
index 5268f2d9..c9d92967 100755
--- a/__test__/wasm.spec.ts
+++ b/__test__/wasm.spec.ts
@@ -7,11 +7,29 @@ import jimp from 'jimp-compact'
import { Resvg, initWasm } from '../wasm'
+import { jimpToRgbaPixels } from './helper'
+
// Init Wasm
test.before(async () => {
await initWasm(fs.readFile(join(__dirname, '../wasm/index_bg.wasm')))
})
+test('svg to RGBA pixels Array', async (t) => {
+ const svg = ``
+ const resvg = new Resvg(svg)
+ const pngData = resvg.render()
+ const pngBuffer = pngData.asPng()
+
+ const originPixels = Array.from(pngData.pixels)
+ const pixelArray = await jimpToRgbaPixels(Buffer.from(pngBuffer), pngData.width, pngData.height)
+
+ t.is(originPixels.length, pixelArray.length)
+ t.is(originPixels.toString(), pixelArray.toString())
+})
+
test('buffer input', async (t) => {
const filePath = '../example/text.svg'
const svg = await fs.readFile(join(__dirname, filePath))
diff --git a/index.d.ts b/index.d.ts
index 1b5292cf..57a5fa35 100755
--- a/index.d.ts
+++ b/index.d.ts
@@ -87,6 +87,9 @@ export class RenderedImage {
/** Write the image data to Buffer */
asPng(): Buffer
+ /** Get the RGBA pixels of the image */
+ get pixels(): Buffer
+
/** Get the PNG width */
get width(): number
diff --git a/js-binding.d.ts b/js-binding.d.ts
index 1e21cb98..c51bd166 100644
--- a/js-binding.d.ts
+++ b/js-binding.d.ts
@@ -43,6 +43,8 @@ export class Resvg {
export class RenderedImage {
/** Write the image data to Buffer */
asPng(): Buffer
+ /** Get the RGBA pixels of the image */
+ get pixels(): Buffer
/** Get the PNG width */
get width(): number
/** Get the PNG height */
diff --git a/src/lib.rs b/src/lib.rs
index e2e8a716..3088ad8a 100755
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -107,6 +107,20 @@ impl RenderedImage {
Ok(buffer.as_slice().into())
}
+ /// Get the RGBA pixels of the image
+ #[cfg(target_arch = "wasm32")]
+ #[wasm_bindgen(getter)]
+ pub fn pixels(&self) -> js_sys::Uint8Array {
+ self.pix.data().into()
+ }
+
+ /// Get the RGBA pixels of the image
+ #[cfg(not(target_arch = "wasm32"))]
+ #[napi(getter)]
+ pub fn pixels(&self) -> Buffer {
+ self.pix.data().into()
+ }
+
#[cfg(not(target_arch = "wasm32"))]
#[napi(getter)]
/// Get the PNG width
diff --git a/wasm/index.d.ts b/wasm/index.d.ts
index 1ae7099d..7f8418f8 100644
--- a/wasm/index.d.ts
+++ b/wasm/index.d.ts
@@ -27,6 +27,10 @@ declare class RenderedImage {
*/
readonly height: number;
/**
+ * Get the RGBA pixels of the image
+ */
+ readonly pixels: Uint8Array;
+ /**
* Get the PNG width
*/
readonly width: number;
diff --git a/wasm/index.js b/wasm/index.js
index db39636d..604f625e 100644
--- a/wasm/index.js
+++ b/wasm/index.js
@@ -204,6 +204,10 @@ var RenderedImage = class {
wasm.__wbindgen_add_to_stack_pointer(16);
}
}
+ get pixels() {
+ const ret = wasm.renderedimage_pixels(this.ptr);
+ return takeObject(ret);
+ }
};
var Resvg = class {
static __wrap(ptr) {
diff --git a/wasm/index.min.js b/wasm/index.min.js
index 656d5194..633f01dd 100644
--- a/wasm/index.min.js
+++ b/wasm/index.min.js
@@ -1 +1 @@
-"use strict";var resvg=(()=>{var W=Object.defineProperty;var M=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var E=Object.prototype.hasOwnProperty;var T=(e,t)=>{for(var n in t)W(e,n,{get:t[n],enumerable:!0})},L=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of S(t))!E.call(e,o)&&o!==n&&W(e,o,{get:()=>t[o],enumerable:!(i=M(t,o))||i.enumerable});return e};var C=e=>L(W({},"__esModule",{value:!0}),e);var V={};T(V,{Resvg:()=>J,initWasm:()=>H});var r,g=new Array(32).fill(void 0);g.push(void 0,null,!0,!1);var h=g.length;function b(e){h===g.length&&g.push(g.length+1);let t=h;return h=g[t],g[t]=e,t}function c(e){return g[e]}function z(e){e<36||(g[e]=h,h=e)}function d(e){let t=c(e);return z(e),t}var l=0,m=new Uint8Array;function v(){return m.byteLength===0&&(m=new Uint8Array(r.memory.buffer)),m}var x=new TextEncoder("utf-8"),P=typeof x.encodeInto=="function"?function(e,t){return x.encodeInto(e,t)}:function(e,t){let n=x.encode(e);return t.set(n),{read:e.length,written:n.length}};function k(e,t,n){if(n===void 0){let a=x.encode(e),f=t(a.length);return v().subarray(f,f+a.length).set(a),l=a.length,f}let i=e.length,o=t(i),w=v(),_=0;for(;_127)break;w[o+_]=a}if(_!==i){_!==0&&(e=e.slice(_)),o=n(o,i,i=_+e.length*3);let a=v().subarray(o+_,o+i);_+=P(e,a).written}return l=_,o}function U(e){return e==null}var A=new Int32Array;function s(){return A.byteLength===0&&(A=new Int32Array(r.memory.buffer)),A}var j=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});j.decode();function I(e,t){return j.decode(v().subarray(e,e+t))}function F(e,t){if(!(e instanceof t))throw new Error(`expected instance of ${t.name}`);return e.ptr}var u=class{static __wrap(t){let n=Object.create(u.prototype);return n.ptr=t,n}__destroy_into_raw(){let t=this.ptr;return this.ptr=0,t}free(){let t=this.__destroy_into_raw();r.__wbg_bbox_free(t)}get x(){return r.__wbg_get_bbox_x(this.ptr)}set x(t){r.__wbg_set_bbox_x(this.ptr,t)}get y(){return r.__wbg_get_bbox_y(this.ptr)}set y(t){r.__wbg_set_bbox_y(this.ptr,t)}get width(){return r.__wbg_get_bbox_width(this.ptr)}set width(t){r.__wbg_set_bbox_width(this.ptr,t)}get height(){return r.__wbg_get_bbox_height(this.ptr)}set height(t){r.__wbg_set_bbox_height(this.ptr,t)}},y=class{static __wrap(t){let n=Object.create(y.prototype);return n.ptr=t,n}__destroy_into_raw(){let t=this.ptr;return this.ptr=0,t}free(){let t=this.__destroy_into_raw();r.__wbg_renderedimage_free(t)}get width(){return r.renderedimage_width(this.ptr)>>>0}get height(){return r.renderedimage_height(this.ptr)>>>0}asPng(){try{let o=r.__wbindgen_add_to_stack_pointer(-16);r.renderedimage_asPng(o,this.ptr);var t=s()[o/4+0],n=s()[o/4+1],i=s()[o/4+2];if(i)throw d(n);return d(t)}finally{r.__wbindgen_add_to_stack_pointer(16)}}},p=class{static __wrap(t){let n=Object.create(p.prototype);return n.ptr=t,n}__destroy_into_raw(){let t=this.ptr;return this.ptr=0,t}free(){let t=this.__destroy_into_raw();r.__wbg_resvg_free(t)}constructor(t,n){try{let f=r.__wbindgen_add_to_stack_pointer(-16);var i=U(n)?0:k(n,r.__wbindgen_malloc,r.__wbindgen_realloc),o=l;r.resvg_new(f,b(t),i,o);var w=s()[f/4+0],_=s()[f/4+1],a=s()[f/4+2];if(a)throw d(_);return p.__wrap(w)}finally{r.__wbindgen_add_to_stack_pointer(16)}}get width(){return r.resvg_width(this.ptr)}get height(){return r.resvg_height(this.ptr)}render(){try{let o=r.__wbindgen_add_to_stack_pointer(-16);r.resvg_render(o,this.ptr);var t=s()[o/4+0],n=s()[o/4+1],i=s()[o/4+2];if(i)throw d(n);return y.__wrap(t)}finally{r.__wbindgen_add_to_stack_pointer(16)}}toString(){try{let i=r.__wbindgen_add_to_stack_pointer(-16);r.resvg_toString(i,this.ptr);var t=s()[i/4+0],n=s()[i/4+1];return I(t,n)}finally{r.__wbindgen_add_to_stack_pointer(16),r.__wbindgen_free(t,n)}}innerBBox(){let t=r.resvg_innerBBox(this.ptr);return t===0?void 0:u.__wrap(t)}getBBox(){let t=r.resvg_getBBox(this.ptr);return t===0?void 0:u.__wrap(t)}cropByBBox(t){F(t,u),r.resvg_cropByBBox(this.ptr,t.ptr)}imagesToResolve(){try{let o=r.__wbindgen_add_to_stack_pointer(-16);r.resvg_imagesToResolve(o,this.ptr);var t=s()[o/4+0],n=s()[o/4+1],i=s()[o/4+2];if(i)throw d(n);return d(t)}finally{r.__wbindgen_add_to_stack_pointer(16)}}resolveImage(t,n){try{let w=r.__wbindgen_add_to_stack_pointer(-16),_=k(t,r.__wbindgen_malloc,r.__wbindgen_realloc),a=l;r.resvg_resolveImage(w,this.ptr,_,a,b(n));var i=s()[w/4+0],o=s()[w/4+1];if(o)throw d(i)}finally{r.__wbindgen_add_to_stack_pointer(16)}}};async function N(e,t){if(typeof Response=="function"&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(e,t)}catch(i){if(e.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",i);else throw i}let n=await e.arrayBuffer();return await WebAssembly.instantiate(n,t)}else{let n=await WebAssembly.instantiate(e,t);return n instanceof WebAssembly.Instance?{instance:n,module:e}:n}}function q(){let e={};return e.wbg={},e.wbg.__wbg_new_8d2af00bc1e329ee=function(t,n){let i=new Error(I(t,n));return b(i)},e.wbg.__wbindgen_memory=function(){let t=r.memory;return b(t)},e.wbg.__wbg_buffer_3f3d764d4747d564=function(t){let n=c(t).buffer;return b(n)},e.wbg.__wbg_newwithbyteoffsetandlength_d9aa266703cb98be=function(t,n,i){let o=new Uint8Array(c(t),n>>>0,i>>>0);return b(o)},e.wbg.__wbindgen_object_drop_ref=function(t){d(t)},e.wbg.__wbg_new_8c3f0052272a457a=function(t){let n=new Uint8Array(c(t));return b(n)},e.wbg.__wbg_instanceof_Uint8Array_971eeda69eb75003=function(t){let n;try{n=c(t)instanceof Uint8Array}catch(o){n=!1}return n},e.wbg.__wbindgen_string_get=function(t,n){let i=c(n),o=typeof i=="string"?i:void 0;var w=U(o)?0:k(o,r.__wbindgen_malloc,r.__wbindgen_realloc),_=l;s()[t/4+1]=_,s()[t/4+0]=w},e.wbg.__wbg_new_1d9a920c6bfc44a8=function(){let t=new Array;return b(t)},e.wbg.__wbindgen_string_new=function(t,n){let i=I(t,n);return b(i)},e.wbg.__wbg_push_740e4b286702d964=function(t,n){return c(t).push(c(n))},e.wbg.__wbg_length_9e1ae1900cb0fbd5=function(t){return c(t).length},e.wbg.__wbg_set_83db9690f9353e79=function(t,n,i){c(t).set(c(n),i>>>0)},e.wbg.__wbindgen_throw=function(t,n){throw new Error(I(t,n))},e}function D(e,t){return r=e.exports,B.__wbindgen_wasm_module=t,A=new Int32Array,m=new Uint8Array,r}async function B(e){typeof e=="undefined"&&(e=new URL("index_bg.wasm",void 0));let t=q();(typeof e=="string"||typeof Request=="function"&&e instanceof Request||typeof URL=="function"&&e instanceof URL)&&(e=fetch(e));let{instance:n,module:i}=await N(await e,t);return D(n,i)}var R=B;var O=!1,H=async e=>{if(O)throw new Error("Already initialized. The `initWasm()` function can be used only once.");await R(await e),O=!0},J=class extends p{constructor(e,t){if(!O)throw new Error("Wasm has not been initialized. Call `initWasm()` function.");super(e,JSON.stringify(t))}};return C(V);})();
+"use strict";var resvg=(()=>{var W=Object.defineProperty;var M=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var E=Object.prototype.hasOwnProperty;var T=(e,t)=>{for(var n in t)W(e,n,{get:t[n],enumerable:!0})},L=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of S(t))!E.call(e,o)&&o!==n&&W(e,o,{get:()=>t[o],enumerable:!(i=M(t,o))||i.enumerable});return e};var C=e=>L(W({},"__esModule",{value:!0}),e);var V={};T(V,{Resvg:()=>J,initWasm:()=>H});var r,g=new Array(32).fill(void 0);g.push(void 0,null,!0,!1);var h=g.length;function b(e){h===g.length&&g.push(g.length+1);let t=h;return h=g[t],g[t]=e,t}function c(e){return g[e]}function z(e){e<36||(g[e]=h,h=e)}function d(e){let t=c(e);return z(e),t}var l=0,m=new Uint8Array;function v(){return m.byteLength===0&&(m=new Uint8Array(r.memory.buffer)),m}var x=new TextEncoder("utf-8"),P=typeof x.encodeInto=="function"?function(e,t){return x.encodeInto(e,t)}:function(e,t){let n=x.encode(e);return t.set(n),{read:e.length,written:n.length}};function k(e,t,n){if(n===void 0){let a=x.encode(e),f=t(a.length);return v().subarray(f,f+a.length).set(a),l=a.length,f}let i=e.length,o=t(i),w=v(),_=0;for(;_127)break;w[o+_]=a}if(_!==i){_!==0&&(e=e.slice(_)),o=n(o,i,i=_+e.length*3);let a=v().subarray(o+_,o+i);_+=P(e,a).written}return l=_,o}function U(e){return e==null}var A=new Int32Array;function s(){return A.byteLength===0&&(A=new Int32Array(r.memory.buffer)),A}var j=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});j.decode();function I(e,t){return j.decode(v().subarray(e,e+t))}function F(e,t){if(!(e instanceof t))throw new Error(`expected instance of ${t.name}`);return e.ptr}var u=class{static __wrap(t){let n=Object.create(u.prototype);return n.ptr=t,n}__destroy_into_raw(){let t=this.ptr;return this.ptr=0,t}free(){let t=this.__destroy_into_raw();r.__wbg_bbox_free(t)}get x(){return r.__wbg_get_bbox_x(this.ptr)}set x(t){r.__wbg_set_bbox_x(this.ptr,t)}get y(){return r.__wbg_get_bbox_y(this.ptr)}set y(t){r.__wbg_set_bbox_y(this.ptr,t)}get width(){return r.__wbg_get_bbox_width(this.ptr)}set width(t){r.__wbg_set_bbox_width(this.ptr,t)}get height(){return r.__wbg_get_bbox_height(this.ptr)}set height(t){r.__wbg_set_bbox_height(this.ptr,t)}},y=class{static __wrap(t){let n=Object.create(y.prototype);return n.ptr=t,n}__destroy_into_raw(){let t=this.ptr;return this.ptr=0,t}free(){let t=this.__destroy_into_raw();r.__wbg_renderedimage_free(t)}get width(){return r.renderedimage_width(this.ptr)>>>0}get height(){return r.renderedimage_height(this.ptr)>>>0}asPng(){try{let o=r.__wbindgen_add_to_stack_pointer(-16);r.renderedimage_asPng(o,this.ptr);var t=s()[o/4+0],n=s()[o/4+1],i=s()[o/4+2];if(i)throw d(n);return d(t)}finally{r.__wbindgen_add_to_stack_pointer(16)}}get pixels(){let t=r.renderedimage_pixels(this.ptr);return d(t)}},p=class{static __wrap(t){let n=Object.create(p.prototype);return n.ptr=t,n}__destroy_into_raw(){let t=this.ptr;return this.ptr=0,t}free(){let t=this.__destroy_into_raw();r.__wbg_resvg_free(t)}constructor(t,n){try{let f=r.__wbindgen_add_to_stack_pointer(-16);var i=U(n)?0:k(n,r.__wbindgen_malloc,r.__wbindgen_realloc),o=l;r.resvg_new(f,b(t),i,o);var w=s()[f/4+0],_=s()[f/4+1],a=s()[f/4+2];if(a)throw d(_);return p.__wrap(w)}finally{r.__wbindgen_add_to_stack_pointer(16)}}get width(){return r.resvg_width(this.ptr)}get height(){return r.resvg_height(this.ptr)}render(){try{let o=r.__wbindgen_add_to_stack_pointer(-16);r.resvg_render(o,this.ptr);var t=s()[o/4+0],n=s()[o/4+1],i=s()[o/4+2];if(i)throw d(n);return y.__wrap(t)}finally{r.__wbindgen_add_to_stack_pointer(16)}}toString(){try{let i=r.__wbindgen_add_to_stack_pointer(-16);r.resvg_toString(i,this.ptr);var t=s()[i/4+0],n=s()[i/4+1];return I(t,n)}finally{r.__wbindgen_add_to_stack_pointer(16),r.__wbindgen_free(t,n)}}innerBBox(){let t=r.resvg_innerBBox(this.ptr);return t===0?void 0:u.__wrap(t)}getBBox(){let t=r.resvg_getBBox(this.ptr);return t===0?void 0:u.__wrap(t)}cropByBBox(t){F(t,u),r.resvg_cropByBBox(this.ptr,t.ptr)}imagesToResolve(){try{let o=r.__wbindgen_add_to_stack_pointer(-16);r.resvg_imagesToResolve(o,this.ptr);var t=s()[o/4+0],n=s()[o/4+1],i=s()[o/4+2];if(i)throw d(n);return d(t)}finally{r.__wbindgen_add_to_stack_pointer(16)}}resolveImage(t,n){try{let w=r.__wbindgen_add_to_stack_pointer(-16),_=k(t,r.__wbindgen_malloc,r.__wbindgen_realloc),a=l;r.resvg_resolveImage(w,this.ptr,_,a,b(n));var i=s()[w/4+0],o=s()[w/4+1];if(o)throw d(i)}finally{r.__wbindgen_add_to_stack_pointer(16)}}};async function N(e,t){if(typeof Response=="function"&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(e,t)}catch(i){if(e.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",i);else throw i}let n=await e.arrayBuffer();return await WebAssembly.instantiate(n,t)}else{let n=await WebAssembly.instantiate(e,t);return n instanceof WebAssembly.Instance?{instance:n,module:e}:n}}function q(){let e={};return e.wbg={},e.wbg.__wbg_new_8d2af00bc1e329ee=function(t,n){let i=new Error(I(t,n));return b(i)},e.wbg.__wbindgen_memory=function(){let t=r.memory;return b(t)},e.wbg.__wbg_buffer_3f3d764d4747d564=function(t){let n=c(t).buffer;return b(n)},e.wbg.__wbg_newwithbyteoffsetandlength_d9aa266703cb98be=function(t,n,i){let o=new Uint8Array(c(t),n>>>0,i>>>0);return b(o)},e.wbg.__wbindgen_object_drop_ref=function(t){d(t)},e.wbg.__wbg_new_8c3f0052272a457a=function(t){let n=new Uint8Array(c(t));return b(n)},e.wbg.__wbg_instanceof_Uint8Array_971eeda69eb75003=function(t){let n;try{n=c(t)instanceof Uint8Array}catch(o){n=!1}return n},e.wbg.__wbindgen_string_get=function(t,n){let i=c(n),o=typeof i=="string"?i:void 0;var w=U(o)?0:k(o,r.__wbindgen_malloc,r.__wbindgen_realloc),_=l;s()[t/4+1]=_,s()[t/4+0]=w},e.wbg.__wbg_new_1d9a920c6bfc44a8=function(){let t=new Array;return b(t)},e.wbg.__wbindgen_string_new=function(t,n){let i=I(t,n);return b(i)},e.wbg.__wbg_push_740e4b286702d964=function(t,n){return c(t).push(c(n))},e.wbg.__wbg_length_9e1ae1900cb0fbd5=function(t){return c(t).length},e.wbg.__wbg_set_83db9690f9353e79=function(t,n,i){c(t).set(c(n),i>>>0)},e.wbg.__wbindgen_throw=function(t,n){throw new Error(I(t,n))},e}function D(e,t){return r=e.exports,B.__wbindgen_wasm_module=t,A=new Int32Array,m=new Uint8Array,r}async function B(e){typeof e=="undefined"&&(e=new URL("index_bg.wasm",void 0));let t=q();(typeof e=="string"||typeof Request=="function"&&e instanceof Request||typeof URL=="function"&&e instanceof URL)&&(e=fetch(e));let{instance:n,module:i}=await N(await e,t);return D(n,i)}var R=B;var O=!1,H=async e=>{if(O)throw new Error("Already initialized. The `initWasm()` function can be used only once.");await R(await e),O=!0},J=class extends p{constructor(e,t){if(!O)throw new Error("Wasm has not been initialized. Call `initWasm()` function.");super(e,JSON.stringify(t))}};return C(V);})();
diff --git a/wasm/index.mjs b/wasm/index.mjs
index 2f79935e..b668020f 100644
--- a/wasm/index.mjs
+++ b/wasm/index.mjs
@@ -177,6 +177,10 @@ var RenderedImage = class {
wasm.__wbindgen_add_to_stack_pointer(16);
}
}
+ get pixels() {
+ const ret = wasm.renderedimage_pixels(this.ptr);
+ return takeObject(ret);
+ }
};
var Resvg = class {
static __wrap(ptr) {
diff --git a/wasm/index_bg.wasm b/wasm/index_bg.wasm
index 9d4a04b1..8abebbad 100644
Binary files a/wasm/index_bg.wasm and b/wasm/index_bg.wasm differ