From 6cea27d3f2d48eb4e088f433ae7a3162dd9159de Mon Sep 17 00:00:00 2001 From: Sylvain Munaut Date: Thu, 2 Mar 2023 20:41:26 +0100 Subject: [PATCH] slides-alpha: Adapt some values based on resolution When I rendered some slides in 4k, some of the values/radius where not appropriate. So make those scale with the image resolution Signed-off-by: Sylvain Munaut --- slides-alpha.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/slides-alpha.py b/slides-alpha.py index 8527e39..458c36b 100755 --- a/slides-alpha.py +++ b/slides-alpha.py @@ -69,11 +69,13 @@ def slide_process_single(in_file, out_file, opts): y[-opts.bottom_border:, :] = np.zeros([opts.bottom_border, y.shape[1]], dtype=np.float32) # Expand outward - ye = scipy.signal.convolve2d(y, np.ones([5,5]), mode='same', boundary='fill', fillvalue=0) + r = np.max(y.shape) // 384 + ye = scipy.signal.convolve2d(y, np.ones([r,r]), mode='same', boundary='fill', fillvalue=0) ye = ye.clip(0.0, 1.0) - # Blue it - ye = scipy.ndimage.gaussian_filter(ye, 1.5, mode='nearest') + # Blur it + r = np.max(y.shape) / 1280 + ye = scipy.ndimage.gaussian_filter(ye, r, mode='nearest') # Recombine y = (y + ye).clip(0.0, 1.0)