Saturday, August 06, 2011

How to remove highlight from a text image [replace one color with another]

For my previous post, I made use of an image which originally had highlighted text as seen below. While the content of the text was what I wanted, the highlighting itself was unnecessary. Thus, removing the highlighting would make the picture more suited for my needs.
Click the image to view a larger-sized picture
20110805-Remove-Text-Highlight-01

20110805-Eraser-PaintNet-06While it was possible to erase the highlight using the Eraser tool available in even the most basic photo-editing software, it would've made the task very tedious & time-consuming due to small space available to move the eraser around between two line of text. Moreover, there was always the risk of accidentally erasing a portion of the text in the picture, thereby rendering the picture useless for my needs.

20110805-Recolor-PaintNet-02As I found out then, Paint.Net has a nifty tool using which the job can be done very easily. Using the Recolor tool, available under the Tools menu bar [keyboard shortcut F5] it is possible to replace any color in the image with any other color. In this case we need to replace the yellow color of the highlight with white color of the background [page colour].

20110805-Color-Picker-PaintNet-03First, in order to select the exact shade of the highlight, a tone of yellow here, we will make use of the Color Picker tool. Once the tool has been selected, take the cursor [which will now look like a dropper] over the yellow highlight & click on it. Be careful not to click while the cursor is either over the white page or the black text. Only the yellow color must be clicked on using the picker tool.

20110805-Color-PaintNet-0520110805-Color-PaintNet-04Once done, you will immediately notice that the primary color in the Colors window [keyboard shortcut F8] has changed to that shade of yellow [see, left]. However, for our task we need it to be the secondary colour. Hence, click on the icon labeled Swap colors. Once done, the yellow will become the secondary color & white that had become the secondary color becomes the primary color once again [see, right].

20110805-Brush-Width-PaintNet-0720110805-Recolor-PaintNet-02Once this is done, select the Recolor tool from the Tools menu bar. According to convenience, select the suitable Brush width. For my requirement, 50 seemed suitable. With the mouse cursor now appearing like a circle,20110805-Recolor-Cursor-PaintNet-08 hold down the right click button of the mouse & move the cursor over the picture. As you move, you will notice that all the yellow highlight is now turning to white of the background. Even if you move the cursor over the black text, it remains unaffected. What this tool basically does is, replace the Secondary colour [yellow] as selected in the Colors window with that of the Primary [white] & leaves all the other colors [black] untouched.

The final outcome, a clean image.

Before:
20110805-Highlighted-picture-PaintNet-10

After:
20110805-Clean-picture-PaintNet-09

Some months back, as part of GAOTD promo, I had downloaded a screen capture tool. But since then haven't had any opportunity to use it for any significant purpose. This post gives me that bit of a chance to put it to some use. Prepared a screencast of the procedure. It is available in Full-HD format [1080p]

Remove text highlight from image - replace one color with another all over

Godspeed

Also: Seam carving pictures to remove unwanted elements