Most images on the Web are small or medium sized, since otherwise users need to wait longer before their favorite web pages load. However, sometimes you need to find a larger version of an image, but the search doesn’t bear fruit. Any bitmap image can be scaled up or down in an image editor (such as Gimp). But obviously upscaling would not add any detail to the image. Instead, the result will usually be blurred, pixelated and noticeably stretched-up. In this brief roundup we’ll try to upscale bitmap images with a little better result.
There’s no magic in it, just a few advanced scaling algorithms that help produce better-looking pictures. Everything is open source and works great in Fedora. The results will be tested against the Cubic interpolation method, which Gimp applies by default.
Filters in ImageMagick
This is the most famous and widely used open source software for manipulating images from the command line. Fedora, like the majority of other Linux distributions, already includes ImageMagick. Fedora even installs it by default in Fedora Workstation. ImageMagick provides the convert command, which can also change dimensions of input images.
The trick is that convert supports filters, and ImageMagick provides a rich selection of such filters, some of which work really good for upscaling. You can check out the full list here. For instance, the point filter works well for upscaling pixel art and screen shots, as it preserves clarity and sharpness at the cost of emphasized pixels. Still, this can look better than the blurred results of the convenient Cubic algorithm.
Use it with the following syntax:
convert input.png -filter point -resize 600% output.png
The PNG file format as well as the 600% scaling factor are just examples.
Although it’s possible to get the same result in Gimp by choosing the None interpolation method, working with ImageMagick is sometimes easier. Not only it is installed in Fedora Workstation by default (Gimp is available, but not installed), it provides command-line tools which are ideal for scripting.
Xbrzscale
Xbrzscale is a command-line utility that implements the xBR scaling method. In brief, xBR is based on pattern recognition and interpolation, and it’s perfect for magnifying pixel art. xBRZ is an enhanced version of xBR, with a focus on preserving very small details. Therefore, xBRZ delivers pleasing results on both pixel art and photographic images, such as portraits.
In the following side-by-side comparison, the left part definitely looks preferable thanks to the superb clarity.
Install Xbrzscale in Fedora
To build this tool from source, you must install some prerequisites first:
sudo dnf -y install gcc-c++ SDL2-devel SDL2_image-devel
Let’s go ahead with Xbrzscale now:
git clone https://github.com/atheros/xbrzscale.git cd xbrzscale make
The command line syntax to upscale with this software is:
./xbrzscale X input.png output.png
…where X is the scale factor, a number within the range of 2 to 6.
Note that Xbrzscale always outputs PNG images, no matter what you feed it with. If the input file format is different, Xbrzscale will convert it to PNG.
Smilla Enlarger
Smilla Enlarger has a user-friendly graphical interface. It makes use of yet another different technology, this time based on fractal-based interpolation algorithms. The main goal is to produce sharper results when you upscale photographic images. The enlarged image usually preserves more details than the Cubic interpolation can.
Install Smilla Enlarger in Fedora
Again, start by installing the build dependencies:
sudo dnf -y install qt5-qtbase-devel
Now, build and run Smilla Enlarger:
git clone https://github.com/lupoDharkael/smilla-enlarger.git cd smilla-enlarger qmake-qt5 && make ./smilla-enlarger
The application window has numerous advanced controls and extra parameters that put a user in control of upscaling details.
The upscale version of the sample image looks noticeably different from both the decent Xbrzscale version and the cubic-enlarged version.
It’s hard to recommend the plethora of ImageMagick filters over Xbrzscale and Smilla Enlarger. The actual results will vary across different sorts of images, and of course different user preferences.
Pat David
Don’t forget what may be the best set of image processing filters/algorithms available for FL/OSS users: G’MIC (https://gmic.eu)!
It’s available as a plugin for GIMP and opens up hundreds of image processing filters and options. There’s 3 different upscaling options available include DCCI2X (Directional Cubic Convolution), diffusion, SCALE2X (awesome for pixel-art images). Give it a look!
atolstoy
Great tip. Many thanks for that!
Eric
You should try https://letsenhance.io service. It works very well. You have to buy a plan in order to use it, however you can try it with some images for free (and you should!)
They make it look like it’s magic.
Luca
The future is scaling driven by I.A.
atolstoy
Actually, I intend to write a follow-up on a thing that does upscaling even better thanks to machine learning.
Thomas
SRGAN-Tensorflow ?
Thomas
You can get similarly impressive results using the same SRGAN algorithm used by letsenhance.io with free software:
https://github.com/brade31919/SRGAN-tensorflow
Requirements :
– python
– tensorflow
– SRGAN-tensorflow
– some pretrained models linked in the aformentionned github project
– some patience
– a powerful GPU