I have a number of jpg images whose quality I would like to improve. It is planned to both print them and use them in digital format. I guess to use the GIMP or another programm that I can install in my Linux. I expect you to advise me a tutorial with relevant information. I have reduced original images with ImageMagick's convert command for posting here. These are scans of award documents from the Second World War in Russian.doc_1.jpg


  • What exactly do you mean with "improving the quality" in this case? Are you trying to make the text more readable?
    – Bestorio
    Commented Jan 14, 2020 at 10:11
  • Yes, I want the text to be more readable both through the projector and when printed on paper
    – klpu39
    Commented Jan 14, 2020 at 10:14
  • check also this one graphicdesign.stackexchange.com/questions/29901/…
    – Luciano
    Commented Jan 14, 2020 at 13:14
  • 1
    Please share what you have tried. Users are happy to assist. But, this isn't a "tutorial on demand" site.
    – Scott
    Commented Jan 14, 2020 at 15:31
  • @Scott - I try the algorithm that the user xenoid described to me. It takes me time.
    – klpu39
    Commented Jan 14, 2020 at 15:38

2 Answers 2


The simple technique

Use the Curves tool.

If you look at the image histogram:

  • The hump (1) is a peak frequency of dark pixels and is your text
  • The hump (2) is a peak frequency of light pixels and is your background
  • No pixels beyond (3) because your background is rather dark.

So with Curves, you make a diagonal between (A) (everything darker will be pure black) and (B) everything lighter will be white. You can make the curve follow a slight "S" shape to improve contrast.

An inconvenient of that method is that it is limited by 1) color shifts and 2) darker parts of the background that make it hard to handle the text correctly.

enter image description here

A more efficient technique (Gimp 2.10)

  • Decompose the image into frequency components: Filters>Enhance>Wavelet decompose. YOU get alayer group called "Decomposition". Each layer of this group contains a part of the image. The top layers are the fine detail (the text) while the bottom layers are the general image (the paper).
  • You can easily clean most of your background and make it white by bucket-filling the "Residual" layer with white. You can also tryo to bucket-fill the layer immediately above it.
  • You can add "sharpness" to you image by duplicating the "Scale 1" layer (and sometimes the "Scale 2" one as well).
  • However, your text is not very dark, so create a new layer from all this (Layer>New from visible) and move it to the top of the layer stack.
  • Then you can use Curves as above, making a diagonal where the bottom point is where the histogram stops to the left (you can leave the other point in the top right corner). You can also add some contrast with an S-shaped curve.

enter image description here

  • II did as suggested by xenoid and got results satisfying me.
    – klpu39
    Commented Jan 15, 2020 at 16:54
  • 1
    Then you can "accept" the the answer (click the gray checkmark) :). Out of curiosity, which technique did you use?
    – xenoid
    Commented Jan 15, 2020 at 18:57
  • First, I applied the algorithm that you cited under point "A more efficient technique (Gimp 2.10)"; then I applied the one under paragraph "The simple technique" for all three photographs. This gave acceptable results that can be printed on a printer - the background does not become as dark as in the original photographs. Of course, you need to look for a compromise between sharpness and lightness. I also installed the G'Mic extension, as indicated in the link given by Luciano, but could not achieve any results with it.
    – klpu39
    Commented Jan 16, 2020 at 3:23
  • Regarding the "more efficient technique", is there a good reason to fiddle with "Curves" in the end instead of just adjusting saturation with "Colors>Saturation"?
    – Alexey
    Commented Dec 20, 2020 at 9:28
  • 1
    Question 2: use Python, much easier to work with. See here for a large collection of python-fu scripts that you can use as examples (or steal code from). You can also ask questions on StackOverflow (with the "gimp" tag) or here
    – xenoid
    Commented Dec 20, 2020 at 10:06

I present here a solution based on xenoid's answer that so far gave me the most satisfactory results in clearing up image's background. (I am not sure if this is what the OP meant by "improving the quality", though.)

I only used the Filters > Enhance > Wavelet-decompose..., without Colors > Curves.... Not having to play with color curves and image histograms simplifies the procedure IMO.

Here is what I did:

  1. Use Filters > Enhance > Wavelet-decompose... with 7 scales.

  2. Bucket fill Residual layer with the white or with a color of choice, or insert a layer with solid color above it.

  3. Duplicate each of the Scale layers, except for the 7-th one.

  4. Export as PNG or JPEG.

Here is how Layers dialog looks in the end:

enter image description here

Here are the results for the posted images:

enter image description here enter image description here enter image description here

I've decided to automate this procedure and created a Script-Fu script:

; my-script-fu-white-out-background.scm
; last modified/tested by Alexey Muranov
; 31/12/2020 on GIMP 2.10.20
; Installation:
; This script should be placed in the user or system-wide script folder.
;   Windows 7/10
;   C:\Program Files\GIMP 2\share\gimp\2.0\scripts
;   or
;   C:\Users\YOUR-NAME\AppData\Roaming\GIMP\2.10\scripts
;   Linux
;   /home/yourname/.config/GIMP/2.10/scripts  
;   or
;   Linux system-wide
;   /usr/share/gimp/2.0/scripts

(define WD-SCALES 7)  ; the number of scales for wavelet-decompose

(define (my-script-fu-white-out-background inImage inDrawable)

  (gimp-image-undo-group-start inImage)

    WD-SCALES  ; number of scales (1-7)
    TRUE  ; create a layer group to store the decomposition
    FALSE  ; do not add a layer mask to each scales layer

  (gimp-context-set-background '(255 255 255))

  (let* ( (layers (gimp-image-get-layers inImage))
          (layer-array (cadr layers))
          (wd-layer-group (aref layer-array 0))
          (wd-layers (gimp-item-get-children wd-layer-group))
          (wd-layer-array (cadr wd-layers))
          (wd-residual-layer (aref wd-layer-array WD-SCALES)) )

    (gimp-drawable-fill wd-residual-layer BACKGROUND-FILL)

    (do ((i (- WD-SCALES 2) (- i 1)))
      ((< i 0))
      (let* ( (layer (aref wd-layer-array i))
              (duplicated-layer (car (gimp-layer-copy layer FALSE))) )
        (gimp-image-insert-layer inImage

  (gimp-image-undo-group-end inImage)


  "my-script-fu-white-out-background"  ; func name
  "White out background"  ; menu label
    "White out background using wavelet-decompose.\n"
    "Intended for improving readability of scanned text images."
  )  ; description
  "Alexey Muranov"  ; author
  "copyleft"  ; copyright notice
  "2020-12-31"  ; date created
  "*"  ; image type that the script works on
  SF-IMAGE    "Image"    0
  SF-DRAWABLE "Drawable" 0

  "<Image>/My Script-Fu"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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