There are various ways to resize images without reducing the images quality. In this article I’ll explain how to use a free tool called Real-ERSGAN. This is available for free and can increase the size of images by 4 times, while maintaining good image quality.
Before you start, I must warn you that this may not work on every machine. I’ve tried it on three Windows computers and an older iMac.
It worked on Windows 10 machine with an 8th gen I7 with a discrete graphics card and also on a Windows 11 laptop with an 11th gen I5 with integrated graphics.
On a Windows 10 laptop with 7th gen I5, the process ran, but produced a plain black image each time. On the iMac with MacOS 10.13.6 High Sierra and I7 from 2010, it failed to run with an error message.
So it is possible you may not be able to use this free tool, but it’s pretty quick and easy to try it out to see if it will work with your machine.
There are two ways to use this tool. I’m going to focus on using the portable version as it is easier to explain and requires no set up. If you’re going to be using this tool a lot, you may want to look at installing it, but for most users, the method explained here will be fine.
The images will show Real-ERSGAN being used on a Windows machine, but the process is much the same on MacOS. I’ll try and highlight any differences.
As mentioned, Real-ERSGAN is free to download and use.
You can get a copy and learn more about the project on the Real-ERSGAN Github page.
You’ll need to extract the ZIP file you’ve downloaded before continuing.
You can leave the extracted folder in the downloads directory, but I suggest moving it somewhere else so you it doesn’t get deleted if you empty your downloads folder.
I also suggest you shorten the name of the folder – I changed mine to realersgan.
How to use Real-ERSGAN
On Windows, in the search field, type cmd and then click to open Command Prompt. On a Mac, search for Terminal and open that.
In Command Prompt or Terminal, type cd (that simply means change directory in both Windows and MacOS), followed by a space.
Now click and drag your realersgan folder and drop it onto Command Prompt or Terminal. Then press return – if necessary click on Command Prompt or Terminal to focus on it.
That last action has told your computer that you want to work in the realersgan folder.
If you open the realersgan folder and then type dir into Command Prompt or ls into Terminal, you’ll see the same list of files and one folder displayed.
The readme file offers a brief explanation of how to use Real-ERSGAN, but I’ll also explain here.
On Windows, copy the first line below and paste it into Command Prompt. On MacOS, copy the second and paste it into Terminal. Then press the return key.
- realesrgan-ncnn-vulkan.exe -i input.jpg -o output.png
- ./realesrgan-ncnn-vulkan -i input.jpg -o output.png
You should see a few lines of text written to the Command Prompt or Terminal and when it’s finished, there should be a new file in the realersgan folder called output.png.
That example used one of the test images supplied with the tool. Of course you will want to resize your own images.
The easiest way to do this is to drop your image file into the realersgan folder. Then change the name of the input image.
For example, if your image is called my-image.png, the command will be changed to:
- realesrgan-ncnn-vulkan.exe -i my-image.png -o output.png
- ./realesrgan-ncnn-vulkan -i my-image.png -o output.png
You can also change the name of your output file, for example calling it larger-image.png. You can also change the file type, by changing .png to .jpg, but only do that if you’re resizing a photo rather than an illustration.
- realesrgan-ncnn-vulkan.exe -i my-image.png -o larger-image.jpg
- ./realesrgan-ncnn-vulkan -i my-image.png -o larger-image.jpg
You can also apply different scaling models to your resizing commands, by appending an additional option.
- realesrgan-ncnn-vulkan.exe -i my-image.png -o larger-image.jpg-n realesrnet-x4plus
- realesrgan-ncnn-vulkan.exe -i my-image.png -o larger-image.jpg-n esrgan-x4
Those are the Windows commands shown above. These may produce slightly different results, so give them a go to see which you prefer. The second one is designed for anime images, so you may get better results using that with illustrations.
That’s all there is to using Real-ERSGAN and it offers a great free way to increase images to four times the size.