Here is a .png image (on the right), and the canvas element which I drew the image on (on the left). Can you notice the quality difference? Canvas renders the image with noticeable quality loss. What can we do?
I observed this result on Chrome and IE9. Others will probably do the same thing.
How I render the image is quite usual: In the script I create a new Image()
object, after it's loaded I call
context.drawImage(myimage, x, y);
EDIT:
This is the initial image i observed on the canvas:
And here's what the canvas renders after I wrote:
context.drawImage(myimage,parseInt(x),parseInt(y));
What can I say, great answer man. Sharpshooting at its best. The hat is off to you.
EDIT2:
I tried context.drawImage(myimage, parseInt(x) + 0.5, parseInt(y)+ 0.5);
, here's the result:
I think it's worse than the first one. I observed this on chrome, on IE9 it's somewhat same as bad.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…