#1727 ✓resolved

Feature request: specify width dimensions for inline images

Reported by Yogananda | April 4th, 2017 @ 11:46 AM

Hi there!

I'm looking for a way for inline images to appear at a reasonable size without my having to resize them by hand.

Looking through the MailMate release history, I see that there was a time when max-width for inline images was specified, but that this was removed at some point. I also see that there is a bluesky feature for allowing image resizing in the composer. As an (I think) easy-to-implement middle-ground step, would you be able to add an option that specifies a reasonable width for inline images? As it is the inline-image feature is almost useless to me, because most of the images I work with appear gargantuan in the rendered message.



Comments and changes to this ticket

  • Yogananda

    Yogananda April 22nd, 2017 @ 07:46 AM

    Hi Benny — any word on this?


  • benny

    benny April 23rd, 2017 @ 11:48 AM

    Again, sorry about the late response.

    What you really need is probably a way to easily make MailMate resize the image before attaching it (such that it also takes up less space). Otherwise sizing the image might be better left to the receiving email client.

    There are a few things which could be done with CSS styling. The default themes don't currently specify anything for images, but you can force MailMate to add something like this:

    defaults write com.freron.MailMate MmDefaultCSS -string 'img { max-width: 100%; }'

    That would make images resize if they are too big to be displayed (if the receiving email client respects the styling). The same could be used to force a specific maximum width. But it won't make the emails smaller.

    (I'll use the above myself to see if it has undesired side-effects. Maybe it should be the default or some kind of option.)

  • Yogananda

    Yogananda April 25th, 2017 @ 07:24 AM

    Great, Benny — thanks!

    I actually really do just want the image to have a max width of the size of the screen. I work in a team that mostly uses Gmail. We send relatively high-resolution pictures around from time to time, and it's nice for inline images to be scaled down in the message display but for the attachment to not be scaled down in resolution.

    I notice that although Gmail respects the CCS styling, MailMate doesn't seem to. Even after adding the MmDefaultCSS default above, images still render in full size in MailMate. I'm working around this by adding img { max-width: 100%; } to ~/Library/Application\ Support/MailMate/Resources/MmMessagesWebView/stylesheet.css, but why would MailMate not respect this?

    Thanks again!

  • Yogananda

    Yogananda April 25th, 2017 @ 07:49 AM

    Hi Benny,

    I noticed this in /Applications/MailMate.app/Contents/Resources/MmMessagesWebView/html_stylesheet.css:

    img {
    /*  max-width:100%; This does not work since it'll reduce images in non-explicitly sized containers to be zero-sized. */

    Removing the img section from this file makes MailMate respect the MmDefaultCCS default. The comment makes me worry a bit, but I'm not versed enough in HTML wonkery to understand its implications. Do you have any thoughts here?


  • benny

    benny April 25th, 2017 @ 07:59 AM

    I cannot remember the exact problem cases, but it only affects what you see in MailMate. That is, it's applied to all incoming HTML messages when they are displayed. The MmDefaultCSS setting affects what you send, but this only happens when HTML is needed for the message. But that would be the case when inlining an image -- it's strange if that doesn't work in MailMate itself. Do you see the max-width styling if you view the raw message using ⌥⌘U ?

  • Yogananda

    Yogananda April 25th, 2017 @ 08:50 AM

    Hi Benny — Yes, I do see the max-width styling in the raw message. You might have missed my previous message, but it looks like this behavior was caused by an empty img section in the default stylesheet /Applications/MailMate.app/Contents/Resources/MmMessagesWebView/html_stylesheet.css that ships with MailMate. Deleting that img section fixed the problem.


  • benny

    benny April 25th, 2017 @ 02:01 PM

    It sounds very strange that an empty img CSS section should affect anything. Are you sure? Maybe something else triggered it? Or you were looking at a different message?

  • Yogananda

    Yogananda April 25th, 2017 @ 07:41 PM

    Hmm you're right — I'm having trouble reproducing it now. Very strange.

    In any event, this is a great improvement — I would definitely recommend this way of specifying max-width as a default or an option somewhere.

    Thanks again!

  • benny

    benny April 29th, 2017 @ 02:49 PM

    • State changed from “new” to “resolved”

    Thanks for the update. I'll give it some thought.

  • Klay

    Klay April 24th, 2020 @ 01:07 PM

    Life Saver! Thank you.

    defaults write com.freron.MailMate MmDefaultCSS -string 'img { max-width: 100%; }'

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Mac OS X email client.

Shared Ticket Bins

People watching this ticket