Remove a color from TIFF files

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
Nexus

Remove a color from TIFF files

Post by Nexus »

Hi,
I am producing PDF files from TIFF scans.
I need to batch remove a color from those TIFF's (i have always exatly the same background), let's say it is RGB (240,240,240) that i want to remove from the whole image.
The conversion should be to (255,255,255).

Can ImageMagick do this for me?

The best thing would be to convert to transparency instead than to white (no clue if this is possible at all...), and then take the transparency over to the final PDF.

Any hint is welcome ;)

Thanks for the attention!
Nexus
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Remove a color from TIFF files

Post by snibgo »

General method to change colour (240,240,240) to White:

Code: Select all

convert in.png -fill White -opaque rgb(240,240,240) out1.png
General method to make colour (240,240,240) transparent:

Code: Select all

convert in.png -transparent rgb(240,240,240) out2.png
There is a knack to getting transparency in PDF files, which I forget. A search of this forum should provide the solution.
snibgo's IM pages: im.snibgo.com
Nexus

Re: Remove a color from TIFF files

Post by Nexus »

Thank you that worked !
Post Reply