Extract color
-
Juan
- Mitglied
- Beiträge: 615
- Registriert: Do 06 Okt 2011 08:08
Extract color
Hi all,
I have been trying to extract a specific color from an image (in this case the light green that belong to the walls) but the result with Select colors command is giving me an aliased mask and I can´t work with that. I tried with Automask but I start loosing small parts where the selection needs to be there. Can somebody point me the right direction please?
I´m loosing resolution in this example because the upload file size limit. The original image is 4000x2500px on 32bits
Thanks in advance,
Juan
I have been trying to extract a specific color from an image (in this case the light green that belong to the walls) but the result with Select colors command is giving me an aliased mask and I can´t work with that. I tried with Automask but I start loosing small parts where the selection needs to be there. Can somebody point me the right direction please?
I´m loosing resolution in this example because the upload file size limit. The original image is 4000x2500px on 32bits
Thanks in advance,
Juan
Du hast keine ausreichende Berechtigung, um die Dateianhänge dieses Beitrags anzusehen.
-
Hoogo
- Beta Tester
- Beiträge: 4169
- Registriert: So 03 Jul 2005 13:35
- Wohnort: Deutschland
Re: Extract color
About the picture:
Are these the colors of your real picture? Is it a generated graphic? No Jpg, but 32Bit?
Then I would assume that the colors should match really perfect, "select colors" with zero tolerance should select the green. Turn off "smooth selection".
If it is made from Jpg or in someway from a photo, then I would assume that the colors are not perfect. "Select colors" with a little tolerance should do then.
The "automask"-tool should do just the same, it selects just as the "select colors" without the smooth-option.
But what about the edges?
Are the colors mixed at the edges?
If not, then everything is fine.
But in your example they do! If you can't use an aliased mask, then it will be tricky to create masks for each color that don't leave some blank space between them. You have to add these mixed pixels to one of the areas. Reducing the pictures to 32 different colors using median cut and tweaking the created palette could help a little.
Or reduce to 32 colors, tweak the palette and then convert to vector! You can use the created layers as layer masks then.
Are these the colors of your real picture? Is it a generated graphic? No Jpg, but 32Bit?
Then I would assume that the colors should match really perfect, "select colors" with zero tolerance should select the green. Turn off "smooth selection".
If it is made from Jpg or in someway from a photo, then I would assume that the colors are not perfect. "Select colors" with a little tolerance should do then.
The "automask"-tool should do just the same, it selects just as the "select colors" without the smooth-option.
But what about the edges?
Are the colors mixed at the edges?
If not, then everything is fine.
But in your example they do! If you can't use an aliased mask, then it will be tricky to create masks for each color that don't leave some blank space between them. You have to add these mixed pixels to one of the areas. Reducing the pictures to 32 different colors using median cut and tweaking the created palette could help a little.
Or reduce to 32 colors, tweak the palette and then convert to vector! You can use the created layers as layer masks then.
-
Juan
- Mitglied
- Beiträge: 615
- Registriert: Do 06 Okt 2011 08:08
Re: Extract color
Hi Hoogo,

Cheers
Juan
Is a file format that doesn´t has any compression, is like a raw format and 32Bit but from a 3D render. PL supports a plugin from NextLimit "Maxwell Render" that open directly their format into PL.Hoogo hat geschrieben:Are these the colors of your real picture? Is it a generated graphic? No Jpg, but 32Bit?
I just tried your suggestion but I still get some aliasing problem, check the result more evident next to the lamp in the window frameHoogo hat geschrieben:Then I would assume that the colors should match really perfect, "select colors" with zero tolerance should select the green. Turn off "smooth selection".
It sounds tricky, but thanks for your suggestion, let´s see if I have the time and patience to do itHoogo hat geschrieben:But in your example they do! If you can't use an aliased mask, then it will be tricky to create masks for each color that don't leave some blank space between them. You have to add these mixed pixels to one of the areas. Reducing the pictures to 32 different colors using median cut and tweaking the created palette could help a little.
Or reduce to 32 colors, tweak the palette and then convert to vector! You can use the created layers as layer masks then.
Cheers
Juan
Du hast keine ausreichende Berechtigung, um die Dateianhänge dieses Beitrags anzusehen.
-
Hoogo
- Beta Tester
- Beiträge: 4169
- Registriert: So 03 Jul 2005 13:35
- Wohnort: Deutschland
Re: Extract color
If you look at more than 100% zoomlevel at the edges of the colored picture, then you should easily see if there's aliasing or not. If the colors do not mix at the edges, then it should be easy to create a hard mask.
By the way: What's the problem with an aliased mask?
By the way: What's the problem with an aliased mask?
-
Juan
- Mitglied
- Beiträge: 615
- Registriert: Do 06 Okt 2011 08:08
Re: Extract color
As you can see in the second picture, when I apply an adjustment layer using that aliased mask I start getting jagged edges next to the window frame.Hoogo hat geschrieben:By the way: What's the problem with an aliased mask?
Cheers,
Juan
-
Hoogo
- Beta Tester
- Beiträge: 4169
- Registriert: So 03 Jul 2005 13:35
- Wohnort: Deutschland
Re: Extract color
I see.
Aliased= hard edges, jaggies, pixels, funky moirees and stuff like that
Anti-aliased=smooth edges
So I think you don't need a hard selection. How does it look like when you use "tools > colors > select color" with ""smooth selection" checked?
Aliased= hard edges, jaggies, pixels, funky moirees and stuff like that
Anti-aliased=smooth edges
So I think you don't need a hard selection. How does it look like when you use "tools > colors > select color" with ""smooth selection" checked?
-
Martin Huber
- Entwickler

- Beiträge: 4298
- Registriert: Di 19 Nov 2002 15:49
Re: Extract color
I can't reproduce your problems with the Automask. With the deselected "Only Contiguous Areas" option it selects the wall (including small parts) fine - apart from the smaller than 1 pixel gaps in the balcony.Juan hat geschrieben:I have been trying to extract a specific color from an image (in this case the light green that belong to the walls) but the result with Select colors command is giving me an aliased mask and I can´t work with that. I tried with Automask but I start loosing small parts where the selection needs to be there.
The Automask creates an aliased mask, so you have to postprocess it by using "Enhance Edge" in the Tool settings.
You can inspect the created mask by using the View palette (View > Panels > View). Here you can switch to "Magnifier" and select the option "Selection".
Martin
-
Juan
- Mitglied
- Beiträge: 615
- Registriert: Do 06 Okt 2011 08:08
Re: Extract color
ExactlyHoogo hat geschrieben:Aliased= hard edges, jaggies, pixels, funky moirees and stuff like that
Anti-aliased=smooth edges
I tried but no luck, if I set 0% tolerance I get the aliased borders and when I start rising the tolerance other elements start appearing in the selectionHoogo hat geschrieben:How does it look like when you use "tools > colors > select color" with ""smooth selection" checked?
I made I really dirty "shortcut", I used the filter brush and choose maximum and painted over the more evident zones and then a gaussian blur on those areas, I know... is not perfect but I had to get the job done.
I wish there would be a more solid solution for this for my upcoming projects if possible of course.
Cheers
Juan
-
bkh
- Beta Tester
- Beiträge: 3687
- Registriert: Do 26 Nov 2009 22:59
Re: Extract color
You mean the jagged transition between the white window frame and the grey wall? You might try refining a hard (aliaased) mask using the "Enhance edges" button in the Lasso tool settings. You can also try using "Select Colors …" with a soft selection and modify the transition using "Curves". Neither will be perfect (because colours don't add in the mathematical sense if your gamma value isn't 1), but the result should be much better.Juan hat geschrieben:Hoogo hat geschrieben:As you can see in the second picture, when I apply an adjustment layer using that aliased mask I start getting jagged edges next to the window frame.
It might be better to scale the image up by a factor of 4 or so (or, even better, use a higher resolution input image), do the manipulaitons, and to scale down to the original size afterwards (I'd use bicubic interpolation for the scaling). In that way, aliasing doesn't matter much.
Cheers,
Burkhard.
-
Hoogo
- Beta Tester
- Beiträge: 4169
- Registriert: So 03 Jul 2005 13:35
- Wohnort: Deutschland
Re: Extract color
What a cool ideaMartin Huber hat geschrieben:The Automask creates an aliased mask, so you have to postprocess it by using "Enhance Edge" in the Tool settings.
-
Juan
- Mitglied
- Beiträge: 615
- Registriert: Do 06 Okt 2011 08:08
Re: Extract color
Thank you for the tip, it does a nice job, just few small places like the balcony like you said and some other parts were the colors gets "clamped" between a bright color and darker color.Martin Huber hat geschrieben:I can't reproduce your problems with the Automask. With the deselected "Only Contiguous Areas" option it selects the wall (including small parts) fine - apart from the smaller than 1 pixel gaps in the balcony.
The Automask creates an aliased mask, so you have to postprocess it by using "Enhance Edge" in the Tool settings.
Could be another method only for this specific balcony area?Martin Huber hat geschrieben:apart from the smaller than 1 pixel gaps in the balcony
Would be nice to "freeze" the magnifier so when changes are made we see it right away.Martin Huber hat geschrieben:You can inspect the created mask by using the View palette (View > Panels > View). Here you can switch to "Magnifier" and select the option "Selection".
Thanks, I have read about this "downsampling" the image but I never get the guts to do it, at least in 3D bigger image means longer render times.bkh hat geschrieben:It might be better to scale the image up by a factor of 4 or so (or, even better, use a higher resolution input image), do the manipulaitons, and to scale down to the original size afterwards (I'd use bicubic interpolation for the scaling). In that way, aliasing doesn't matter much.
Thank you all for your input.
Juan
-
Martin Huber
- Entwickler

- Beiträge: 4298
- Registriert: Di 19 Nov 2002 15:49
Re: Extract color
Well, that 's definitely a problem because of the quite similar greens in the picture, but usually that's a job for the Border Matting tool.Juan hat geschrieben:Could be another method only for this specific balcony area?Martin Huber hat geschrieben:apart from the smaller than 1 pixel gaps in the balcony
The workflow should be like this:
- You create your basic mask with the Automask tool (or any other suitable tool) and enhance the edge.
- Now you switch to the Border Matting tool.
- The Border Matting tool has several subtools. In your situation you just need the Define Working Area tool (the eraser). Select all the gaps in the balcony. You don't have to select the gaps exactly and may select parts of the balcony, too.
- After that make sure, that "Edit Soft Edge" is deselected.
- Now press "Apply" in the Tool Settings.
Martin
-
Juan
- Mitglied
- Beiträge: 615
- Registriert: Do 06 Okt 2011 08:08
Re: Extract color
Hi Martin,Martin Huber hat geschrieben:Well, that 's definitely a problem because of the quite similar greens in the picture, but usually that's a job for the Border Matting tool.Juan hat geschrieben:Could be another method only for this specific balcony area?Martin Huber hat geschrieben:apart from the smaller than 1 pixel gaps in the balcony
The workflow should be like this:
- You create your basic mask with the Automask tool (or any other suitable tool) and enhance the edge.
- Now you switch to the Border Matting tool.
- The Border Matting tool has several subtools. In your situation you just need the Define Working Area tool (the eraser). Select all the gaps in the balcony. You don't have to select the gaps exactly and may select parts of the balcony, too.
- After that make sure, that "Edit Soft Edge" is deselected.
- Now press "Apply" in the Tool Settings.
Martin
Sorry for the late reply. I just tried your suggestion but I´m getting weird artifacts all over, here is a video showing the workflow, maybe I´m doing something wrong.
http://youtu.be/s4FStBWDfsw
Cheers
Juan
-
Martin Huber
- Entwickler

- Beiträge: 4298
- Registriert: Di 19 Nov 2002 15:49
Re: Extract color
- As I said above: Deselect "Edit Soft edge". If you select it, PhotoLine will recalculate the soft borders of the whole image. You don't want that in your situation.Juan hat geschrieben:Sorry for the late reply. I just tried your suggestion but I´m getting weird artifacts all over, here is a video showing the workflow, maybe I´m doing something wrong.Martin Huber hat geschrieben:(…)
- After that make sure, that "Edit Soft Edge" is deselected.
- Now press "Apply" in the Tool Settings.
- After "Apply" you don't see the direct result of the border matting. Instead you see the areas completely masked (red overlay color), partially masked (orange overlay color) and unmasked (yellow overlay color). So your video doesn't say much about the quality of the result. It just says, that there are areas, that are partially masked. The small blocks you are seeing are usually caused by lossy compression, but they don't necessarily indicate a bad result.
- It is better to inspect the mask with the dialog "View > Panels > View" using "Magnifier > Selection" (choose a high-contrast background color).
Martin