How to improve the 'printability' of this image ?

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Posts: 11
Joined: 2009-11-30T02:06:33-07:00
Authentication code: 8675309

How to improve the 'printability' of this image ?

Post by rshea »

[Disclaimer (!): this post overlaps with my previous one at viewtopic.php?f=1&t=21855 but things have moved on a little since then]


I'm helping a friend of mine with some photographs of sheet music and I'm hoping you can help me !

I'd like a technique to make the illumination within the image more even than it is currently. If you look at this one :


Full version here

You can see that the top left hand corner of the page is significantly brighter than the bottom right hand corner. I'd like to make it so that there was a very even lighting at all points on the page.

Can Imagemagick do this ?


They are colour photos taken on a point and shoot in non-ideal lighting and we'd like to print them in greyscale and to make them as readable as possible.

I've made improvements to them by: greyscaling; upping the contrast; and doing some unsharpening, like this one :


[Full version here : ... HARP-3.PNG]

but as you can see the uneven illumination is almost more pronounced in this version and when you print it that effect seems more pronounced than it does on the screen.

I'd be grateful for any suggestions.

User avatar
Posts: 8884
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: How to improve the 'printability' of this image ?

Post by anthony »

I would do two things...

1/ un-distort the image (lens, and perspective) Expecually important is to remove the dark surrounding edges.
Len Correction (removal of camera barrel distortion)
Fred Weinhaus' script for example for automatic perspective correction ... /index.php
For manual correct of perspective see the distortion examples.

2/ use a divide by background colors to remove the variations and increase contrast

Note that a better blur method for extracting the background color shading, is that rather than blurring the
whole image, to mask and remove (make a hole) of the foreground text, then fill in that hole (hole filling).
That is...
* generate a mask all the foreground parts
* cut out the foreground parts (leaving holes)
* blur to spread background colors into the holes.
* turn off transparency (remove any left over transparency effects)
See.. Removing Text and Logos

That image is then used to remove shading effects (dividing it from the original image).
Anthony Thyssen -- Webmaster for ImageMagick Example Pages

User avatar
Posts: 26383
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How to improve the 'printability' of this image ?

Post by fmw42 »

If you are on Linux/Mac or Windows w/Cygwin, try my textcleaner script at the link at the bottom. The following quick test seemed to work and you can then add more parameters to make it some better.

textcleaner -g -e stretch -f 50 -o 10 DSC04539.jpg DSC04539_f50_o10_stretch.jpg