Skip to content

Convolution resampling and other libraries #8

Open
@homm

Description

@homm

There is a comment in pillow.py:

starting with 2.7, Pillow uses a high-quality convolution-based resize for
BILINEAR ... the other systems in this benchmark are using affine + bilinear,
so this is rather unfair. Use NEAREST instead, it gets closest to what
everyone else is doing

I'm pretty sure that there are other libraries which do convolution resize. For example, ImageMagick and its successor GraphicsMagick. Maybe others.

Also, sips and libgd do supersampling resampling which quality is much closer to Bicubic convolution and complexity close to Bilinear convolution.

Using nearest neighbor only in Pillow unfair to other libraries. While resizing with 4-point bilinear interpolation (like in VIPS) is not suitable for scale factors < 0.5, for 0.9 (used in the test), it much closer (both quality and complexity) to Bilinear convolution rather than to nearest neighbor.

Rather than using nearest neighbor for all of this libraries, I believe it's better to use Bilinear for Pillow and add some note for VIPS, OpenCV and possibly others.

How to check

It's simple. Try to resize with scale factor 0.1. If a zoomed result will look like this, it's convolution or supersampling.

o pillow 3x

If it looks like this, it's 4-point bilinear.

o vips 3x

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions