Open juanbrujo opened 6 years ago
I think I would have to write a different .js for that, don't I?
a simple
if (typeof module !== 'undefined') {
module.exports = imgToAscii;
}
wouldn't do it, cause Node doesn't don't support Image class, which is fundamental.
From what I've been reading, I would have to import Canvas and then process the image. Am I right?
You can return a base64 and then the user can use ir right to an or output it in
Yeah, but to process the ASCII the algorithm uses a Image and a Canvas object (DOM Element) which node doesn't implement. So I would have to rewrite the code as a module, using fs.read to read the image and then process it, generating the ASCII code.
It could be done. I'll look in to it.
@victorqribeiro - by chance could you do this as ESM and then use node-canvas for fallback in non DOM environments or just by default? Would gladly take this as ESM module.
@MarketingPip Yep, I can look into using node-canvas
Is your feature request related to a problem? Please describe. This could me imported as an module
Describe the solution you'd like Add AMD / CommonJS / ES modules support