Which algorithm does webp's advanced decoding api use for rescaling?

86 views
Skip to first unread message

Jan Niklas Hasse

unread,
Jul 12, 2012, 7:05:52 PM7/12/12
to webp-d...@webmproject.org
I am currently using ImageMagick with Lanczos resampling (http://en.wikipedia.org/wiki/Lanczos_resampling) to scale my images. Which algorithm is libwebp using for rescaling?

Descriped here:

Thanks :)

Pascal Massimino

unread,
Jul 13, 2012, 12:14:31 AM7/13/12
to webp-d...@webmproject.org
Hi Jan,

On Thu, Jul 12, 2012 at 4:05 PM, Jan Niklas Hasse <jha...@gmail.com> wrote:
I am currently using ImageMagick with Lanczos resampling (http://en.wikipedia.org/wiki/Lanczos_resampling) to scale my images. Which algorithm is libwebp using for rescaling?

the algorithm used is based on summed area (i.e.: box-filtering). It is geared toward large _shrinking_
ratio. It will work for upsampling too, but that really not recommended. The primary use-case for
this built-in rescaling capability is when you have a very large image to display on a small screen
(phone?), or as a thumbnail.

(Lanczos is indeed a good choice if the rescaling ratio is close to 1.0: it preserves the crispness
better).

Note that since this rescaling is tightly integrated into the decoding pipeline, memory (and CPU, somehow)
consumption is proportional to the output resolution, not the input's. Basically, to downscale a large
panorama into a small thumbnail, you won't have to use gigs of memory to store the  intermediate
non-rescaled image. The output is directly at thumbnail's resolution.

hope it helps,
skal

 

--
You received this message because you are subscribed to the Google Groups "WebP Discussion" group.
To view this discussion on the web visit https://groups.google.com/a/webmproject.org/d/msg/webp-discuss/-/a_huyVAcaXEJ.
To post to this group, send email to webp-d...@webmproject.org.
To unsubscribe from this group, send email to webp-discuss...@webmproject.org.
For more options, visit this group at http://groups.google.com/a/webmproject.org/group/webp-discuss/?hl=en.

Jan Niklas Hasse

unread,
Jul 15, 2012, 3:54:05 PM7/15/12
to webp-d...@webmproject.org
2012/7/13 Pascal Massimino <pascal.m...@gmail.com>:
> Hi Jan,
>
> On Thu, Jul 12, 2012 at 4:05 PM, Jan Niklas Hasse <jha...@gmail.com> wrote:
>>
>> I am currently using ImageMagick with Lanczos resampling
>> (http://en.wikipedia.org/wiki/Lanczos_resampling) to scale my images. Which
>> algorithm is libwebp using for rescaling?
>
>
> the algorithm used is based on summed area (i.e.: box-filtering). It is
> geared toward large _shrinking_
> ratio. It will work for upsampling too, but that really not recommended. The
> primary use-case for
> this built-in rescaling capability is when you have a very large image to
> display on a small screen
> (phone?), or as a thumbnail.
>
> (Lanczos is indeed a good choice if the rescaling ratio is close to 1.0: it
> preserves the crispness
> better).
>
> Note that since this rescaling is tightly integrated into the decoding
> pipeline, memory (and CPU, somehow)
> consumption is proportional to the output resolution, not the input's.
> Basically, to downscale a large
> panorama into a small thumbnail, you won't have to use gigs of memory to
> store the intermediate
> non-rescaled image. The output is directly at thumbnail's resolution.
>
> hope it helps,
> skal

that sounds pretty good! I'm doing shrinking only (e.g. 1080p to 720p).

I will try it as soon as I find some time to.

Thanks!

Allen Cheung

unread,
Dec 10, 2021, 10:37:55 PM12/10/21
to WebP Discussion, pascal.m...@gmail.com
Hi  skal,

I am studying image downsampling and found that webp has a better image quality than other algorithms (such as cubic, bilinear) when the rescaling ratio is high (in my case, the rescaling ratio == 8).
I debug the webp source code and locate the implementation of webp's decoding rescaling function in the file 'libwebp\src\dec\io_dec.c'. (Am I right?) But it is complicated to understand it.
So I search for the answer from google and found this email.

Could you explain in more detail about the summed area (i.e.: box-filtering) algorithm used in webp decoding?
Reply all
Reply to author
Forward
0 new messages