[whatwg] Bicubic filtering on context.drawImage

Oliver Hunt oliver at apple.com
Mon Dec 9 13:15:00 PST 2013


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




More information about the whatwg mailing list