Replace all of a certain color around an irregular object in an image obtained from a screenshot


Is there a way to replace all of a certain color around an irregular object in an image obtained from a screenshot?

For example, suppose you have the following image which was obtained using the Snipping Tool in Windows 7. And suppose you want to change the red background to some other color. How would you go about doing that?

Note that the red background in this image is not homogenous or uniform throughout. Instead (and I hope you can see this) it's sort of blotchy or smudged and therefore cannot all be defined by a single RGB combination.

FYI, I'm running Windows 7 and I have PowerPoint 2013 and of course, MS Paint but I don't have Photoshop or any similar application.

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

One option to try in a pinch: Use the background removal tool in PPT to remove the parts you don't want. Then put a regular rectangle filled with the correct color behind the image.

Unfortunately PPT's Background Removal Tool can be frustrating to use, but it's worth a shot. Access it by selecting the picture, then it's on the Picture Tools Format tab (clear over on the left).
You would need something like Photoshop where you can set the tolerance of what is considered, in this case, red.
MS Paint isn't going to cut it.
Joe Winograd, Fellow&MVEDeveloperCommented:
Hi Steve,
IrfanView is excellent (free!) imaging software that I've been using for many years:

Click the Download link on the left to download IrfanView and click the PlugIns link on the left to download the PlugIns, which are needed to give you PDF capability (it's optional...only if you want PDF support...and the other features that come with the PlugIns). Install IrfanView first, then install the PlugIns. Although I recommend adding the PlugIns to get PDF support, that's for general, future usage. For this situation, you don't need it, as IrfanView will handle your PNG screenshot directly.

IrfanView does a very good job, although not perfect. To do it, click Edit>Show Paint Dialog. In the Paint dialog, select the Floodfill tool (looks like a bucket), set the Tolerance to 100 (so that it maximizes the red that it gets), and click the foreground or background squares at the bottom to select the new color you want. Then click the left mouse button anywhere in the red area to change it to the foreground color (or click the right mouse button anywhere in the red area to change it to the background color). Here's an example of changing the red to blue with two mouse clicks using the Floodfill tool – one click in the large outer red area and one click in the small red area between his legs:
IrfanView Floodfill red changed to blueIt's not perfect, as some small red outlines remain, but it's pretty good. Regards, Joe
PMI ACP® Project Management

Prepare for the PMI Agile Certified Practitioner (PMI-ACP)® exam, which formally recognizes your knowledge of agile principles and your skill with agile techniques.

Paul SauvéRetiredCommented:
An intermediate graphics app to consider is Paint.NET (FREE)...
If you would like to install Paint.NET, please use one of the download now buttons below.
Paul SauvéRetiredCommented:
Here is a step-by-step I did since my last post:2013-10-12-a1-frog-to-EE DIY Paint.NET

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
käµfm³d 👽Commented:
*No Points*

I second Paint.NET.
EirmanChief Operations ManagerCommented:
I currently use Photoshop, but I always thought that Gimp was the best free option out there.
It even has it's own topic area here on EE.
Joe Winograd, Fellow&MVEDeveloperCommented:
I wouldn't call GIMP the best option, but it can do this, via Colors>Map>Color Exchange. Here's the red-changed-to-blue image with GIMP 2.8.4:
GIMP - Colors-Map-Color Exchange - red changed to blueRegards, Joe
käµfm³d 👽Commented:
GIMP is a good utility, but I find its UI to be needlessly complex and not very intuitive. (It took me a couple of Googles to figure out how to draw a straight line!).
Joe Winograd, Fellow&MVEDeveloperCommented:
I agree with kaufmed. It took me numerous tries to create the blue frog in GIMP – the workings of Colors>Map>Color Exchange are not at all straightforward. With IrfanView, it was totally intuitive and obvious – Paint then Floodfill with high Tolerance. Regards, Joe
Paul SauvéRetiredCommented:
I would have to agree with Joe...

I suggested Paint.NET as an intermediate solution, whereas GIMP is a more advanced app.

Also, although you can get the same results with IrfanView, it too may be a bit more advanced than (a lot more functions) for someone who is less familiar with image editing apps.

[BTW, to do this with GIMP, use the Select by Color Tool (beside the Fuzzy Select Tool). It selects the same color in the entire image. Then use the Bucket Fill Tool, as you did with IrfanView.]
Joe Winograd, Fellow&MVEDeveloperCommented:
I tried the Bucket Fill tool first, but it changed the red to black and I couldn't figure out how to change the Bucket Fill color. I saw the little dual-square icon (probably foreground and background color, which were white and black), but with no obvious way to select a color. Do you know how to do that? After failing with Bucket Fill, I was able to do it with Colors>Map>Color Exchange.

Re Paint.NET, I'm not very familiar with it (and don't have it installed), but in looking at the screenshots you posted, it seems that its Tools dialog...
Paint.NET Tools from similar to IrfanView's Paint dialog:
Paint dialog IrfanViewDue to my lack of experience with Paint.NET, I can't speak to its ease-of-use comparison with IrfanView. Regards, Joe
Paul SauvéRetiredCommented:
With GIMP and paint.NET, set the color the same way as with IrfanView - click on the foreground color and select a new one:Background colorColors.gif
Joe Winograd, Fellow&MVEDeveloperCommented:
What menu picks get you to the foreground/background color squares in GIMP?
Paul SauvéRetiredCommented:
This was the default layout of GIMP 2.8.4 when I installed it!:GIMPYou can add options to the Toolbox with Edit -> Preferences -> Toolbox! Check the Show Frgd & Bkgd color box.

I changed it to Single Window Mode afterwards
Joe Winograd, Fellow&MVEDeveloperCommented:
Doesn't happen here with GIMP 2.8.4:
GIMP no foreground-background squaresAs you can see, [Show foreground & background color] is checked, but no foreground and background color squares are showing.

Update: As I was writing this, I discovered Windows>Dockable Dialogs>Tool Options. That's the ticket! Regards, Joe
Paul SauvéRetiredCommented:
LOL - that was my next comment! Now, try the Single-Window Mode!
lol everyone is having fun green frogs on blue
What is your snapshot of?
as this depends a little on what is in the picture.
You'll  need to separate the area you want to keep so that the background colour only is changed.
Flood fill will do exactly that flood fill the entire image unless you can separate the area you want to leave.
Really an image editor is a lot simpler, I have paintshop pro and what I'd do is put a dotted line around the area I want to keep copy that out and put on to a new background of colour choice
change the back ground  colourIf it helps to simplify
In paint dot net
How to use the Magic Wand Tool in

Windows paint load your image then choose the flood fill bucket
select colour one then choose a colour
Left click inside that area
Note your bucket reflects that colour
step oneWindows PaintMicrosoft Paint purple colourMicrosoft Windows Paint tools
Crop a picture

Or just post your image and we could do it for you ;)
regards Merete
Steve_BradyAuthor Commented:
Thanks for the responses.

This is one of those threads for which I need about 10,000 points.  :P  I'm sorry I don't have that many to assign but I do appreciate all the input and dialog.
Joe Winograd, Fellow&MVEDeveloperCommented:
You're welcome. Always happy to try to help. This was a very interesting thread...I learned some new stuff! Regards, Joe
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Graphics Software

From novice to tech pro — start learning today.