RGBAdjust

From Avisynth wiki
Revision as of 10:53, 28 February 2016 by Raffriff42 (Talk | contribs)

Jump to: navigation, search

RGBAdjust has many different methods of changing the color and luminance of your RGB clips. Gain, bias (offset) and gamma can be set independently on each channel. Also included are an analysis function and a dither option.

All settings for this filter are optional. ColorYUV works in a similar manner for YUV clips.

Contents

Syntax and Parameters

RGBAdjust(clip clip [,
     float r, float g, float b, float a,
     float rb, float gb, float bb, float ab,
     float rg, float gg, float bg, float ag,
     bool analyze, bool dither ] )

float  r = 1.0
float  g = 1.0
float  b = 1.0
Red, green and blue scaling factor. Range 0.0 to 255.0
For example, r=3.0 multiplies the red channel pixel values by 3.
float  a = 1.0
Alpha adjustment—the transparency information on a per-pixel basis.
An alpha value of zero represents full transparency, and a value of 1 represents a full opacity.
float  rb = 0.0
float  gb = 0.0
float  bb = 0.0
float  ab = 0.0
Bias adjustment—add a fixed positive or negative value to a channel's pixel values. For example,
rb=16 will add 16 to all red pixel values and
rb=-32 will subtract 32 from all red pixel values.
float  rg = 1.0
float  gg = 1.0
float  bg = 1.0
float  ag = 1.0
Gamma adjustment—an exponential gain factor. For example,
rg=1.2 will brighten the red pixel values and
gg=0.8 will darken the green pixel values.
bool  analyze = false
If true, RGBAdjust will print color channel statistics on the screen (see example below)
  • There are Maximum and Minimum values for all channels.
  • There is an Average and a Standard Deviation for all channels.
  • There is Loose Minimum and Loose Maximum which ignore the brightest and darkest 0.4% (1/256) pixels.
bool  dither = false
If true, ordered dithering is applied when doing the adjustment.

Notes

  • All arguments default—leaves the clip untouched:
RGBAdjust(1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1) 
  • Keep in mind ALL the channels are not scaled to accommodate changes to one—for that you should use Levels.
So doing something like:
RGBAdjust(2, 1, 1, 1) 
will get you a whole lot of clipped red. If you WANT a whole lot of clipped red, there ya go - but if you want MORE red without clipping you'd do
Levels(0, 1, 255, 0, 128).RGBAdjust(2, 1, 1, 1) 
This would scale all the levels (and average luminance) by half, then double the red. Or more compact
RGBAdjust(1.0, 0.5, 0.5, 1.0)
This leaves the red and halves the green and blue.
  • To invert the alpha channel
RGBAdjust(a=-1.0, ab=255)
Thus alpha pixels values become a=(255-a).


Examples

  • Demonstrating analyze output
FFmpegSource2("sintel.mp4")
ConvertToRGB32
BicubicResize(546, 272)
RGBAdjust(analyze=true)

RGBAdjust Ex1.jpg


Changes

v2.60 Added dither.
v2.56 Added offsets, gamma, analyze.
Personal tools