Current repo prints images with inverted colors
ferminc opened this issue · 1 comments
ferminc commented
I managed to get the current repo running, everything works well except that images (including qrimage) white pixels are printed as black and black ones as white, I guess there's a issue with the function that converts pixels to black or white?
https://github.com/song940/node-escpos/blob/v3/packages/printer/src/image.ts#L26
this is the old code:
node-escpos/packages/printer/image.js
Line 30 in ad1cade
I don't think there's an issue with my printer because the old version on npm prints images well
ferminc commented
For now, I just did a quick fix it by reversing the output of the .map() function with .map( (p) => p === false )
this.data = rgbaData.map(
([r, g, b, a]) => a != 0 && r > 200 && g > 200 && b > 200,
).map( (p) => p === false )