Difference between revisions of "Clamping"

From Photoshop
Jump to: navigation, search
(What is the use of clamping?)
(What is the problem with clamping?)
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
===What is clamping?===
+
==What is clamping?==
Consider the simple black and white image below:
+
{{Template:What Is Clamping}}
  
[[File:clamping_01.png | 250px]]
+
==What is the use of clamping?==
  
Let it represent the edge of a mask. Its [[Histogram]] will look like this (below):
+
===Clamping used to combine hard and soft masks===
 +
{{Template:Dilate Erode Combine}}
  
[[File:clamping_02.png | 250px]]
+
===Clamping used to shift the perimeter of a mask===
 +
Often a mask is fine but is too small / big by one or two pixels. A clamp / dilate / erode can be used to shift this shape. Be warned! it will also likely soften or destroy detail (see below)
  
A histogram is a graphical representation of data. PS's histogram charts the distribution of the light values of an image. The histogram above shows a spike at white, a spike at black and nothing in between. Now lets blur the image (below):
+
===Clamping used to de-noise a mask===
 +
A gentle clamp can be used to 'convert' grey noise into black or white. Keep an eye on your edges as you do this to ensure that they are not damaged in the process.  
  
[[File:clamping_03.png | 250px]]
+
==What is the problem with clamping?==
 
 
The histogram (below) shows that the blur has resulted in a full set of grey values.
 
 
 
[[File:clamping_04.png | 250px]]
 
 
 
As well as charting data, the histogram can also be used to move the data around. If the black and grey values are moved towards the right, everything from light grey to dark gray will be converted to black.
 
 
 
[[File:clamping_05.png | 250px]]
 
 
 
This will give us (below):
 
 
 
[[File:clamping_06.png | 250px]]
 
 
 
===What is the use of clamping?===
 
Clamping can be used to gently move the mask edge in ('''erode''') or out ('''dilate''') one or two pixels.
 
 
 
[[File:erode_01.png | 500px]]
 
 
 
Sometimes, if the mask is soft, then a blur isn't even necessary.
 
 
 
A use for a hard edged dilated or eroded mask is this:
 
 
 
;Problem:
 
:A hard mask is clean but its edges, especially on hair, are too hard.
 
:A soft mask has great edges but is noisy in the black and white ares.
 
 
 
;Solution:
 
:Combine the two!
 
 
 
;Procedure:
 
#Make two masks: a '''soft''' one (using a [[Color Range]]) and a '''hard''' one (using whatever you want).
 
#Duplicate the hard one and '''erode''' one by a few pixels and '''dilate''' the other.
 
#Copy the '''erode''' and paste it into '''soft'''. Then go to '''Edit / Fade''' and set the blend mode to '''Screen'''. This will render the black of the pasted '''erode''' invisible as it is the [[Blend Modes#Neutral colors | neutral color]] for the screen mode (edit Fade dialogue box below).
 
 
 
[[File:erode_02.png | 200px]]
 
 
 
#Copy the dilate and paste it into '''soft'''. Then go to '''Edit / Fade''' and set the blend mode to '''Multiply'''. This will render the white of the pasted erode mask invisible as it is the [[Blend Modes#Neutral colors | neutral color]] for the multiply mode.
 
 
 
The image below is a graphical representation of this process. The green area represents the '''hard''', interior '''eroded''' mask (applied via a screen blend), the red area represents the '''hard''', exterior '''dilated''' mask (applied via a multiply blend). Between the two the original edge of the '''soft''' mask can be seen. 
 
 
 
[[File:erode_04.png | 250px]]
 
 
 
===What is the problem with clamping?===
 
 
One problem with clamping is that it is so darn difficult to do in the interface hell that is Photoshop. Another problem is that, on its own, it can destroy detail such as fine hairs, corners, detail etc. The dilate in the image below on the right has resulted in softened corners.  
 
One problem with clamping is that it is so darn difficult to do in the interface hell that is Photoshop. Another problem is that, on its own, it can destroy detail such as fine hairs, corners, detail etc. The dilate in the image below on the right has resulted in softened corners.  
  
 
[[File:erode_03.png | 300px]]
 
[[File:erode_03.png | 300px]]

Latest revision as of 14:48, 19 January 2012

What is clamping?

Consider the simple black and white image below:

Clamping 01.png

Let it represent the edge of a mask. Its Histogram will look like this (below):

Clamping 02.png

A histogram is a graphical representation of data. PS's histogram charts the distribution of the light values of an image. The histogram above shows a spike at white, a spike at black and nothing in between. Now lets blur the image (below):

Clamping 03.png

The histogram (below) shows that the blur has resulted in a full set of grey values.

Clamping 04.png

As well as charting data, the histogram can also be used to move the data around. If the black and grey values are moved towards the right, everything from light grey to dark gray will be converted to black.

Clamping 05.png

This will give us (below):

Clamping 06.png

So... a clamp can move a simple black shape out or in.

What is the use of clamping?

Clamping used to combine hard and soft masks

Problem
A hard mask is clean but its edges, especially on hair, are too hard.
A soft mask has great edges but is noisy in the black and white ares.
Solution
Combine the two!

Erode 01.png

Procedure
  1. Make two masks: a soft one (using a Color Range) and a hard one (using whatever you want).
  2. Duplicate the hard one and erode one by a few pixels and dilate the other.
  3. Copy the erode and paste it into soft. Then go to Edit / Fade and set the blend mode to Screen. This will render the black of the pasted erode invisible as it is the neutral color for the screen mode (edit Fade dialogue box below).

Erode 02.png

  1. Copy the dilate and paste it into soft. Then go to Edit / Fade and set the blend mode to Multiply. This will render the white of the pasted erode mask invisible as it is the neutral color for the multiply mode.

The image below is a graphical representation of this process. The green area represents the hard, interior eroded mask (applied via a screen blend), the red area represents the hard, exterior dilated mask (applied via a multiply blend). Between the two the original edge of the soft mask can be seen.

Erode 04.png

Clamping used to shift the perimeter of a mask

Often a mask is fine but is too small / big by one or two pixels. A clamp / dilate / erode can be used to shift this shape. Be warned! it will also likely soften or destroy detail (see below)

Clamping used to de-noise a mask

A gentle clamp can be used to 'convert' grey noise into black or white. Keep an eye on your edges as you do this to ensure that they are not damaged in the process.

What is the problem with clamping?

One problem with clamping is that it is so darn difficult to do in the interface hell that is Photoshop. Another problem is that, on its own, it can destroy detail such as fine hairs, corners, detail etc. The dilate in the image below on the right has resulted in softened corners.

Erode 03.png