What's new

How to select multiple objects from an image and then make the background black?


rice

New Member
Messages
3
Likes
0
Hello,

I've been searching Google for hours now, but I can't find exactly what I need. I have an image that I'm trying to prepare for a an image detector. I want to put rectangles around the
objects in the image I want to identify and then I want to turn the rest of the image black. Every time I use the shape tool, PS creates a new layer, after about eight of them
I merged them all. I then tried to select the background, but the fill options keep wanting to fill in the rectangles I made and leave the rest of the image untouched. I tried to
apply a mask, but the only tool that seems to do what I want is the brush, however it is a circle and I need a rectangle.

Can someone please help me out?

Thank you
 

IamSam

Administrator
Staff member
Administrator
Messages
16,863
Likes
10,853
Hello and welcome.
Your problem would be much easier to help with if you provided some screenshots. It's very difficult to give advice based on a written description. It sounds like to me that you included the "image" layer when you merged the triangles. The "image" you speak of should be on it's own layer. This way you can add selections to the "image" layer with a mask and the triangles won't be a problem.

If the triangles are to be a part of the background removal/blackened bg, then just make a selection of them and then use a layer mask on the "image" layer.

(Edited to explain)
Image with rectangles...
Screen Shot 2019-10-20 at 12.25.51 AM.png

Layers panel with individual rectangle layers.
Turn off rectangle layers, Shift + Cmd/Cntrl + Click each rectangle layers thumbnail and then add selections to the image layer using layer mask.
Screen Shot 2019-10-20 at 12.27.18 AM.png

Layers panel with merged rectangle layers.
Turn off merged rectangle layer, Cmd/Cntrl + Click rectangle layers thumbnail and then add selections to the image layer using a layer mask.
Screen Shot 2019-10-20 at 12.26.39 AM.png

Either way you choose to do it, the end result is rectangles surrounding items of an image with a black background.
Screen Shot 2019-10-20 at 12.26.48 AM.png

Since I don't follow what you're trying to accomplish, that's about all I can tell you for now.
 

admin

Webmaster
Staff member
Administrator
Messages
4,394
Likes
908
If I understand what you are asking, try this:
  1. Use the marquee tool to make a rectangular selection around one of the objects.
  2. Hold the Shift key on your keyboard and make rectangle selections around the other objects, until you have rectangular selections around all the objects you want.
  3. Make a new layer
  4. Invert your selection (Ctrl+Shift+i)
  5. Set black as your foreground color if it's not already, then fill selection with foreground color (Alt+Backspace)
 

rice

New Member
Messages
3
Likes
0
Hello and welcome.
Your problem would be much easier to help with if you provided some screenshots. It's very difficult to give advice based on a written description. It sounds like to me that you included the "image" layer when you merged the triangles. The "image" you speak of should be on it's own layer. This way you can add selections to the "image" layer with a mask and the triangles won't be a problem.

If the triangles are to be a part of the background removal/blackened bg, then just make a selection of them and then use a layer mask on the "image" layer.

(Edited to explain)
Image with rectangles...
View attachment 107150

Layers panel with individual rectangle layers.
Turn off rectangle layers, Shift + Cmd/Cntrl + Click each rectangle layers thumbnail and then add selections to the image layer using layer mask.
View attachment 107152

Layers panel with merged rectangle layers.
Turn off merged rectangle layer, Cmd/Cntrl + Click rectangle layers thumbnail and then add selections to the image layer using a layer mask.
View attachment 107153

Either way you choose to do it, the end result is rectangles surrounding items of an image with a black background.
View attachment 107154

Since I don't follow what you're trying to accomplish, that's about all I can tell you for now.
Yes, that's basically it! I did a quick mock up and attached it. I want the computer to look at the apples, but the rest of the image has a lot of information on it that
I don't need to computer to care about. So, I'm turning it black, that way the computer doesn't have to spend so much time processing it.

apples.jpg
 

rice

New Member
Messages
3
Likes
0
If I understand what you are asking, try this:
  1. Use the marquee tool to make a rectangular selection around one of the objects.
  2. Hold the Shift key on your keyboard and make rectangle selections around the other objects, until you have rectangular selections around all the objects you want.
  3. Make a new layer
  4. Invert your selection (Ctrl+Shift+i)
  5. Set black as your foreground color if it's not already, then fill selection with foreground color (Alt+Backspace)
Thank you, this was a faster way to do what I was trying to do. The only difference was that instead of using a new layer I just save the image as new file.
 

Top