Pure Javascript image handling library (in binary form, not through DOM)

后端 未结 4 1309
Happy的楠姐
Happy的楠姐 2021-01-07 01:32

Since File API will enable access to the content of local files it is now possible to do image resize before upload (a fairly common task) without any additional te

4条回答
  •  别那么骄傲
    2021-01-07 02:24

    Although I haven't find such libs, I have found a way how to accomplish the described task:

    • Read image as Data URL
    • Load an image into a canvas tag and resize it
    • Encode canvas image data into some image format, for example JPG. Or use Canvas.toDataUrl() and then (optionaly) some base64 decoder.

    Client side image resizing and upload with pure javascript. That's cool, isn't it?

提交回复
热议问题