Detecting dark images in scanned pdf's

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
MMM
Posts: 2
Joined: 2011-12-04T22:59:24-07:00
Authentication code: 8675308

Detecting dark images in scanned pdf's

Post by MMM »

Hi,

i'm printing quite a lot and wondered if there's a script way to identify dark contiguous areas, esp. black image/illustration backgrounds and distinguish them from text in order to save toner by selectively adjusting levels ...

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

Re: Detecting dark images in scanned pdf's

Post by anthony »

convert the imge to greyscale (as a precaution) then look at the averge color of the image.
scanned text should have a very high (lots of white) value. Images with dark areas should stand out very well.

If you want to locate patches of dark color, I would blur the image and then do a 'fuzzy trim' with a 'white seeding color (add a white border as a starting point for trim) and see if you get anything.

See Trimming Noisy images
http://www.imagemagick.org/Usage/crop/#trim_noisy
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
MMM
Posts: 2
Joined: 2011-12-04T22:59:24-07:00
Authentication code: 8675308

Re: Detecting dark images in scanned pdf's

Post by MMM »

Thanks. I've also found viewtopic.php?f=1&t=8331. Shadow/Highlights might work too.
Post Reply