Moebits / waifu2x

waifu2x image upscaling in Node.js
MIT License
70 stars 11 forks source link

Some Questions about weird behavior(s) #17

Closed rkdrns4747 closed 2 years ago

rkdrns4747 commented 2 years ago
  1. I got this kind of weird rainbow line on the stair-like lines, and is there any way to handle this?

1-5 12x2

  1. GIF upscaling got really weird behavior (some frame could not handle transparency, and some frame lost lot's of pixels):

2-1 -> some frame could not handle transparency

2-2-> some frame lost lot's of pixels

Moebits commented 2 years ago

a) This is an artifact of the waifu2x algorithm, nothing I can do about it.

b) I have updated it to replace transparency with transparentColor, so if you set it to #000000 for example then black will be the transparent color, avoiding that problem.

Overall I have found that the GIFEncoder does a poor job when encoding transparent gifs, I will see if I can find a better gif encoder.

c) This is caused by setting cumulative to false in the gif options (or not specifying it). Some gifs only store partial frame data per frame, so setting cumulative to true fixes this issue by layering it with previous frames. I have made it true by default in the latest version.

I recommend converting your transparent gifs to animated webp because the webp encoder is much better. The function is waifu2x.upscaleAnimatedWebp(), with same parameters as upscaleGIF() function.

rkdrns4747 commented 2 years ago

Gotcha. I'll try it and give you result after testing it.

Thanks for your service :)

rkdrns4747 commented 2 years ago

@Tenpi Alright. I've tried lots of ways but the best thing was converting gif to webp and upscaling. IT DO WORKS LIKE CHARM :D and it actually solved all the other problems. Thanks!