View Full Version : How do I blend pixels in a frame
lansing
10th February 2018, 22:01
I have a color palette and I want to blend the edge of every color with the one right next to it so that there's a smooth gradient in the transition. Is there any filter that can do this?
https://i.imgur.com/zgafQun.png
LoRd_MuldeR
10th February 2018, 23:28
Downscale to a width of 8, using point-resize (nearest neighbor), then upscale to a width of 800 again, using your preferred kernel?
https://i.imgur.com/tPBVuNW.png
lansing
11th February 2018, 00:33
Thanks it works for width of 8, but when I try to do it with 6 on a six color palette, it gives me an error "Resize error 3076: image shift or subwindow too great"
image = core.imwrif.Read(r'blend.png')
image = core.resize.Point(image, width=6, height=100)
blend_image = core.resize.Spline36(image, width=600, height=100)
Stephen R. Savage
11th February 2018, 00:36
The 6-tap Spline36 filter is too wide to be used on a 6-pixel image. Either use more colors or choose a narrower filter.
# Two-stage approach.
c = core.std.BlankClip(width=6, height=1)
c = core.resize.Spline16(c, width=12, height=1)
c = core.resize.Spline36(c, width=600, height=1)
# Narrow filter approach
c = core.std.BlankClip(width=6, height=1)
c = core.resize.Spline16(width=600, height=1)
Myrsloik
11th February 2018, 01:08
Try a horizontal BoxBlur with many passes?
lansing
11th February 2018, 02:24
The 6-tap Spline36 filter is too wide to be used on a 6-pixel image. Either use more colors or choose a narrower filter.
# Two-stage approach.
c = core.std.BlankClip(width=6, height=1)
c = core.resize.Spline16(c, width=12, height=1)
c = core.resize.Spline36(c, width=600, height=1)
# Narrow filter approach
c = core.std.BlankClip(width=6, height=1)
c = core.resize.Spline16(width=600, height=1)
My color palette is going to be a lot wider than 6, so there's no need for the spline16 as the intermediate step?
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.