What format is the image converted to when requested by the browser?

2

This is more of a curiosity, I gave a quick researched and did not find something that explained how it works.

In practice when we develop, we have some methods for requesting an image from the server and displaying it on the browser screen on the client. One way depending on the case may be good to use, which is to leave the image converted to base64, there are people who do not like it, I believe that in this way it is good to use small images, reducing the amount of files in the directories. The google images works that way, whats app emoticons web version also works like this.

<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"></img>

The other, more traditional way is to fill src with the path of the image location. And there arises the curiosity, what method used by the server to convert the image to send it to the client (browser / browser)? example:

<img src="img/imagem.png"></img>

    
asked by anonymous 02.04.2015 / 06:54

1 answer

2

No type of conversion occurs: the image is simply serialized into an array of bytes and this is sent in the body of the HTTP response.

    
29.04.2015 / 02:10