Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Canvas vs. img - performance [closed]

I tried to find some relevant sources about this and found nothing.

So, my questions are quite simple. Is canvas faster than img? I will use object as in img (png, gif) or canvas.

  1. Object is used only once,
  2. multiple use of same object, for example icons at admin,
  3. multiple use of different objects, for example logos of companies.

I am interested in memory usage, performance in browser and in loading speed.

edit#1: canvas is drawn by js and it will be same as image in img tag.

like image 751
mihairu_cz Avatar asked Mar 21 '13 06:03

mihairu_cz


1 Answers

No, img is faster, easier to create and more accessible than using canvas. The img tag was designed to show an image so if that's all you need to do, use an img tag. Multiple uses shouldn't matter as the image will only be downloaded once.

If you need some animation or interactivity, that is the time to consider canvas.

like image 82
Daniel Imms Avatar answered Nov 07 '22 02:11

Daniel Imms