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?".
Post Reply
rshea
Posts: 11
Joined: 2009-11-30T02:06:33-07:00
Authentication code: 8675309

How to improve the 'printability' of this image ?

Post by rshea » 2012-09-20T16:06:08-07:00

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

IN SUMMARY

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 :

Image

Full version here https://s3.amazonaws.com/tcg-utilities/DSC04539.JPG

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 ?

MORE (PERHAPS UNNECESSARY) DETAIL

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 :

Image

[Full version here : https://s3.amazonaws.com/tcg-utilities/ ... 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
anthony
Posts: 8883
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 » 2012-09-20T16:46:05-07:00

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)
http://www.imagemagick.org/Usage/lens/
Fred Weinhaus' script for example for automatic perspective correction
http://www.fmwconcepts.com/imagemagick/ ... /index.php
For manual correct of perspective see the distortion examples.
http://www.imagemagick.org/Usage/distorts/#perspective

2/ use a divide by background colors to remove the variations and increase contrast
http://www.imagemagick.org/Usage/compose/#divide

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
http://www.imagemagick.org/Usage/photos/#removing

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

User avatar
fmw42
Posts: 25417
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 » 2012-09-20T17:08:43-07:00

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

Post Reply