[whatwg] Bicubic filtering on context.drawImage

Tingan Ho tingan at p1.cn
Mon Dec 9 13:49:50 PST 2013


>
> I’m not sure why you have a bias towards bicubic filtering as there are
> many different scaling filters that can be used.


> Lanczos is better than bicubic in many (most?) cases.  Spline scaling
> can also do a good job, as can fractal interpolation.


That would be even better. At least if I can opt-in for the one I want. But
I think most developers also don't want to dive into this algorithms, so it
would be good to have default values that perform well. right now I don't
know exactly what all browser vendors are using, maybe bilinear? But it
result in very poor image quality.

I think it also breaks consistency that drawImage doesn't behave the same
way as you would scale up and down an ordinary HTML Image object.


On Mon, Dec 9, 2013 at 10:15 PM, Oliver Hunt <oliver at apple.com> wrote:

>
> On Dec 9, 2013, at 2:29 PM, Tingan Ho <tingan at p1.cn> wrote:
>
> >>
> >> Tingan, would it be acceptable for you to do the resampling in
> JavaScript?
> >
> >
> > First, writing it in Javascript is less performant. Since natively you
> can
> > have access to the GPU. Second, it is abstract a layer for JS developers,
> > since they don't need to care about bicubic resampling algoritmen. Third,
> > it kind of make sense if you set imageSmothingEnabled to true in the
> > context object, that all down-scaling should use bicubic resampling(I
> > haven't tried yet, but I think the scale use bicubic sampling).
>
> I’m not sure why you have a bias towards bicubic filtering as there are
> many different scaling filters that can be used.
>
> Lanczos is better than bicubic in many (most?) cases.  Spline scaling
> can also do a good job, as can fractal interpolation.
>
> There are even specific scaling systems like Sal which are designed for
> upscaling sprites, and do a better job at the specific task than anything
> else (IIRC this is frequently used by the various old console emulators)
>
> —Oliver
>
>


-- 
Sincerely,

Tingan Ho
tingan at p1.cn



More information about the whatwg mailing list