Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fabricjs HTML5 Canvas: Why are images so poorly resized?

When I add a 775 x 775 image to a fabricjs canvas and resize it down to around 90 x 90, the image greatly loses its quality.

fabricjs canvas iamge

But if I add that same image as an <img/> and scale it down, it retains its quality.

html img

Why does the canvas image become so low quality? How can I make the canvas image retain it's original quality like the <img/> does?

like image 837
bab Avatar asked Nov 24 '13 18:11

bab


1 Answers

It should probably go for a comment, but unfortunately I am new here and I can't add comments. However, to me it looks like antialiasing issue. Canvas is just bunch of pixels - it's up to you whether you do some antialiasing or not. Browsers however do some antialiasing on picture scaling (see here Disable antialising when scaling images).

This question might be a duplicate of:

Html5 canvas drawImage: how to apply antialiasing

HTML5 Canvas and Anti-aliasing

Hope it helps.

like image 180
user3425836 Avatar answered Sep 22 '22 15:09

user3425836