Gimp-Forum.net
How to Separate/Select Different Grays - Printable Version

+- Gimp-Forum.net (https://www.gimp-forum.net)
+-- Forum: GIMP (https://www.gimp-forum.net/Forum-GIMP)
+--- Forum: General questions (https://www.gimp-forum.net/Forum-General-questions)
+--- Thread: How to Separate/Select Different Grays (/Thread-How-to-Separate-Select-Different-Grays)



How to Separate/Select Different Grays - Perodin - 01-19-2017

I work in a small retail shop and take a lot of photos that involve "clear" packaging, and scans that have a natural gradient behind or through the product. There is a visual difference in the grays to the eye, but all manner of auto selects fail. Is there a decent way to get a hold of these backgrounds so I can white out or at the least normalize them? My goal is to utilize a "faster" method, because I can't spend too long on any given item. I am aware of limited masking and contrast tricks, but not seeming to find a good solution. Attached is one of the raw images I start with.[attachment=227]


RE: How to Separate/Select Different Grays - Ofnuts - 01-19-2017

To compensate for the background gradient and get a 100% white background:

1) select a vertical strip over the whole height along one side of the packaging
2) copy to clipboard
3) Ad a layer on top and fill it with side by side copies of the strip. If your image is under 1000px high, this is quickly done: use the "clipboard" pattern and bucket fill the layer with the pattern. Otherwise you may have to manually copy (copy the copies: 1, 2, 4, 8, 16, 32...) or find a script
4) Set that filled layer to "Divide" mode. Your background will turn white everywhere. This can be enough if you just show this over a white web page.

[attachment=228]

Of course this processing blows up the whites in the original image. This can be corrected by deleting the "Divide" layer where you really want to keep the original picture: for instance make a feathered selection over the packaging and delete the matching contents in the "Divide" layer.

Also attached the XCF.


RE: How to Separate/Select Different Grays - Perodin - 01-20-2017

Thank you so much! I actually modified this process slightly. I ended up using the "Color Picker Tool" on the top and bottom extremes of the greys, then the "Blend Tool" to create a approximate but smoothed layer. This eliminated some of the blow up in the white spectrum.[attachment=236]


RE: How to Separate/Select Different Grays - Ofnuts - 01-20-2017

(01-20-2017, 09:34 PM)Perodin Wrote: Thank you so much! I actually modified this process slightly. I ended up using the "Color Picker Tool" on the top and bottom extremes of the greys, then the "Blend Tool" to create a approximate but smoothed layer. This eliminated some of the blow up in the white spectrum.

If you want to be even more accurate, there is this script that will create a gradient by sampling the color in multiple points along a path (your technique assumes that the gradient is linear...).

Unlike many similar questions I have seen asked here and elsewhere, you start with good material so editing isn't too hard.