View Full Version : How to remove a color from a flattened JPEG and preserve what is below?

01-04-2010, 08:56 PM
(Hopefully this is a new question. I searched the forum for "removing color" and similar phrases but didn't have any luck.)

I have a map that I've copy/paste'd from a Paizo PDF (for CotCT, for anyone who's interested). The problem is that the original JPEG from the PDF has an overlay on top that I'd like to remove.

It appears that the original map had a layer with two straight lines that join at a 90-deg angle in a light color. When the JPEG was flattened, the semi-transparent layer with the lines obscures some of the ground underneath.

What I need is some kind of filter that will subtract out a given color value. I tried using GIMP's Color to Alpha... but that didn't work. It made the light color transparent but removed the color from underneath. (Hmm, maybe with the right ground pattern underneath the original image, the transparency effect might be enough?)

Here's a screenshot of the corner that shows what I'm trying to accomplish.

Maybe I could work out some way of mapping colors from the obscured area to an existing color somewhere else on the map? So an obscured pixel with a certain color value could be mapped to another pixel color, then all similar pixels would be changed at once. But this seems awfully tedious to define and subject to error since the image is a lossy JPEG. :(

Thanks for any help/suggestions!

01-04-2010, 09:28 PM
First, I have no idea of how to do it in Gimp. Second, in PS this is a tremendously tedious thing to do...lots of undo and try again involved. The most success that I've ever had in doing this was not with filters or anything automated. Instead I just use the eyedropper to choose a color then hand paint over the area in question...blurring, smudging, distorting along the way. Copying and pasting small sections into place also works with some hand tweaking. PS clone stamp and pattern stamp tools also help a bit...not sure what Gimp has. In the end it always involves lots of hand tweaking and hair pulling.

01-05-2010, 08:30 AM
The higher res the image the better so this can be difficult in this case. What you need is the inverse of the light patch and then add it in. If its too light (or dark) then you can find that the lightened areas have saturated to the 255,255,255 color and its hard to reverse. So if you still have that light patch as a brush or image that you can get at (say its a VTT token) then get the inverse of it and blend that in. Recently I demoed removing a watermark for somebody which was mostly successful. You could still see the outline which is why higher res is better and I was not given the mark to invert so I had to make it. I used that inverse with dodge and burn to get the amount right for the blend.

If what your trying to remove is of colors very different to the background or it has a fixed pattern thats very different from the background then its much easier. Stuff with noise on the top is very hard automatically.

01-08-2010, 07:34 PM
When the pixels get this light it's very hard (impossible) to automatically adjust them to match the surrounding pixels.

The right tool for this particular image seems to be the patch-tool in photoshop. See below for a quick example. I don't know if there's a similar tool in Gimp.

Also, if the map looks ok in the PDF you can simply zoom in and use the "prn scr" button to get a screen dump.

If you want to extract images from a PDF you should preferably use Illustrator or Adobe Acrobat (not Adobe Reader).

01-09-2010, 06:36 PM
Wow, Carnifex, that looks great!

I'm not familiar with PS so I don't know what the "patch tool" does and therefore can't determine if there's a similar tool for GIMP.

The white border is too close to the real "meat" of the image, which is why I want to remove the border. But I'm thinking I may just use the clone tool and copy other parts of the image on top of the border and be done with it. ;)

I've been using Acrobat Reader 8 (since 9 won't allow me to select images separate from the text overlayed on top of the image by the PDF). A screen capture is possible since I've now determined how to set the resolution of the capture (a Preference setting in Reader). I have an old copy of Acrobat Pro but it's v6; I've been meaning to update but haven't really seen the need.

The game session that I want to use this map for is this Tuesday night (Jan 12th) so I probably won't have time to play with this; I plan to just display the map with the (ugly) white border and leave it at that. But this kind of thing comes up pretty often so I do plan to play with it a bit and see what I can make work.

Thanks for the input, folks. It's been very helpful to hear your ideas.