TransWikia.com

How do I make a bottle image transparent?

Photography Asked on August 31, 2020

I’ve taken some stock photography of lots of clear bottles, and now want to remove the background (which is white-ish, because at a pinch I could leave it…) so that the bottle becomes transparent with highlighting.

My bottles are clear with different colored liquids with multiple refraction and reflection surfaces. I am looking for a background color subtraction effect that will allow me to get to transparent (hopefully with some sort of effect/opacity slider).

Ideas that I can’t pull off yet:

  • Combine layer with a color fill layer (keyed off the “transparent color”) in some manner to produce some output that could be used as the starting point of a layer mask
  • Same layer combination as above, but somehow translating “pure white” to transparency.

Notes for what doesn’t work (Photoshop terminology):

  • “Color Range” and delete (fuzzy select, but not graded/alpha) – results in harsh lines and only leaves the pure white and dark highlights and shadow refractions/reflections
  • Magic wand selections for the same reason
  • “Background Eraser” because although it is able to only subtract a certain color and leave “the rest”, it (like all tolerance based tools) eventually hits a colour slightly outside of the range that it just won’t touch.

I’ll add more if I can remember what I’ve found

4 Answers

Gimp has a really nice 'Color to Alpha' feature that sounds like it does exactly what you want. It doesn't just erase one color, but tries to make things that are almost white into almost transparent. It's not perfect, but comes pretty close. Here's an example from the docs: 8.34. Color to Alpha…

Correct answer by Mark on August 31, 2020

This is what it sounds like to me that you are trying to do: You have taken a picture of transparent objects and would like to remove the background and preserve the transparency of the foreground objects (so that perhaps you could replace the background with something else).

First thing is a choice you have to make: You can use built in tools to do the job as quickly as possible, but you sacrifice a lot of quality and realism. Or you can put in a little time and do it manually but with far better results. I would choose the latter ;)

If I had to pull that off I would probably shoot a white background to start with, then in Photoshop (or the equivalent):

  1. Cut out the negative space (the background that doesn't show through the bottles. Basically anything you can remove entirely from the image. Be careful to preserve hard edges so that the image looks realistic if you replace the background later.
  2. Make a new background layer that is black (you will delete it later to get your transparency back).
  3. Create a clipping mask for the bottles and whatever else is in the foreground. (After this all you should see is back because the clipping mask will be empty).
  4. Slowly brush in parts of the image by adding content to the clipping mask. Add opacity slowly. Make sure hard edges are completely opaque, areas where the color affects the background are semi-transparent, and areas where you could originally see the background are completely transparent.

That would be my workflow. I would also probably stick a semi-transparent copy of the original image between the background and the clipped image as a reference for the brush and then get rid of it later. If you want a perfect background replacement though, you are going to need to do a little touch up depending on what the background is to make reflections and diffractions look realistic. Best of luck!

Answered by Jay on August 31, 2020

I have an idea

shoot the bottle once with a black background, exposing for the highlights, then with a white background, exposing for the shadows.

Pull the two images into a new document with a transparent background, applying the darken or multiply blend mode to the white background pic, and lighten or screen to the dark background pic.

Of course I haven't tried this in practice, but might have to after work!

Answered by Nick on August 31, 2020

I can't believe - I figured it out! (I am just a photoshop hacker)

So heres what will get you 80% of the way to a perfect transparency (higher numbers are on the top):

  1. Rename your bottle layer (1) to "Original" and hide it.
  2. Get a nice background (perhaps a fill color) and put it in a layer "Background" (2). This is for looking at how we're going along the way...
  3. Create a new copy of "Original" and call it "Alpha and Highlights" (3).
  4. Add a layer mask to "Alpha and Highlights"
  5. Take a copy of your "Original" and call it "Alpha Source" (4)
  6. Create a fill layer (5) with the color of your background called "Alpha Merge". My background is (214, 193, 188) - I believe a grey color close to (but not white) may actually yield the best results (as opposed to a chroma key) - this is because of step 6.
  7. Change the blend mode of "Alpha Merge" to Different. This shows us how much each part of the image matches the background. Perfect black (0,0,0) means that the bottle is 100% transparent at that point.
  8. Merge "Alpha Source" and "Alpha Merge" layers together. Rename this to "Alpha Mask" (4). At this point the goal needs to be considered: We know which part of the bottle is fully transparent, but there are also highlights and shadows we want to preserve. (Note at this point I have only achieved preserving the highlights - I'll update for shadows later). Now white is very close to my grey; it would show as (41, 62, 67) at the moment which is rather dark. For this reason...
  9. Add a curves adjustment to the "Alpha Mask" layer, and push the curve to the left so that it starts at 0 and gets to 100% about 10-20% in from the left. This will give us a transparency band of around 20-40% of the "sameness" of the background (before it becomes completely opaque - as said above, this works for highlights; shadows not so well...). You should now have an image that is basically white, but is black in the areas that match the background. You need to ensure that areas that should be white are completely white at this point.
  10. Copy the contents of "Alpha Mask", alt-click on the "Alpha and Highlights" mask layer and paste. At this point, if you have only got "Alpha and Highlights" and "Background" visible, you'll have a decent transparency, but all the highlights will be washed out...
  11. Select "Alpha and Highlights" and "Alpha Mask" and group them into a smart object. Open the smart object for editing...
  12. Duplicate your layer and hide it (so you have a reference point for when you stuff up :)). I won't detail the modifications you'll need, except to say that I needed to adjust certain portions of my image to make highlights brighter, and also more transparent (around the bottom of my bottle
  13. Add a "Curves" adjustment layer at the top. We're going to use this to make the highlights way brighter - they need to be, since most of them have a large amount of transparency now. Make the curve a bit like an 'S' - I have full white and full black for 25% from each end. (As stated, I haven't got shadows working quite yet, but this is what would be needed).
  14. Save and exit the smart object, and you should now have a really great start on a transparent bottle!

If someone would like to use this to make a tutorial (with images etc), feel free (I may even get to it one day) as long as you reference this answer in your tutorial and put a link in the comments below.

Answered by Stephen on August 31, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP