javascript - 如何制作目标宽度和高度大于 640 像素的高质量 PhoneGap 相机图像?
<p><p>我使用 Cordova 3.5.0 和最新版本的 <a href="https://github.com/apache/cordova-plugin-camera" rel="noreferrer noopener nofollow">Camera plugin</a> .我发现当我将 targetWidth 和 targetHeight 设置在 640 以上时,图像质量会下降。这是我使用的配置:</p>
<pre><code>navigator.camera.getPicture(onSuccess, onFail,
{ quality : 100,
destinationType : Camera.DestinationType.FILE_URI,
sourceType : Camera.PictureSourceType.CAMERA,
allowEdit : true,
encodingType: Camera.EncodingType.JPEG,
targetWidth: 640,
targetHeight: 640,
saveToPhotoAlbum: true
});
</code></pre>
<p>我用 phonegap 相机拍摄了几张照片,并比较了自动保存到相册的图像。</p>
<p> <a href="https://dl.dropboxusercontent.com/u/47067729/Foto%2020.11.14%2016%2015%2028%20640.jpg" rel="noreferrer noopener nofollow">Here is the result (targetWidth: 640, targetHeight: 640)</a> :</p>
<p> <img src="/image/BIXet.jpg" alt="enter image description here"/> </p>
<p> <a href="https://dl.dropboxusercontent.com/u/47067729/Foto%2020.11.14%2016%2017%2032%20800.jpg" rel="noreferrer noopener nofollow">Here is the result (targetWidth: 800, targetHeight: 800)</a> :</p>
<p> <img src="/image/RRFDd.jpg" alt="enter image description here"/> </p>
<p> <a href="https://dl.dropboxusercontent.com/u/47067729/Foto%2020.11.14%2016%2018%2045%201280.jpg" rel="noreferrer noopener nofollow">Here is the result (targetWidth: 1280, targetHeight: 1280)</a> :</p>
<p> <img src="/image/xK06g.jpg" alt="enter image description here"/> </p>
<p>当您单击链接并比较照片时,您会发现图像越大质量越差。 </p>
<p><strong>如何制作目标宽度和高度大于 640 像素的高质量 PhoneGap 相机图像?</strong></p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>尽量不要在相机选项中设置照片的高度和宽度,并在 Canvas 元素上操作最终图像。这样,您就可以自己处理最优质的图像。</p></p>
<p style="font-size: 20px;">关于javascript - 如何制作目标宽度和高度大于 640 像素的高质量 PhoneGap 相机图像?,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/27043534/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/27043534/
</a>
</p>
页:
[1]