4

I often need to downscale raster images consisting of thick straight lines and other thick curves, like this one:

like this one.

Using GIMP 2.8.16 and its various interpolation options to resize the image to 600×600 sq. pixels, I obtain the following images:

No interpolation

No interpolation

Linear

Linear

Cubic

Cubic

Sinc (Lanczos3)

Sinc

Now, compare this to the result achieved by Firefox the web browser:

Firefox 47.0

Firefox

Look, for instance, at the topmost grey line. If you compare1 each of the GIMP-produced images with the one obtained using Firefox carefully, you'll see that in each comparison, the line looks far better in the Firefox-generated image.

Now, as you might imagine, using a web browser to downscale images isn't very convenient, so I wonder if there is any image editor able to downscale images like this as nicely as Mozilla Firefox. I would prefer an easy way to do batch resizing.

1 Make sure your browser isn't applying any interpolation of its own when you view the images. You might want to open a new browser window and open two tabs in it: one with a GIMP version, and the other with the Firefox version. Then use Ctrl+Tab to switch tab quickly. This will make the differences very obvious to most human observers.

  • 1
    You would probably get more feedback at computergraphics.stackexchange – Rob Jun 30 '16 at 5:47
  • Too bad GIMP still don't have gamma correction in 2016 – user23013 Jul 2 '16 at 3:37
  • Have you tried this in a current development build of GIMP as well? – Michael Schumacher Jul 4 '16 at 13:44
  • @MichaelSchumacher: No, I have only tried it in the latest stable version. – Andreas Rejbrand Jul 4 '16 at 16:30
3

I have discovered that ImageMagick 7 produces a result as nice as the one obtained by Mozilla Firefox:

enter image description here

To resize an image using ImageMagick, use the command:

magick image.png -resize 600 small.png

This will resize image.png to a width of 600px, preserving the aspect ratio, and saves the output as small.png.

After some trial and error, I even found a way to do batch resizing using cmd.exe on Windows 7. The command:

for %f IN (*.png) DO magick %f -resize 600 scaled/%f

will resize all PNG images in the current directory to a width of 600px, preserving the aspect ratio, and placing the output images in the scaled subdirectory.

  • Can you edit your answer adding the image generated with ImageMagic under windows? So it will be possible to do comparison. Thanks. – Hastur Jul 1 '16 at 12:12
  • @Hastur: Sorry, can't believe I forgot to show the image. Will update in a sec. – Andreas Rejbrand Jul 1 '16 at 12:41
  • Thanks. Since you recently discovered Imagemagick, I would like to invite you to play with identify (identify -verbose yourimage.png). It can give some hints. The original image was with only 4 colours; the other ones are not. Firefox adds an alpha channel not present in the IM one... With those hints you can start to play with the command line options (that are not commutative!) in the attempt to obtain an even better result (but you have to define your better). With no computational time problems you may find interesting povray (for your program). – Hastur Jul 1 '16 at 13:04
  • 1
    Note: GraphicsMagick is a fork of ImageMagic that has superior performance and quality. – harrymc Jul 4 '16 at 6:58
  • @harrymc: Interesting. I'll remember that if I get tired of ImageMagick. – Andreas Rejbrand Jul 4 '16 at 11:14
0

I have been struggling looking for a good downscale(r) myself mostly used for scaling application screenshots for web documentation. my results:

  1. Photoshop: Bad

  2. MS Word: Good Insert the image on a document, re-size it, take a screen capture, save it as png with i.e. Paint.exe. The results are good but MS does not let you control the size by pixels (only inches or %).

  3. ReSize.exe (from RoboHelp suite): Good But it does not directly handle png; I use this method now converting png->bmp-resize-bmp->png. This is my current choice.

  • Your option #2 is like how I did things (but using Firefox) before I 'discovered' ImageMagick! I opened the original PNG in Firefox, right-clicked the image (the <img> element), selected "Inspect element" and either changed the width and height attributes or added width:600px and height:600px to the local element style using the right-hand panel. Then I used the panel to remove the non-solid-colour background of the page, took a screenshot (using OneNote's tool) of the image and some padding around it, opened the screenshot in GIMP, auto-cropped it and saved it. – Andreas Rejbrand Jul 6 '16 at 11:52
  • I should've said I also tested ImageMagic but in my case (reducing Windows application screenshots) it didn't do a good job when reducing displayed text. I have tested a lot; for me option 3 is the one that gives me the best results. – Pat Jul 6 '16 at 14:15
  • I can imagine the notion of 'best' actually depending quite a lot on the type of graphics. As far as text goes, perhaps it also matters whether or not it is anti-aliased. Also, in a a normal screenshot, much of the text probably consists of one-pixel-wide lines, whereas my sources have very thick lines. (Didn't downvote.) – Andreas Rejbrand Jul 6 '16 at 14:47
  • (I know you didn't downvote ) I just wanted to contribute to this discussion with my experience. I agree my concept of "best" results it's based on application screenshots which are mainly made of geometrical square shapes plus text. In your case you do not deal with text. – Pat Jul 6 '16 at 15:17
  • I think I will continue using ImageMagick, and the best result I have seen on this page comes from Photoshop. Still, thank you, and +1 for the effort! – Andreas Rejbrand Jul 6 '16 at 20:36
0
+250

You can use photoshop's "bicubic sharper" option

Or you can scale using bicubic interpolation THEN "slightly" sharpen the image using gimp or whatever tool you want

https://docs.gimp.org/en/plug-in-sharpen.html

https://docs.gimp.org/en/gimp-image-scale.html

enter image description here

This is photoshop's bicubic sharper enter image description here

This is photoshop's bicubic smoother enter image description here

This is what happens when you apply photoshop's "sharpen edges" and then use the normal bicubic interpolation. (I recommend this one). also, I zoomed in and compared this to the firefox output, they are very similar. enter image description here

  • Photoshop, is not good for the task no matter what re-sampling method you decide to use nor the post processing you might use to "improve" the thing either. I own Adobe "Master Collection CS6", "eLearning SuiteCS6.1", and "Technical Suite 4" They do not have anything good to downsize an image like the one presented here (well ReSize.exe is an old RoboHelp application owned by Adobe but it doesn't directly handle PNGs). – Pat Jul 6 '16 at 14:21
  • @Pat don't you like the latest picture I presented? – Uğur Gümüşhan Jul 6 '16 at 14:43
  • @UğurGümüşhan: Thank you for your informative description of the options offered by Photoshop. The first result I don't like, sine the lines are clearly 'pixellated'. The second result, however, is almost indistinguishable from the Firefox/ImageMagick result; the difference is visible in the middle and to the right, and I am not sure, but perhaps Photoshop does an even better job there. The third result also looks very good, and the lines are clearly brighter (I don't mind that). – Andreas Rejbrand Jul 6 '16 at 14:56
  • (But why the GIMP links at the top?) – Andreas Rejbrand Jul 6 '16 at 15:02
  • @AndreasRejbrand in the future, people who find this post after searching for something similar, may not have access to photoshop. also, people may want to produce similar results using command line tools for automation, so im trying to tell people about mathematical methods rather than what to click. – Uğur Gümüşhan Jul 6 '16 at 15:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.