Skip to content

Instantly share code, notes, and snippets.

@wiwaz
Last active November 18, 2023 04:31
Show Gist options
  • Save wiwaz/2e4c6b3cd2bf9143f21a0db4ae429465 to your computer and use it in GitHub Desktop.
Save wiwaz/2e4c6b3cd2bf9143f21a0db4ae429465 to your computer and use it in GitHub Desktop.
def clippedmask(clip, vertical=False, threshold: list = None, columns: list = None, rows: list = None):
expr = f"x {threshold[0]} <= x {threshold[1]} >= or "
if vertical:
positions = rows
direction = "Y"
else:
positions = columns
direction = "X"
for i in range(len(positions)):
expr += f"{direction} {positions[i]} = "
if i > 0:
expr += "or "
expr += "and 255 0 ?"
return clip.akarin.Expr(expr, format=vs.GRAY8)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment