纯Javascript图像处理库(二进制形式,不通过DOM) [英] Pure Javascript image handling library (in binary form, not through DOM)
问题描述
找到这样的库,我已经找到了一个方法来完成所描述的任务:
客户端图像调整大小并使用纯javascript进行上传。这很酷,不是吗?
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 technology like Flash or Silverlight. Except that I can't find any Javascript library that would be able to handle images in binary form. Is there any? Maybe there is some in Flashe's ECMA script that could be adapted, but I simply can't find anything.
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?
这篇关于纯Javascript图像处理库(二进制形式,不通过DOM)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!