k4yt3x / video2x

A machine learning-based lossless video super resolution framework. Est. Hack the Valley II, 2018.
https://video2x.org
GNU Affero General Public License v3.0
10.77k stars 1.01k forks source link

Transparent gifs #457

Closed IntrovertBoi closed 1 month ago

IntrovertBoi commented 3 years ago

Description

I haven't found a feature to keep transparency in gifs. When I upscale gifs, it replaces empty space with a white background, that I do not need.

k4yt3x commented 3 years ago

You should be able to preserve the alpha channel with the current build. If not through GUI, through the config file or CLI. Which driver you're using now?

IntrovertBoi commented 3 years ago

Waifu2x Caffe.

k4yt3x commented 3 years ago

I'm actually not sure if waifu2x-caffe supports alpha channels.

tankume commented 3 years ago

Im another guy with the same problem. I have been trying to do also upsale gifs with transparency and I also end with a white background instead of a transparent one. I have been trying different drives, all of them resulting in a white background. If I try with a .png normal image, it keeps the transparency. (Im in the 4.6.1 version since the current one crash when I try to open it)

IntrovertBoi commented 3 years ago

@k4yt3x Well which driver supports them then?

k4yt3x commented 3 years ago

I remember waifu2x-ncnn-vulkan supports it? I can't find the switch for it though. Try it I guess.

Wally869 commented 3 years ago

It's not a problem of drivers, you need to change your FFMPEG settings.

GIF frames are extracted by FFMPEG, which has a default pixel format value of rgb24 for frames extraction so it's scrubbing off your alpha values. You need to set another format which includes transparency such as "rgba". Run "ffmpeg -pix_fmts" for a list of accepted formats.

After a quick check, it seems all drivers except Anime4KCPP support transparency, but you might have some aliasing on the edges