Do Polish optimizations work when embedding images inline in emails?

Hi

What is the support of Cloudflare Polish optimization for sharing images via email?
As attachment it won’t work since you actually upload a file to the email, but what about inline embedding? Eg. Gmail, Outlook

1 Like

Hi,

If the email makes an HTTP(S) request for the image URL, and the URL domain is proxied by Cloudflare with Polish enabled, it should work.

However, make sure the URL does not contain a cache-busting query string, as that could mean each email fetches the image anew from your origin, in which case Polish will be working but not available in the first visualization of the email.

Hi @mat58, my name is Luís and I’m with the Cloudflare Technical Support team.

What is the support of Cloudflare Polish optimization for sharing images via email?
As attachment it won’t work since you actually upload a file to the email, but what about inline embedding? Eg. Gmail, Outlook

Cloudflare’s Polish optimization doesn’t generally support optimizing images shared via email, as it focuses on web content. Inline embedding of images in email clients like Gmail and Outlook won’t benefit from Polish optimization since it’s designed primarily for website optimization.

Let us know if you have further concerns or questions.

1 Like

Hey, thanks for both answers.

For me the Polish documentation is hard to understand and not complete, that’s also why I also posted this topic. Sorry for the hard criticism :slight_smile:

There is this part about Lossy optimization:

The Lossy option attempts to strip most metadata and compresses images by approximately 15 percent. When uncompressed, some of the redundant information from the original image is lost. On average, using Lossy mode reduces file size by 48 percent.

So on the one hand there is 15% compression rate, and filesize is actually reduced on average by 48% because of this. That’s how I read this paragraph.

It goes on to say that for GIF and PNG it strips metadata and compresses, but for JPEG it doesn’t strip metadata, but still compresses.
For PNG, lossy compression is the same as lossless compression and so it reduces the filesize by 21%. This is less than the 48% filesize reduction on average, so I guess JPEG lossy compression works very well - I guess around 48% file size reduction or even more.

Please let me know if these interpretations by me are correct, thx :wink:

Now to my original question:

Polish does 3 things:

  1. Strip metadata
  2. Compress images (either lossy or lossless)
  3. Serve WebP if the PNG or JPEG original are larger than the WebP version

So my interpretation:

  1. For native email apps: 2 and 3 don’t seem possible to me, I doubt native email apps have the intelligence to request a PNG/JPG and handle the fact they receive a WebP in return.
  2. Point 1 does seem applicable to me. Polish will strip any metadata before delivering the image to the email app. Normally the email app doesn’t even notice this.
  3. And finally, if you view a browser version of your email app using a browser, I think it does allow to handle all points, since for the browser, it’s a website like any other with Polish.

Please let me know if this is correct! Thx! :slight_smile:

Hi,

Read this Cloudflare Blog post instead: A Very WebP New Year from Cloudflare

lol, do we have a little bit of bait and switch going on here? (Your original question never mentioned specific email apps that can’t handle WebP, WebP in particular, or even lossless vs lossy mode for that matter.)

In my understanding, if the image is requested over HTTP as opposed to being attached, Polish should work depending on the user agent. And the image would only be delivered as WebP if the user agent can handle it. From the linked blog post:

a new feature in Polish allows us to swap out an image for an equivalent image compressed using Google’s WebP format when the browser is capable of handling WebP

As for compression stats, the same blog post above has good info on average compression using different modes and WebP in its “By the Numbers” section.

Hi cbrandt

I did not mean to bait and switch, there was a link posted to the help documents and I checked them and it raised additional questions. The docs also say nothing about email support so they don’t seem relevant to this topic.

So right now the questions are:

  1. If Polish does anything for images referenced from emails.
  2. What the exact numbers are of file size reduction.

Point 2 is answered by your link to that blog post, thanks cbrandt! Great article.

Point 1, Based on your answer I did a web search and found which email apps can support the JPEG to WebP replacement: Can I email… webP image format

Would love to hear in more detail what Cloudflare means with “no general support”. Is it that it can work like you say cbrandt, but Cloudflare does not offer it as a feature with any guarantee? Cloudflare doesn’t market Polish to that audience. Or it tries to filter out email apps from receiving Polish optimizations?

Point 2 answered, point 1 I’m not sure.

Thanks a lot for the help so far.

1 Like

Cloudflare products in general are meant to speed up and protect websites. There are some email specific products, such as mail forwarding, but as far as speed optimization goes, products are meant for website protection and optimization. As @L.Cardoso has mentioned,

With that in mind, and knowing that some webmail clients may read email as if it were a webpage, you need to accept that, Polish or no Polish, Cloudflare won’t support email handling, while at the same time you can work things around by testing different clients to see whether how they fetch images would be compatible with a website way of doing the same.

If a given mail client does not add unique-per-email (marketing|user|ecommerce|etc) query strings, you may see the benefit of Polish for images that are requested by more than one user. This won’t be documented anywhere as it is NOT the purpose of Polish to work with email.