javascript – How to reduce the images received in the body of a Gmail message using a bookmarklet

Question:

Ask

How to reduce the images received in the body of a Gmail message using a bookmarklet ?

Context

The Gmail web interface does not automatically reduce embedded images in the message body when their size exceeds the width of the message's reading frame . This makes it difficult to read, as the text stretches across the width of the image and causes you to use the horizontal scrollbar to read each line.

In some cases opening the message in a new window fixes the problem, in others it doesn't.

Answer:

The following bookmarklet reduces the size of images in the body of an email message in the Gmail web interface:

javascript:(function(){ function zoomImage(image, amt) { if(image.initialHeight == null) { /* Evitar acumular el error de redondeo */ image.initialHeight=image.height; image.initialWidth=image.width; image.scalingFactor=1; } image.scalingFactor*=amt; image.width=image.scalingFactor*image.initialWidth; image.height=image.scalingFactor*image.initialHeight; } var i,L=document.images.length; for (i=0;i<L;++i) zoomImage(document.images[i], 2); if (!L) alert("Esta página no contiene imágenes."); })();

References

Scroll to Top