Note that there are some explanatory texts on larger screens.

plurals
  1. POCordova iOS - CANVAS image resolution
    primarykey
    data
    text
    <p>I have an application where the users shoots or selects a picture and it gets displayed on a <strong>canvas</strong> (<strong>Cordova 3, iPhone4S</strong>) with Cordova Camera API.</p> <p>Now I am experiencing a problem with image sizes. iPhone Screenshots, Landscape Photos, Portrait Photos all have different resolutions and sizes. And often the image gets cut or stretched in my canvas.</p> <p>I tried it with image tag before. That worked well. But I am having problem with <strong>canvas</strong>.</p> <p>At the moment I have</p> <pre><code>var canvas = document.getElementById("myCanvas"); canvas.width = 640; canvas.height = 960; canvas.style.width = "100%"; canvas.style.height = "100%"; </code></pre> <p><strong>It works if I load a screenshot in the canvas</strong>, but if I load a photo in the canvas it gets cut.</p> <p>Here two photo examples (portrait and landscape) loaded from iPhone's photo library.</p> <h2>How it is:</h2> <p><img src="https://i.stack.imgur.com/JEvPem.jpg" alt="enter image description here"></p> <h2>How it should be:</h2> <p>(the one at the bottom)</p> <p><img src="https://i.stack.imgur.com/qozx2m.jpg" alt="enter image description here"></p> <h2>How it is:</h2> <p><img src="https://i.stack.imgur.com/nQXdTm.jpg" alt="enter image description here"></p> <h2>How it should be:</h2> <p><img src="https://i.stack.imgur.com/qrZiPm.jpg" alt="enter image description here"></p> <p><strong>Any Idea how to get the canvas to display the full image with every ing size/resolution?</strong></p> <p>Thank you.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload