View Full Version : Near-Lossless Resizing
jay123210599
15th January 2025, 23:23
What software or tool do I use to resize 1920x1080 images to any lower resolution with the same aspect ratio (e.g. 640x360, 800x450, 960x540, 1024x576) and back where I'll lose the least amount of information and more closely resembles the input images?
GeoffreyA
16th January 2025, 00:16
For ordinary film or animated material, scaling down and then up will cause a great deal of loss.
Most video-processing tools possess the ability to resize video, and often, different resizing kernels can be used. Ordinarily, Spline36 or Lanczos are sound choices, and Bicubic is often the default. These, especially the first two, yield better results than Bilinear or Point. There are other, more obscure kernels and neural-network ones that try to reconstruct the picture when scaling up.
For your problem, try Spline36 for a start and see how that looks. Still, if quality is important, it would be best to avoid such back-and-forth scaling altogether.
(However, if I may take a leap and guess, you are talking about descaling anime. Am I right? This is a different, more involved process but can give better results if the material calls for it.)
jay123210599
16th January 2025, 01:54
For ordinary film or animated material, scaling down and then up will cause a great deal of loss.
Most video-processing tools possess the ability to resize video, and often, different resizing kernels can be used. Ordinarily, Spline36 or Lanczos are sound choices, and Bicubic is often the default. These, especially the first two, yield better results than Bilinear or Point. There are other, more obscure kernels and neural-network ones that try to reconstruct the picture when scaling up.
For your problem, try Spline36 for a start and see how that looks. Still, if quality is important, it would be best to avoid such back-and-forth scaling altogether.
(However, if I may take a leap and guess, you are talking about descaling anime. Am I right? This is a different, more involved process but can give better results if the material calls for it.)
I'm talking about resizing images, not videos.
poisondeathray
16th January 2025, 01:59
If the "images" were taken from typical video sources, you're typically going to lose a significant amount of quality - unless the source was low quality, very soft or blurry to begin with . eg. maybe your "source images" were upscaled to begin with and relatively blurry - then downscaling is actually a good thing
The higher the quality you start with, the more high frequency details you start with - the more quality you risk losing when downscaling using any method
GeoffreyA
16th January 2025, 08:22
I'm talking about resizing images, not videos.
All right. I didn't listen well enough. But the principle still holds. If it's only a few images, use GIMP to scale with Sinc/Lanczos. If it's many, you'll likely have to use a CLI tool, perhaps ImageMagick.
Z2697
16th January 2025, 09:14
Non-windowed Sinc is sin.
GeoffreyA
16th January 2025, 09:58
Non-windowed Sinc is sin.
I believe Lanczos is listed as Sinc/Lanczos in GIMP? Haven't verified by looking at the dialogue box.
huhn
16th January 2025, 12:12
using libplacebo in ffmpeg should be faster for this task you may even get access to ssim or at least bicubic 150.
GeoffreyA
16th January 2025, 17:05
Here's a hard-and-fast scaler comparison:
1080p to 360p to 1080p (https://slow.pics/s/xElVVHli).
1080p to 540p to 1080p (https://slow.pics/s/vy24fMrn).
set s=bilinear
ffmpeg -init_hw_device vulkan -i REF.png -vf libplacebo=w=-1:h=540:downscaler=%s%,libplacebo=w=-1:h=1080:upscaler=%s% %s%.png
huhn
16th January 2025, 18:24
ahh yes Libplacebo and it's default settings...
"ewa_jinc" is so bad bilinear wins... no deafult anti ringign also doesn't help at all.
you shouldn't use any of them like that.
bicubic 150 AR and SSIM are the usual downscaler of choice.
GeoffreyA
16th January 2025, 21:47
ahh yes Libplacebo and it's default settings...
"ewa_jinc" is so bad bilinear wins... no deafult anti ringign also doesn't help at all.
you shouldn't use any of them like that.
bicubic 150 AR and SSIM are the usual downscaler of choice.
I'm not sure whether libplacebo in FFmpeg exposes SSIM. Which kernel is that?
huhn
16th January 2025, 22:03
you can load shaders with it.
it's not a normal kernel it's a dedicated downscaler that is quite expensive and also quite customizable.
normal kernels are used in it but can also be changed if i remember correctly.
huhn
16th January 2025, 23:43
here a small test:
https://slow.pics/c/WyklwuXv
this is downscaled to 270p and upscaled with jinc3 AR.
what ever libplacebo is doing is well... not comparable.
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.