Log in

View Full Version : core.resize does not resize alpha mask when applied to transparent image clips


SilSinn9801
2nd April 2023, 13:59
When I import a transparent PNG image with core.ffms2.Source(filepath,alpha=True) & then apply to it resize.Point (or any other core.resize function), only the base RGB components get resized; the alpha component does not get resized at all (std.PropToClip(clip, prop='_Alpha') returns a mask with same dimensions as the original file rather than same dimensions as the resized image clip.
Is there some way to get the alpha to resize to same dimensions as the original?

poisondeathray
2nd April 2023, 15:10
When I import a transparent PNG image with core.ffms2.Source(filepath,alpha=True) & then apply to it resize.Point (or any other core.resize function), only the base RGB components get resized; the alpha component does not get resized at all (std.PropToClip(clip, prop='_Alpha') returns a mask with same dimensions as the original file rather than same dimensions as the resized image clip.
Is there some way to get the alpha to resize to same dimensions as the original?

The alpha channel is handled separately. If you are applying some transform to the RGB components, you need to apply the same to alpha channel

eg

clip = core.ffms2.Source(r'PATH\img.png', alpha=True)
alpha = core.std.PropToClip(clip)

clip = core.resize.Point(clip, width=640, height=360)
alpha = core.resize.Point(alpha, width=640, height=360)

#output RGB + A
clip.set_output(alpha=alpha)