UU mt blend

From Avisynth wiki
(Difference between revisions)
Jump to: navigation, search
(in ur wikiz, postin ma scripz)
 
(small example image for each blend mode)
 
(5 intermediate revisions by one user not shown)
Line 10: Line 10:
  
 
''Blend'' (''[[Overlay]], [[Layer]]'') two clips using [[MaskTools2|MaskTools]]. Wide selection of blend modes.  
 
''Blend'' (''[[Overlay]], [[Layer]]'') two clips using [[MaskTools2|MaskTools]]. Wide selection of blend modes.  
[[YV12]] sources are supported, but the result may be unexpected. Use [[RGB]] sources for correct blending. Unlike [[Overlay]] and [[Layer]], there is no support for [[Mask|Masking]].
+
[[YV12]] sources are supported, but the result may be unexpected. Use [[RGB]] sources for correct blending. Unlike [[Overlay]] and [[Layer]], there is no support for [[Mask#Mask|Masking]].
  
  
Line 40: Line 40:
 
<br>
 
<br>
 
::{{Par2|mode|string|"blend"}}
 
::{{Par2|mode|string|"blend"}}
:::{| class="wikitable" style="max-width:48em!important"
+
<div style="max-width:56em;margin:0 0 0 4.5em" >
! Mode
+
{| class="wikitable" style="max-width:60em!important"
 +
! style="width:7em" | Mode
 +
! style="width:164px;margin:2px;padding:0" | Example
 
! Description
 
! Description
 
|-
 
|-
| blend
+
| colspan="3" style="text-align:left;" | &nbsp;'''''Normal Blending Modes'''''
| This is the default mode – ordinary transparent blending.
+
 
|-
 
|-
| absdiff
+
|style="vertical-align:top"| blend
| Absolute difference: identical pixels are black, non-identical pixels are brighter in proportion to the difference.
+
|style="vertical-align:top"|[[File:Layer-base-Lena.png]] [[File:Layer-over-grad.png]]
 +
 
 +
[[File:Uumtblend-example-blend.png]]
 +
|style="vertical-align:top"| This is the default mode – ordinary transparent blending.
 +
|-
 +
| colspan="3" style="text-align:left;"| &nbsp;'''''Darkening Modes'''''
 +
|-
 +
|style="vertical-align:top"| darken
 +
|style="vertical-align:top"|[[File:Uumtblend-example-darken.png]]
 +
|style="vertical-align:top"| Use overlay only if the overlay is darker than the base image.
 +
|-
 +
|style="vertical-align:top"| multiply
 +
|style="vertical-align:top"|[[File:Uumtblend-example-multiply.png]]
 +
|style="vertical-align:top"| Darkens the image in proportion to Overlay lightness.
 +
|-
 +
|style="vertical-align:top"| cburn
 +
|style="vertical-align:top"|[[File:Uumtblend-example-cburn.png]]
 +
|style="vertical-align:top"| aka ''color burn''. Darker than Multiply.
 +
|-
 +
|style="vertical-align:top"| lburn
 +
|style="vertical-align:top"|[[File:Uumtblend-example-lburn.png]]
 +
|style="vertical-align:top"| aka ''linear burn'' (darken)
 +
|-
 +
|style="vertical-align:top"| subtract
 +
|style="vertical-align:top"|[[File:Uumtblend-example-subtract.png]]
 +
|style="vertical-align:top"| aka ''[[Overlay]]'' mode="subtract"
 
|-
 
|-
| absdiff4
+
| colspan="3" style="text-align:left;"| &nbsp;'''''Lightening Modes'''''
| Absolute difference, exaggerated 400% to view small differences clearly.
+
 
|-
 
|-
| absdiff16
+
|style="vertical-align:top"| lighten
| Absolute difference, exaggerated 1600% to view small differences clearly.
+
|style="vertical-align:top"|[[File:Uumtblend-example-lighten.png]]
 +
|style="vertical-align:top"| Use overlay only if the overlay is lighter than the base image.
 
|-
 
|-
| cburn
+
|style="vertical-align:top"| screen
| aka ''color burn''. Darker than Multiply.
+
|style="vertical-align:top"|[[File:Uumtblend-example-screen.png]]
 +
|style="vertical-align:top"| Lightens more strongly.
 
|-
 
|-
| cdodge
+
|style="vertical-align:top"| cdodge
| aka ''color dodge''. Brighter than the Screen blend mode.
+
|style="vertical-align:top"|[[File:Uumtblend-example-cdodge.png]]
 +
|style="vertical-align:top"| aka ''color dodge''. Brighter than the Screen blend mode.
 
|-
 
|-
| darken
+
|style="vertical-align:top"| ldodge
| Use overlay only if the overlay is darker than the base image.  
+
|style="vertical-align:top"|[[File:Uumtblend-example-ldodge.png]]
 +
|style="vertical-align:top"| aka ''linear dodge'' or ''add'' (lighten)
 
|-
 
|-
| divide
+
|style="vertical-align:top"| divide
| Lightens the image in proportion to Overlay lightness.
+
|style="vertical-align:top"|[[File:Uumtblend-example-divide.png]]
 +
|style="vertical-align:top"| Lightens the image in inverse proportion to Overlay lightness.
 
|-
 
|-
| exclude
+
| colspan="3" style="text-align:left;"| &nbsp;'''''Contrast Modes'''''
| Blending with white inverts the base color values; blending with black produces no change.
+
 
|-
 
|-
| gextract
+
|style="vertical-align:top"| overlay
| aka Gimp [http://docs.gimp.org/2.8/en/gimp-concepts-layer-modes.html#idp14576368 ''GrainExtract''], ''[[Subtract]]'' (darken)
+
|style="vertical-align:top"|[[File:Uumtblend-example-overlay.png]]
 +
|style="vertical-align:top"| Uses a combination of the Screen blend mode on the lighter pixels, and the Multiply blend mode on the darker pixels.
 
|-
 
|-
| gmerge
+
|style="vertical-align:top"| softlight
| aka Gimp [http://docs.gimp.org/2.8/en/gimp-concepts-layer-modes.html#idp15336896 ''Grain Merge''].  
+
|style="vertical-align:top"|[[File:Uumtblend-example-softlight.png]]
 +
|style="vertical-align:top"| Uses a combination of the Screen blend mode on the lighter pixels, and the Multiply blend mode on the darker pixels.
 
|-
 
|-
| hardlight
+
|style="vertical-align:top"| hardlight
| Uses a combination of the Linear Dodge blend mode on the lighter pixels, and the Linear Burn blend mode on the darker pixels.
+
|style="vertical-align:top"|[[File:Uumtblend-example-hardlight.png]]
 +
|style="vertical-align:top"| Uses a combination of the Linear Dodge blend mode on the lighter pixels, and the Linear Burn blend mode on the darker pixels.
 
|-
 
|-
| lburn
+
|style="vertical-align:top"| pinlight
| aka ''linear burn'' (darken)
+
|style="vertical-align:top"|[[File:Uumtblend-example-pinlight.png]]
 +
|style="vertical-align:top"| Uses a combination of the Lighten blend mode on the lighter pixels, and the Darken blend mode on the darker pixels.
 
|-
 
|-
| ldodge
+
|style="vertical-align:top"| vivid
| aka ''linear dodge'' or ''add'' (lighten)
+
|style="vertical-align:top"|[[File:Uumtblend-example-vivid.png]]
 +
|style="vertical-align:top"| aka ''vivid light''
 
|-
 
|-
| lighten
+
|style="vertical-align:top"| linear
| Use overlay only if the overlay is lighter than the base image.
+
|style="vertical-align:top"|[[File:Uumtblend-example-linear.png]]
 +
|style="vertical-align:top"| aka ''linear light''. Uses a combination of the Linear Dodge blend mode on the lighter pixels, and the Linear Burn blend mode on the darker pixels.
 
|-
 
|-
| linear
+
|style="vertical-align:top"| gextract
| aka ''linear light''. Uses a combination of the Linear Dodge blend mode on the lighter pixels, and the Linear Burn blend mode on the darker pixels.
+
|style="vertical-align:top"|[[File:Uumtblend-example-gextract.png]]
 +
|style="vertical-align:top"| aka Gimp [http://docs.gimp.org/2.8/en/gimp-concepts-layer-modes.html#idp14576368 ''GrainExtract''], ''[[Subtract]]'' (darken)
 
|-
 
|-
| multiply
+
|style="vertical-align:top"| gmerge
| Darkens the image in proportion to Overlay lightness.
+
|style="vertical-align:top"|[[File:Uumtblend-example-gmerge.png]]
 +
|style="vertical-align:top"| aka Gimp [http://docs.gimp.org/2.8/en/gimp-concepts-layer-modes.html#idp15336896 ''Grain Merge''].  
 
|-
 
|-
| overlay
+
| colspan="3" style="text-align:left;"| &nbsp;'''''Inversion Modes'''''
| Uses a combination of the Screen blend mode on the lighter pixels, and the Multiply blend mode on the darker pixels.
+
 
|-
 
|-
| pinlight
+
|style="vertical-align:top"| exclude
| Uses a combination of the Lighten blend mode on the lighter pixels, and the Darken blend mode on the darker pixels.
+
|style="vertical-align:top"|[[File:Uumtblend-example-exclude.png]]
 +
|style="vertical-align:top"| Blending with white inverts the base color values; blending with black produces no change.
 
|-
 
|-
| screen
+
| colspan="3" style="text-align:left';"| &nbsp;'''''Cancellation Modes'''''
| Lightens.
+
 
|-
 
|-
| softlight
+
|style="vertical-align:top"| absdiff
| Uses a combination of the Screen blend mode on the lighter pixels, and the Multiply blend mode on the darker pixels.
+
|style="vertical-align:top"|[[File:Uumtblend-example-absdiff.png]]
 +
|style="vertical-align:top"| Absolute difference: identical pixels are black, non-identical pixels are brighter in proportion to the difference.
 
|-
 
|-
| subtract
+
|style="vertical-align:top"| absdiff4
| aka ''[[Overlay]]'' mode="subtract"
+
|style="vertical-align:top"|[[File:Uumtblend-example-absdiff4.png]]
 +
|style="vertical-align:top"| Absolute difference, exaggerated 400% to view small differences clearly.
 
|-
 
|-
| vivid
+
|style="vertical-align:top"| absdiff16
| aka ''vivid light''
+
|style="vertical-align:top"|[[File:Uumtblend-example-absdiff16.png]]
|}
+
|style="vertical-align:top"| Absolute difference, exaggerated 1600% to view small differences clearly.
 +
|}</div>
 
<br>
 
<br>
 
::{{Par2|cmode|int|2}}
 
::{{Par2|cmode|int|2}}
::: identical to the [[MaskTools2|MaskTools]] ''cmode'' parameter:
+
::: identical to the [[MaskTools2#Common_parameters|MaskTools]] ''U'' and ''V'' parameters:
 
:::* -255..0 : all the pixels of the plane will be set to -x (-128 = gray)
 
:::* -255..0 : all the pixels of the plane will be set to -x (-128 = gray)
 
:::* 1 : the plane will not be processed. Content will be invalid.
 
:::* 1 : the plane will not be processed. Content will be invalid.

Latest revision as of 01:40, 30 August 2016

Abstract
Author raffriff42
Version 1.1
Download UU_mt_blend.avs
Category Layering
Requirements *YV12, RGB24, RGB32
License
Discussion Doom9

Blend (Overlay, Layer) two clips using MaskTools. Wide selection of blend modes. YV12 sources are supported, but the result may be unexpected. Use RGB sources for correct blending. Unlike Overlay and Layer, there is no support for Masking.


Contents


[edit] Requirements

  • AviSynth 2.6 or later
  • Supported color formats: YV12, RGB24, RGB32
  • Color format of the two clips must match.


[edit] Required Plugins


[edit] Syntax and Parameters

uu_mt_blend(clip C, clip D, float "opacity", string "mode", int "cmode", bool "showargs")


clip  C =
Base clip.


clip  D =
Overlay clip.


float  opacity = 1.0
identical to the Overlay opacity parameter:
0.0 = no effect; the base clip appears normally.
1.0 = maximum effect.


string  mode = "blend"
Mode Example Description
 Normal Blending Modes
blend Layer-base-Lena.png Layer-over-grad.png

Uumtblend-example-blend.png

This is the default mode – ordinary transparent blending.
 Darkening Modes
darken Uumtblend-example-darken.png Use overlay only if the overlay is darker than the base image.
multiply Uumtblend-example-multiply.png Darkens the image in proportion to Overlay lightness.
cburn Uumtblend-example-cburn.png aka color burn. Darker than Multiply.
lburn Uumtblend-example-lburn.png aka linear burn (darken)
subtract Uumtblend-example-subtract.png aka Overlay mode="subtract"
 Lightening Modes
lighten Uumtblend-example-lighten.png Use overlay only if the overlay is lighter than the base image.
screen Uumtblend-example-screen.png Lightens more strongly.
cdodge Uumtblend-example-cdodge.png aka color dodge. Brighter than the Screen blend mode.
ldodge Uumtblend-example-ldodge.png aka linear dodge or add (lighten)
divide Uumtblend-example-divide.png Lightens the image in inverse proportion to Overlay lightness.
 Contrast Modes
overlay Uumtblend-example-overlay.png Uses a combination of the Screen blend mode on the lighter pixels, and the Multiply blend mode on the darker pixels.
softlight Uumtblend-example-softlight.png Uses a combination of the Screen blend mode on the lighter pixels, and the Multiply blend mode on the darker pixels.
hardlight Uumtblend-example-hardlight.png Uses a combination of the Linear Dodge blend mode on the lighter pixels, and the Linear Burn blend mode on the darker pixels.
pinlight Uumtblend-example-pinlight.png Uses a combination of the Lighten blend mode on the lighter pixels, and the Darken blend mode on the darker pixels.
vivid Uumtblend-example-vivid.png aka vivid light
linear Uumtblend-example-linear.png aka linear light. Uses a combination of the Linear Dodge blend mode on the lighter pixels, and the Linear Burn blend mode on the darker pixels.
gextract Uumtblend-example-gextract.png aka Gimp GrainExtract, Subtract (darken)
gmerge Uumtblend-example-gmerge.png aka Gimp Grain Merge.
 Inversion Modes
exclude Uumtblend-example-exclude.png Blending with white inverts the base color values; blending with black produces no change.
 Cancellation Modes
absdiff Uumtblend-example-absdiff.png Absolute difference: identical pixels are black, non-identical pixels are brighter in proportion to the difference.
absdiff4 Uumtblend-example-absdiff4.png Absolute difference, exaggerated 400% to view small differences clearly.
absdiff16 Uumtblend-example-absdiff16.png Absolute difference, exaggerated 1600% to view small differences clearly.


int  cmode = 2
identical to the MaskTools U and V parameters:
  • -255..0 : all the pixels of the plane will be set to -x (-128 = gray)
  • 1 : the plane will not be processed. Content will be invalid.
  • 2 : the plane of the first input clip will be copied (the default)
  • 3 : the plane will be processed with the processing the filter is designed to do.
  • 4 : the plane of the second input clip will be copied.
(does not apply if sources are RGB)


bool  showargs = false
If true, shows the MaskTools expression being used. For Masktools geeks.


[edit] External Links

  1. Photoshop Blend Modes Explained by Robert Thomas
  2. GIMP Concepts: Layer Modes
  3. Doom9 thread with some examples.
Personal tools