How can I even out yellow, uneven lighting in a photographed document using GIMP on Linux?

Asked 11/22/2016

6 views

2 answers

0

I have a photo of a document with black text on a white background. The image has several issues: slight blur, visible noise in the white areas, a yellow cast, and uneven illumination so some parts of the paper are darker than others.

In GIMP, Colors > Auto > White Balance helps a bit, but it works better only when applied to small selected regions. Is there a way in GIMP or on Linux to correct this kind of problem locally across the image, so the paper becomes more evenly white while keeping the text readable?

Originally by Photography Stack Exchange contributor. Source · Licensed CC BY-SA 4.0

Photography Stack Exchange contributor

9y ago

2 Answers

10

I assume you have a gradient in overall brightness due to unevben lighting. If that's the case, what you could do is to duplicate the layer with the image and apply the best correction to each part of the image on a different layer: curves for contrast, color balance or desaturate for white balancing.

Then, using layer masks you can paint each region with smooth gradients, in order to blend them together. Desaturation can be used as last step to even a bit the remaining differences.

An alternative approach could be to duplicate the layer (i took a picture with my hand shading half of the card, to reproduce the issue):

Blur it until the text disappears:

enter image description here

And then subtract the resulting layer from the original one select the blending mode as "Grain extract", in order to reverse the unevenness of the lighting:

enter image description here

The lowpass filtering that you achieve by blurring is only effective if changes in lighting are much smoother than the details of text, and it works best with sparser text as it disappears with blurring. Note that in this case, the bold text causes a halo when blurred, which gets inverted when doing the blending. You can try with a larger radius, or try masking it before blurring the duplicate layer.

Also, note that this operation also fixes the white balance as it inverts the color curves.

As a final touch I applied the 'Curves' setting to increase contrast.

enter image description here

It may not be perfect but I'm actually surprised by how that one came out.

Originally by user7984. Source · Licensed CC BY-SA 4.0

user7984

9y ago

0

AI Answer

Generated from our catalog & community — verify before relying on it.

Yes. For a document photo with uneven lighting, the most useful approach in GIMP is local correction rather than a single global white-balance pass.

Two practical methods were suggested:

  1. Layered local adjustments
  • Duplicate the image to multiple layers.
  • Correct each area separately using Curves / Levels / Color Balance.
  • Blend the corrections together with layer masks and soft gradients.
  • If the image is yellow, adjust channels individually: for example, lighten the blue channel, then fine-tune overall value/lightness with Levels.
  1. Remove the background gradient
  • Duplicate the layer.
  • Blur the duplicate heavily until the text disappears, leaving only the lighting/shading pattern.
  • Blend this blurred layer with the original using Grain Extract or Divide/Division to compensate for uneven illumination.

After that, you can:

  • Use Levels to bring the paper closer to white.
  • Optionally desaturate near the end if a color cast remains.
  • Apply Unsharp Mask carefully: larger radius/low amount can brighten paper around text; smaller radius can improve slight blur.

Threshold was not recommended, since it can destroy detail and make results look harsh.

UniqueBot

AI

9y ago

Your Answer