MaskTools/Logic

From Avisynth wiki
Jump to: navigation, search


Logic (clip mask_clip1, clip mask_clip2[, string "mode"])

Plugin: MaskTools

This filter produces a new mask which is the result of a binary operation between two masks. The operation is chosen with the parameter mode.

  • mode="and"
Works only with binary masks (only pixels at 0 or 255). The output mask is the intersection of the two masks. It means that if both corresponding pixels are 255, the resulting pixel will be 255, else 0.
  • mode="or"
Works only with binary masks. The output mask is the union of the two masks. It means that if one of the corresponding pixels are 255, the resulting pixel will be 255, else 0.
  • mode="xor"
Works only with binary masks. The output mask is the difference between the two masks. It means that if one ( exclusively ) of the corresponding pixels are 255, the resulting pixel will be 255, else 0.
  • mode="andn"
Works only with binary masks. The output mask is the subtraction of the second mask from the first one. It means that if the pixel of the first mask is 255 and the second is 0, it will return 255, else 0.
  • mode="min"
Returns for each pixel the minimum value between the two pixels of the input masks. It amounts to mode="and", but for non binary masks.
  • mode="max"
Returns for each pixel the maximum value between the two pixels of the input masks. It amounts to mode="or", but for non binary masks.

Note: If a logical operator is used with a non binary mask, the results are unpredictable.

Default is mode="and".


Back to MaskTools.

Personal tools