Log in

View Full Version : How can i add an image with alpha in Vapoursynth?


RGMOfficial
21st January 2024, 17:12
I'm trying to add an RGB with alpha image.

wm = core.lsmas.LWLibavSource(r"watermarkhd.png")

wm.set_output()

With only "wm" as output, it shows the image without alpha, as RGB48.
But with the "wm[1]" as output, trying to get the alpha (Gray), did not output an preview and showed this error.

Failed to evaluate the script:
Python exception: List index out of bounds

Traceback (most recent call last):
File "src\\cython\\vapoursynth.pyx", line 3124, in vapoursynth._vpy_evaluate
File "src\\cython\\vapoursynth.pyx", line 3125, in vapoursynth._vpy_evaluate
File "", line 28, in
File "src\\cython\\vapoursynth.pyx", line 2187, in vapoursynth.VideoNode.__getitem__
IndexError: List index out of bounds

poisondeathray
21st January 2024, 18:08
Use PropToClip
http://www.vapoursynth.com/doc/functions/video/proptoclip.html


wm = core.lsmas.LWLibavSource(r"watermarkhd.png")
alpha = core.std.PropToClip(wm)

# alpha.set_output() #view alpha
# wm[0].set_output() #view RGB or YUV channels of source (ie. not the alpha)
# wm[0].set_output(alpha=alpha) #output with alpha eg.. vspipe


To check if alpha is being set


vspipe --info script.vpy


It should say something like Alpha : Yes