GreyScale

From Avisynth wiki
(Difference between revisions)
Jump to: navigation, search
m (Rec601 vs PC.601)
m
 
(8 intermediate revisions by 3 users not shown)
Line 1: Line 1:
Converts the input clip to greyscale (no color), without changing the color [[Convert|format]].
+
<div {{BlueBox2|40|0|3px solid purple}} >
 +
{{AvsPlusFullname}}<br>
 +
Up-to-date documentation: [https://avisynthplus.readthedocs.io/en/latest/avisynthdoc/corefilters/greyscale.html https://avisynthplus.readthedocs.io]
 +
</div>
  
  
{{Template:FuncDef|Greyscale(clip ''clip'' [, string ''matrix''])}}
+
Converts the input clip to greyscale (no color), without changing the [[Convert|color format]].
 +
 
 +
UK (''Gr'''''e'''''yscale'') and US (''Gr'''''a'''''yscale'') spellings are both allowed.
 +
 
 +
 
 +
{{Func2Def
 +
|Greyscale(clip ''clip'' [, string ''matrix''])
 +
|Grayscale(clip ''clip'' [, string ''matrix''])
 +
}}
  
 
:{{Par2|matrix|string|"Rec601"}}
 
:{{Par2|matrix|string|"Rec601"}}
::Controls the colour coefficients used in RGB&rarr;greyscale conversion.   
+
::In RGB based formats, the conversion produces the luma using the coefficients given in the matrix parameter.   
::*"Rec601" : Use Rec.601 coefficients (actually [[Convert#Syntax_and_Parameters|"PC.601"]] since luma does not change)
+
::*"Rec601" : Use Rec.601 coefficients (and keeping luma range unchanged)
::*"Rec709" : Use Rec.709 coefficients (actually [[Convert#Syntax_and_Parameters|"PC.709"]] since luma does not change)  
+
::*"Rec709" : Use Rec.709 (HD) coefficients (and keeping luma range unchanged)
 +
::*"Rec2020" : Use Rec.2020 (UHD) coefficients (and keeping luma range unchanged) {{AvsPluscon}}
 
::*"AVERAGE" : Use averaged coefficients (''Y'' = (R + G + B) / 3)
 
::*"AVERAGE" : Use averaged coefficients (''Y'' = (R + G + B) / 3)
  
  
If {{FuncArg|clip}} is [[YUV]], the chroma channels are simply set to grey (128) – {{FuncArg|matrix}} is not used '''and must be empty'''.  
+
If {{FuncArg|clip}} is [[YUV]], the chroma channels are simply set to grey (128{{D}}) – {{FuncArg|matrix}} is not used '''and must not''' be specified otherwise an error will be thrown.
  
 
See [[Color conversions]] for an explanation of the coefficients. Broadly speaking though,  
 
See [[Color conversions]] for an explanation of the coefficients. Broadly speaking though,  
Line 17: Line 29:
 
:*using ''Average'', '''blue''' contributes more.
 
:*using ''Average'', '''blue''' contributes more.
  
In all cases, Luma range is not changed (0-255 in &rarr; 0-255 out; 16-235 in &rarr; 16-235 out)
+
In all cases, Luma range is not changed (0{{D}}-255{{D}} in &rarr; 0{{D}}-255{{D}} out; 16{{D}}-235{{D}} in &rarr; 16{{D}}-235{{D}} out)
  
 
[[Category:Internal filters]]
 
[[Category:Internal filters]]
 
[[Category:Levels_and_Chroma_filters]]
 
[[Category:Levels_and_Chroma_filters]]

Latest revision as of 06:31, 18 September 2022

AviSynth+
Up-to-date documentation: https://avisynthplus.readthedocs.io


Converts the input clip to greyscale (no color), without changing the color format.

UK (Greyscale) and US (Grayscale) spellings are both allowed.


Greyscale(clip clip [, string matrix])
Grayscale(clip clip [, string matrix])

string  matrix = "Rec601"
In RGB based formats, the conversion produces the luma using the coefficients given in the matrix parameter.
  • "Rec601" : Use Rec.601 coefficients (and keeping luma range unchanged)
  • "Rec709" : Use Rec.709 (HD) coefficients (and keeping luma range unchanged)
  • "Rec2020" : Use Rec.2020 (UHD) coefficients (and keeping luma range unchanged) AVS+
  • "AVERAGE" : Use averaged coefficients (Y = (R + G + B) / 3)


If clip is YUV, the chroma channels are simply set to grey (128d) – matrix is not used and must not be specified otherwise an error will be thrown.

See Color conversions for an explanation of the coefficients. Broadly speaking though,

  • using Rec709, green contributes more to the output, compared to the default Rec601;
  • using Average, blue contributes more.

In all cases, Luma range is not changed (0d-255d in → 0d-255d out; 16d-235d in → 16d-235d out)

Personal tools