Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

waifu2x.upscaleImage is not a function #33

Closed
Haliq0841 opened this issue Feb 21, 2024 · 6 comments
Closed

waifu2x.upscaleImage is not a function #33

Haliq0841 opened this issue Feb 21, 2024 · 6 comments

Comments

@Haliq0841
Copy link

Please make a testing example (es module) I have done what is explained in the readme

import waifu2x from "waifu2x" 
await waifu2x.upscaleImage() 

but the response is like this

TypeError: waifu2x.upscaleImage is not a function 

So, if you can, just make an example test

@Moebits
Copy link
Owner

Moebits commented Feb 23, 2024

on javascript you probably have to use waifu2x.default. Can you try printing it and see what it is?

@Haliq0841
Copy link
Author

on javascript you probably have to use waifu2x.default. Can you try printing it and see what it is?

turns out it works, thanks for the help. I will close this issue. But I have a suggestion for the next update, just use the Canvas Module from NPMJS because the one on GitHub has an error or can't be imported, so I'm forced to only install the old version.

@Haliq0841 Haliq0841 changed the title Create Example tes waifu2x.upscaleImage is not a function Feb 23, 2024
@Moebits
Copy link
Owner

Moebits commented Feb 23, 2024

What node.js version are you using? Make sure you have the latest version: https://nodejs.org/en

I can't use the one on npm because it contains a bug and I cannot compile it.

@Haliq0841
Copy link
Author

What node.js version are you using? Make sure you have the latest version: https://nodejs.org/en

I can't use the one on npm because it contains a bug and I cannot compile it.

I'm already using the latest version of node.js (nodejs_21), but still can't install, like the response you see below:
20240225_153614
and error when installing the canvas module

@Moebits
Copy link
Owner

Moebits commented Feb 25, 2024

To build it you need to install Microsoft Visual C++ Build Tools: https://visualstudio.microsoft.com/downloads/?q=build+tools

If you still can't install it you are better off asking them as it's an issue with their repo. https://github.com/Automattic/node-canvas

Canvas is only used to get images from a PDF so if you don't want to upscale PDF's you don't need it. I will try to find an alternative way to do it since it's true that this dependency is a pain to install.

@Moebits
Copy link
Owner

Moebits commented Feb 25, 2024

Update to 1.4.0 I dropped the canvas dependency

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants