Get Gmail to scale inline images to fit the browser window (in Chrome and Safari)

If you use Gmail on the web as your main email platform, and your work often involves people sending you emails with large high-resolution images (which ideally would be attachments, but are often embedded inline in the message), you know this problem. The images are frigging huge in the browser window, and the viewing panel ends up with a horizontal scrollbar, with paragraph text trailing off the screen. Having to scroll horizontally to read emails is really awkward and irritating! Why doesn’t Gmail at least offer an option to auto-scale inline images to fit the width of the window?

I discovered there’s a Chrome extension to fix this. If you’re a Chrome user, just download it and you’re done.

But I don’t use Chrome, I use Safari. And there doesn’t appear to be an equivalent Safari extension. I did, however, continue down the trail to the CSS file in the GitHub project for that Chrome extension. The CSS is quite simple:

[data-message-id] > div:nth-child(2) img:not([role=button]):not([role=menu]):not([width]) {
max-width: 100%;
width: auto !important;
height: auto !important;

That’s all it takes to get Gmail to shrink inline images in an email to fit the window. But how do you get Safari to apply that CSS? This is not so hard, either.

First, save the above CSS code into a file, maybe called gmail.css so you’ll remember what it’s for, and save it somewhere that makes sense to you, such as your Documents folder.

Next, open the Safari preferences, and click on the Advanced tab.

Click on the Style sheet dropdown and navigate to the gmail.css file you saved. That’s it! If you have a Gmail message containing a huge image open in Safari while you’re doing this, you should immediately notice the image pop down to a reasonable size. Huzzah!

So cool, and yet so… not. has a big announcement for us today: its new product, the Kindle. I want to like this thing, mainly because it’s the first major consumer product (that I know of) to feature electronic paper. This is not just a high-resolution backlit LCD; it’s a completely new and revolutionary kind of display that apparently (I’ve never seen it in person) really does look like printed paper. But what’s printed on it can change, electronically. And it’s actually usable in the form of flexible sheets, albeit quite a bit thicker than regular paper.


One natural application of this technology is to combine it with that languishing gadget category, the e-book reader. You could even have a reader that has multiple pages (literally) of electronic paper. (Think about spreads spanning multiple pages.) Now we’re getting somewhere.

So then, why does the Kindle suck so much?

If I had to pin it on one flaw, it’s the overall form factor: so big; so much extra space on the sides and top of the display (for no apparent reason), the weird angles, etc.

It just looks… weird. And retro-futuristic (in a bad way) like something Atari would’ve prototyped in 1983. On top of that, it’s expensive ($400). This already disappointing picture is apparently even further sullied by the snare of DRM. But most of all, the Kindle lets me down on the coolest aspect of electronic paper (other than the fact that it exists at all): the flexibility. No “sheets.” No fold-out spreads. No bendy. I want bendy.

In the end, I’m reminded of early electric and hybrid cars: though I have no proof of this, I remain convinced that the auto makers deliberately made them goofy looking to discourage sales, ensuring that there would not be a market for them. The difference is, I can see in that case how someone (the oil companies) could stand to profit from forestalling innovation. I’m not sure what the model is where someone would strongly benefit from killing the e-book.

Of course, what it comes down to is that I just want my electronic paper. I want it everywhere. A coworker was telling me about how another potential use not far down the line (once costs drop) is to use electronic paper for multimedia business cards. Savoring that possibility, it just occurred to me that the day may not be that far off when the wonders of J.K. Rowlings’ chocolate frog cards will finally be available to us Muggles.

But not today.