如何降低文件输入图像的质量?

时间:2015-07-06 10:06:29

标签: javascript jquery html5 mobile

我正在使用此代码:

<form id="file-form" method="POST">
<input type="file" onchange="openFile(event)" 
 id="file-select" capture="camera">
<br>
<img id="output">
</form>

当从移动iOS调用时,我得到了这个:

enter image description here

如果我选择现有图像,通常大小约为200kb。但是,如果我拍摄一张新照片而不是选择现有照片,它总是大约1.50MB。

我得到像这样的图像文件

 var data = new FormData(); 
 var files = $("#file-select").get(0).files;
 data.append('imgfile', files[0]);

并使用ajax作为表单数据发送到ASP.NET Web api,后者将图像保存在azure blob存储容器中。

问题是,为了能够降低直接拍摄的图像的大小而不是从现有的库中选择,我能做什么/应该做什么?

任何帮助或输入高度赞赏,谢谢!

0 个答案:

没有答案