waifu2x is a highly praised image up-scaler which does slightly better job than most other tools and filters when it comes to image up-scaling. The original version is Windows-only and it requires a NVidia GPU. GNU/Linux users can compile and use a fork which uses OpenGL.
A Myriad Of Versions
The original author of waifu2x wrote it for Microsoft Windows with Nvidias proprietary CUDA API as a requirement. That Japanese author, who goes by the GitHub handle nagadomi, describes the original waifu2x as
"Image Super-Resolution for Anime-style art using Deep Convolutional Neural Networks. And it supports photo."
The original waifu2x code has been forked by a whole lot of people who mostly produced other Windows-only versions which were later abandoned. It is therefore hard to find any actually useful code or version which runs on GNU/Linux.
The waifu2x fork waifu2x-glsl, available at https://github.com/yui0/waifu2x-glsl, compiles and runs on GNU/Linux (and Windows and macOS). It uses the cross-platform glfw library to do OpenGL-assisted up-scaling. Its webpage lists these installation instructions for GNU/Linux:
dnf install glfw-devel make
Installing the glfx development headers with
dnf -y install glfw-devel and cloning the source with
git clone https://github.com/yui0/waifu2x-glsl.git and entering the folder with
cd waifu2x-glsl and compiling with
make was all it took to get a get a working
waifu2x_glsl binary. There is no Makefile so there is no
make install, that won't work.
Using a compiled
waifu2x_glsl requires a "noise model" file. It will by default look for a
noise1_model.json file in the current folder. Other files in other locations can be specified by adding a
-m path/file.json parameter.
The desired up-scaling size is specified with
-s (2 for 2x, 4 for 4x etc) and an output file needs to be specified with
Note that you can not just place
$HOME/bin and expect that to work. It looks for a model in the current working folder, not the folder where the binary lives. You can make put both files in $HOME/bin and make an alias:
alias waifu2x="$HOME/bin/waifu2x_glsl -m $HOME/bin/noise1_model.json"
That alias makes it possible to up-scale an image by 4x using
waifu2x -s 4 inputfile.jpg -o outputfile.jpg
The GitHub source includes a folder named
vgg_7/art_y/ with four files named "noise1_model.json", "noise2_model.json", "noise3_model.json" and "scale2.0x_model.json". What, if any, difference there is between this files is a unsolved mystery. Testing them with numerous images and comparing the could reveal a difference.
64x64px "agt_family" icon
Everaldo Coelho (www.everaldo.com) is a graphics designer who created several free themes such as "Crystal" and "Kids" in the early 2000s. The Kids theme, released in 2003, did not include any SVG images - only icons up to 64x64. "agt_family.png" is one such icon:
convert agt_family.png -resize 256 agt_family.256px.ImageMagick.png :
waifu2x -s 4 agt_family.png -o agt_family.waifu2x-4x.png:
waifu2x_glsl appears to lack any PNG transparency support. Adding a white background with GIMP or other software is required to use transparent images. That produces a usable result which can be compared to ImageMagick:
Original (though not really, it is a higher-resolution photo down-scaled for testing purposes):
Verdict And Conclusion
The visible difference between up-scaling these images in GIMP and ImageMagick's convert and waifu2x-glsl does not appear to be gigantic. It is hard to make a judgement. Regardless, it is nice that there is a waifu2x implementation which does work on GNU/Linux.
We leave you with the following 500x500 image and three only numbered 2x upscaled images of Jennie from the k-pop group Blackpink for your comparison pleasure and/or consideration:
Image 1 was made using GIMPs ▸ , 2 was made with waifu2x and 3 was made using
If you were able to correctly guess which images was made with that tool then waifu2x is probably for you. If you can't tell the difference then it is quite possible that there is no real difference.