5

I have a smart object layer whose content is partly transparent. How can I create an effect such that pixels with alpha greater than some value become opaque, and other pixels become fully transparent?

I know that I could stack up 15-20 copies of the SO to get an opaque version, but I can't figure any useful way to mask the result.

Note: I'm looking for a way to set up a PSD such that the results of this threshold effect get applied dynamically, without manual steps. I know that it's possible to manually extract a layer's transparency, edit it, and then reapply it as a mask, but I'm looking for a setup where I won't have to re-execute manual steps every time the content of the smart object changes.

Example image:

Sample image

Update:

Long story short, what I was going for here isn't possible. Photoshop does let you manipulate a layer's transparency, but only if you manually extract it into a color layer and later re-apply the colors as a mask. It's not possible to get similar results with layer adjustments and built-in filters, so there's no way to get the effect without executing manual steps or saved actions every time the source layer changes.

I'll go ahead and mark @AAGD's answer as correct since it's the best manual way of getting the effect I hoped for.

  • Could you please show us and example or what you want to achieve, this is very vague visual information, feels like explaining a blind man what colour the sky is. Thanks – Alex Satriani Feb 19 '16 at 6:57
  • @Alex Sigh. Example added. – fenomas Feb 19 '16 at 10:07
  • I didn't quite understand what you were trying to achieve at first, then thought it would be simple with a threshold adjustment layer, but it isn't as simple as that. At least without a number of manual steps. I've got some ideas that I will try and work out later if you don't get any better answers first. – Cai Feb 19 '16 at 10:38
  • Cai: Thanks for any ideas! Though TBH, now that I've had a few days to look further I suspect it's impossible without finding or making a 3rd party. Apparently there was once a filter that did exactly this, but it doesn't work with current (64bit) Photoshop. – fenomas Feb 19 '16 at 11:29
  • 1
    Photoshop is a good and broad software but alas its a bad compositor. – joojaa Feb 23 '16 at 11:36
2
+100

I'd say having the alpha as a channel would help. This could then be manipulated with controls like Threshold or Levels. To get the alpha cmd-click (on mac) the layer icon of your smart object. This will create a selection. Then create a new channel. The selection will be translated into a grayscale representation of your transparency. Edit the channel, make it a selection again and with this selection you can create a mask on your non-transparent (20 copies merged) layer.

  • Thanks - I see what you mean. If possible though, I'm trying to get this effect via layer adjustments and so forth, rather than as a manual process. I edited the question to reflect this. Thanks for any ideas! – fenomas Feb 16 '16 at 2:39
3

I can see one problem right off the back with what you are trying to do. You can't change the internal mask of a Smart Object without editing the smart object itself. So you will ALWAYS have transparency inside the smart object to contend with when editing outside the Smart Object. This should hopefully become more clear by the end of this answer.

With that said, there is a way to get close to what you want to do without editing the Smart Object itself, that can be scripted into an action, and run as a batch process or as a droplet. Below, I will walk through the steps to create a Photoshop Action to do this

For this example we will use the purple-green-orange gradient as our RGB image, and this black to white gradient as our mask with various levels of transparency.
Purple - Geen - Orange imagemask for PGO image

For this example these images results in a Smart Object that looks like this in Photoshop.
3

Given this as an example here's what I suggest:

  1. Select the Smart Object layer, and chose menu Select -> Load Selection...
    4
  2. In the Load Selection Dialog make sure the channel is set to Layer 0 Transparency. This should actually be the only thing you an choose if the only item in the current Photoshop file is the Smart Object itself.
    5
    For my example this results in a "marching ants" selection like this.
    6
  3. With the Smart Objects compound transparency selected choose menu Layer -> Layer Mask -> Reveal Selection.
    7
    This will create a Layer Mask for the Smart Object that matches the Smart Objects compound transparency. This will have the effect of making the image look MORE transparent as you are now adding a transparency to a transparency.
    8
  4. With the new Layer Mask selected choose menu Image -> Adjustments -> Levels... to bring up the Levels dialog.
    9
  5. In the Levels dialog you want to set your Black Input and White Input points to be together. You can NOT set the Black and White points to the same number. They MUST be separated by a least a single value that represents the Grey Point.
    For my example, I want every level of transparency below 50% grey in the mask to be completed transparent, and any value above 50% grey to be opaque. This means I set the Black Input to 127 and the White Input to 129. With 128 (or 50% grey on a 256 bit scale) between them.
    10
    This results in a mask that is now clipped to hard values of transparent or opaque, BUT because we haven't modified the actually Smart Objets transparency itself the image still has transparency in the opaque side.
    11
    This is where we hit the snag in NOT editing the Smart Objects transparency directly. You need a background color for the transparency in the Smart Object to mix against so that it's not transparent any more. You basically need to choose a white or black backing image that it masks onto. But you still need to use the new transparency you just created.
  6. With the layer mask still selected, repeat Step 1 and 2 and do a menu Select -> Load Selection..., but make sure you have chosen the Layer 0 Mask.
    12
  7. With this new selection go to menu Layer -> Group Layers
    13
    This results in the Smart Object with its layer mask being added into a group folder.
    14
  8. You now need to generate a mask layer for the group folder. The selection you made in Step 6 should still be active so you can create the groups layer mask. This is the same as you did in Step 3.
    7
    This should result in your Smart Object inside a group folder with a mask of it's own.
    15
  9. Now we need to add in the solid White or Black backing that will act as the backing for the opaque area for the parts of the Smart Object that are still showing transparency. White the group folder selected go to the menu Layer -> New Fill Layer -> Solid Color...
    16
  10. The New Layer dialog will appear, hit OK.
    17
  11. Choose White (you can choose black if you want) from the color picker.
    18
    This generates the new Solid Color layer. But it's most likely above your Smart Object.
  12. Move the Solid Color layer below the Smart Object while keeping it in the group folder.
    19
    This results in a Smart Object that is now masked to a specific transparency range that is either transparent or opaque, and that doesn't change the original Smart Object itself. 20

You are now done. If you recorded this as an action you can now repeat this with any Smart Object.

But here's the big rub, your Smart Object is being modified by the backing image that is white or black resulting in distinct opaque and transparent areas. If you were to do the levels call that modifies the mask within the smart object you would get a different image because you aren't using a backing image, rather you a modifying the original mask itself. Here's a comparison of the process I just outlines above vs editing the mask within the Smart Object itself. Notice that the color in the Smart Object masking is begin muted by the white background image, vs going into the Smart Object itself and modifying the mask itself.
21 VS. 22

There might be anther way to do this that I don't know about, but this is the best solution I've been able to come up with to solve your quandary.

ADDITION:
Here's the process I outlined above run with a similar image to your example image.
23

ADDITION:
Here's a link to download my Photoshop Smart Object Mask Mod Action if you want.

ADDITION:
This procedure will work for a classic Photoshop automation workflow, but probably won't work when using the newer Photoshop CC Generator feature.

  • It's nice of you to provide such a detailed answer, but if one is using manual steps then @AAGD's answer already does what I need without needing to blend against white. Also note that doing a threshold with "levels" leaves a few in-between pixels - better to use image > adjustments > threshold. – fenomas Feb 22 '16 at 2:00
  • @fenomas I was under the impression from your question you were looking for an alternative to Threshold. Give that you are OK with Threshold, then you could just replace Threshold in the Photoshop Action, and get the same result. The bigger point I was trying to make is that if you want to automate the process without editing inside the smart object you need the mask as AAGD stated. This was also an attempt to create a systematic batch executable action, so you wouldn't need to do anything manually. – kenjikato Feb 22 '16 at 7:57
  • All I'm looking for is a way to have Photoshop apply the effect automatically as the SO layer changes - i.e. the difference between manually performing an adjustment vs. making an adjustment layer so that the same adjustment gets applied dynamically. Are you saying there's a way to make a saved action get applied that way? If so I think that would sort me out. – fenomas Feb 22 '16 at 12:30
  • @fenomas because you're using the newer Photoshop Generator feature (which I didn't see in your original question when I wrote my answer) things get complicated. The only way I believe you can achieve what you want, with the Generator feature is to write the code to create your own Generator plugin. Generators are their own special case in Photoshop, and while cool, mean that some of the classic automation techniques are harder to take advantage of. I'd suggest reading up on scripting a Generator plugin (for example tomkrcha.com/?p=3896), and adding that to the question title. – kenjikato Feb 23 '16 at 10:55
  • I will also add that you can run the Action I created on a Smart Object when you open the master Photoshop file that contains the Smart Objects. Photoshop lets you trigger Actions automatically at the opening, closing or saving of a file. – kenjikato Feb 23 '16 at 11:09
0

Select your layer. Now Goto select > Color Range > Midtones or you can play with its other options

enter image description here

  • 1
    I don't know how this is meant to help. It manually creates a selection based on colors (not transparency). – fenomas Feb 19 '16 at 10:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.