UPDATE 23/10/2017: recent changes seem to be incompatible with clang. I have updated the steps below to check out the last commit that is known as working.
Waifu2x is a popular image converter backed by neural-network models, typically used to upscale images from anime. The various web versions are easy to use but typically don't allow for batch-processing, because it's a relatively intensive operation. However, there is a command-line version that is fairly easy to compile on Windows and Linux. OSX support was notably absent... until now.
These are the steps required to get it working on Mac:
brew tap science && brew install opencv3
(if you don't have Homebrew, go install it now - it's wonderful)
git clone https://github.com/DeadSix27/waifu2x-converter-cpp.git
git checkout d69313040b0784662465fb1d2eca81a2b1ebccb2
cmake -DOVERRIDE_OPENCV=1 -DOPENCV_PREFIX=/usr/local/Cellar/opencv3/<your version here> .(remember the dot at the end!)
waifu2x-converter-cppin the directory; you can
make installif you really want to (I prefer to keep custom stuff in my home dir). To test it's working, the following command should return info on your system:
If you need some images to test, here you can get quite a few stills from the gorgeous 5 Centimeters Per Second. Note: you might have to rename the folder "models_rgb" into "models" before converting.
BONUS: Qt GUI
If you hate the command-line, there is a simple QT wrapper. To compile it you will need Qt-Creator and Qt installed and configured. This used to be very complicated, but both items have now been packaged for Homebrew so it's all awesomely simple (well, compared to what it was, at least). Note that you still have to do the steps above - the wrapper needs the waifu2x executable to be already compiled.
Install and configure Qt and Qt-Creator
brew install qt && brew cask install qt-creator
- Launch Qt Creator from Launchpad, then go to Qt Creator -> Preferences (Command + ,)
- Select Build & Run, then the Qt Versions tab
- Click on Add... and select “Macintosh HD”
- Press Command + Shift + . to show hidden directories
/usr/local/Cellar/qt5/<your version>/bin/qmakethen OK and OK again to close the Preferences window
- Reopen Preferences -> Build & Run, select the Kits tab and click Add
- Set the following options:
- Name to something like "Qt CLang Desktop"
- Both Compiler options to Clang X86 64bit
- Qt Version to the version you just created
- Click on Make Default then OK to close Preferences.
git clone https://github.com/toyg/waifu2x-converter-qt.git(the original repo looks abandoned, so I forked it and tweaked it a bit)
cd waifu-converter-qt && open waifu2x-converter-qt.pro(this should open Qt Creator; if it doesn't, launch it manually and File -> Open Project -> select the .pro file).
- Select Build -> Run (or Command + R). The resulting .app bundle should now be in a folder called
build-waifu2x-converter-qt-<something something>, just beside your main project folder.
When you first launch the GUI, you should probably go to Preferences and set the path to your waifu2x-converter-cpp executable.