HTML5 Pre-resize images before uploading

前端 未结 10 2513
野的像风
野的像风 2020-11-22 15:53

Here\'s a noodle scratcher.

Bearing in mind we have HTML5 local storage and xhr v2 and what not. I was wondering if anyone could find a work

10条回答
  •  感动是毒
    2020-11-22 16:15

    Resizing images in a canvas element is generally bad idea since it uses the cheapest box interpolation. The resulting image noticeable degrades in quality. I'd recommend using http://nodeca.github.io/pica/demo/ which can perform Lanczos transformation instead. The demo page above shows difference between canvas and Lanczos approaches.

    It also uses web workers for resizing images in parallel. There is also WEBGL implementation.

    There are some online image resizers that use pica for doing the job, like https://myimageresizer.com

提交回复
热议问题