3

How do I scale down an image to a smaller size in GIMP without an unnecessary loss of resolution? I know that I am losing too much image resolution because when I downscale the same image using HTML code and display it in a web browser I am getting a noticeably sharper resolution. By noticeably sharper I mean that details that were completely absent in the downscaled image in GIMP are displayed the way they should be in the web browser, and the difference in resolution is easily visible without zooming in on the image.

enter image description here
Original image

enter image description here
Downscaled image

I have already tried the answers to the following two questions, but none of the answers gave me the same image resolution that I am getting with my HTML code.

I am not looking for recommendations for web applications or services. I want to find a way to downscale images locally in my computer without an unnecessary loss of resolution.

  • I didn't provide my HTML code in the question because you can see the same loss of resolution in GIMP itself, but in case anyone wants to know my HTML code, I used the HTML <img> width and height attributes. – karel Feb 18 '16 at 9:43
  • 1
    It mainly depends on the kind of image. Changing the resolution of the image unavoidably changes the pixels of the image itself, and the pixel don't have semantic, just position and color (unlike vector images, which you can scale down with good results). Downscaling an image can emphasize some regularity, resulting e.g. in lines or grids not noticeable before. If you start form a bitmap image and you don't wont a loss of details, you can crop the image or redesign the web page or resize the image and tweak it until satisfied. Next time, choose from begin the size or use a vector format. – Paolo Gibellini Feb 18 '16 at 11:29
  • 1
    P.S. post please an example of your image and of the artifacts you have noticed. – Paolo Gibellini Feb 18 '16 at 11:30
  • I have converted my original .png image to Scalable Vector Graphics (SVG) format without it losing any details and without visual artifacts. – karel Feb 18 '16 at 11:57
  • 2
    I opened the .svg file that I made in Inkscape and exported it as a .png image with File -> Export Bitmap and it worked. Because it's your idea, if you post it as an answer, I will accept it. Thanks so much. This was much easier to do than my original idea of resizing it in GIMP. – karel Feb 18 '16 at 13:25
6

Scaling bitmaps is never without loss. Both upscaling, and downscaling will produce interpolation artifacts. This can be done much better with vector graphics. So if we can trace the bitmap we will get better results.

Scaling artifacts become even more obvious when done on an indexed image. We can not calculate interpolated colors on downscaling an indexed image.

To still be able to scale an indexed image we should therefore change the image mode to RGB before we scale it. Details on downscaling will then be much better preserved:

enter image description here

If we need an indexed image mode we can change it back after scaling.

  • Changing the image mode to RGB was what I was looking for, so when you downscale you will cover the loss with semi-transparent pixels to simulate the original smoothness. Mode can be switched under Image- > Mode -> RGB – George Dimitriadis Nov 6 '17 at 14:56
3

This answer was suggested by Paolo Gibellini in two comments. It's also possible to downscale an image without losing too much resolution in GIMP using a similar method, however I prefer to use Inkscape because it's a lot easier to do it with Inkscape.

  1. The original image can be a file format like .png, .svg, .jpg, etc., preferably .png or .svg because Inkscape will save .jpg images as .png files.

  2. Open the original image file in Inkscape. When you open the file, Inkscape will open a small window asking you to select either link or embed image. Click the radio button to select embed.

  3. Select File -> Export Bitmap. This will open a little Export Bitmap window.

  4. Under the Export area heading in the Export Bitmap window click the Page button.

  5. Under the Bitmap size heading in the Export Bitmap window select new values for Width and Height to downscale the image.

  6. Click the Browse button and browse to the folder in which the file will be saved.

  7. Type a name for the exported file with a .png extension to save it as a .png file or with an .svg extension to save it as a .svg file, etc.

  8. Click the Save button.

  9. Click the Export button.

1

An answer using only raster image processing

Technically you lose resolution when you downscale, since you are displaying the same image with less pixels. The question is therefore to avoid more resolution loss than strictly necessary. The extra resolution loss is usually due to spatial frequency folding, so these high frequencies must be removed before scaling down. And suppressing high spatial frequencies is just blurring the image. So:

  • Filter>Blur>Gaussian blur
  • Use a blur radius equal to your scaling factor (1024->240, blur radius=4.3, note that Gimp will let you enter the radius as 1024/240 and do the computation for you).
  • Once the blur is applied, Image>Scale image

enter image description here

  • You can restore a bit of visual pop using a sharpening filter (here: Filters>Enhance>Unsharp mask with radius=1 and amount=1)

enter image description here

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.