Updated: Google Images does not use <canvas>
any more.
I noticed Google Images is using canvas to render images. <img>
is used as a fallback for browsers that does not support canvas.
<a class="rg_l" style="..." href="...">
<canvas
id="cvs_NcG8skPEDu7FWM:b"
style="display:block"
width="83"
height="113">
</canvas>
<img
class="rg_i"
id="NcG8skPEDu7FWM:b"
data-src="http://t0.gstatic.com/images?q=tbn:ANd9GcQCB5NEbEUQhtmFI098HLSkfmoHTBtUfERUNkNKrhgFbtFBxZXY9ejXn_pUGg"
height="113"
width="83"
style="width:83px;height:113px"
onload="google.isr.fillCanvas(this);google.stb.csi.onTbn(0, this)"
src="http://t0.gstatic.com/images?q=tbn:ANd9GcQCB5NEbEUQhtmFI098HLSkfmoHTBtUfERUNkNKrhgFbtFBxZXY9ejXn_pUGg">
</a>
What's the point of using <canvas>
rather than <img>
?
The Canvas Size command allows you to add space around an image, or to effectively crop an image. So, for example, let's assume you want to print a photo at 11-inches by 17-inches, but on a 13-inch by 19-inch sheet of paper. This doesn't actually require you to add canvas around the photo.
A drawing canvas is an object, a bounding box to contain graphics. Use it to provide a background or shading behind AutoShapes and images, group graphics, or to create a wider area for a text wrap. Because the drawing canvas is mostly obsolete, you have to turn it on in Word's options.
The drawImage() method draws an image, canvas, or video onto the canvas.
The function we use for drawing an image onto a canvas is the drawImage() function. This function draws an image, canvas, or video onto the canvas. It can also draw parts of an image, and/or increase/reduce the image size.
Maybe it gives them more control over the contents of an image.
You can analyze color range of an image, prevailing color, even its content (given smart algorithm).
You can also perform per-pixel modifications — change brightness, contrast, gamma, etc. (not sure why they would want to do this; perhaps for some future use).
You can also rotate an image (on browsers that support canvas but not CSS transformations; see, for example, this demo of my fabric.js).
Several mobile devices have a limit on the number of image resources on one page. For example, Mobile Safari stops loading images after ± 6.5 MB of images have been loaded.
As mentioned in another answer, by using <canvas>
instead of several <img>
elements with external files as their src
, Google can load all the images in one request (which is obviously better for performance) — but it also works around this limitation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With