Cloudinary Blog
Simplifying the email image conundrum

My email banner looked hideous!

Recently, I was tasked with building an email invite to ImageCon, Cloudinary’s annual image and video management conference. This email was destined for the inboxes of almost our entire database, and as you can tell, it wasn’t going well.

After staring at the preview in disbelief in Marketo for a few seconds, I quickly cycled through the seven stages of grief. Actually, I got stuck on the first one - anger. I mean, just take a look at this monstrosity:

Simplifying the email image conundrum
Not pictured: me throwing things in a fit of rage.

It’s never a good sign when your images make you wonder if you’re long overdue for a trip to the optometrist. Considering this email was going to hundreds of thousands of developers - and we are known for our abilities to deliver optimized images - I needed to seriously improve the email graphics.

On the surface, replacing a banner on an email template should be simple. In Marketo, you should only have to find the URL of the image and replace it with one of equal size. It’s a straightforward swap… or at least it should be.

However, with the explosion in popularity of devices with high-resolution displays like the Galaxy Note 7 (ba-dum-tiss), things have gotten a little more complicated for marketers. Our images need to be optimized for the device on which our users engaging with content, while also loading quickly and efficiently.

Now what does all that have to do with my banner image?

Well, it turns out that, the 600x200 image I was using was being set to a Device Pixel Ratio DPR of 1. That basically means that you get fewer pixels in your image which, when viewed on a high-resolution display, comes out looking like hot garbage extremely blurry. This effect happens because high-resolution displays can fit more pixels in essentially the same amount of visual space.

It fortunately displayed just fine on lower-resolution devices, but that wasn’t much consolation knowing that many individuals receiving the message would be viewing it on high-resolution devices.

Ruby:
cl_image_tag("imagecon_banner_2018_vq2qe9.jpg", :dpr=>2.0, :width=>600, :crop=>"scale")
PHP:
cl_image_tag("imagecon_banner_2018_vq2qe9.jpg", array("dpr"=>2.0, "width"=>600, "crop"=>"scale"))
Python:
CloudinaryImage("imagecon_banner_2018_vq2qe9.jpg").image(dpr=2.0, width=600, crop="scale")
Node.js:
cloudinary.image("imagecon_banner_2018_vq2qe9.jpg", {dpr: "2.0", width: 600, crop: "scale"})
Java:
cloudinary.url().transformation(new Transformation().dpr(2.0).width(600).crop("scale")).imageTag("imagecon_banner_2018_vq2qe9.jpg");
JS:
cloudinary.imageTag('imagecon_banner_2018_vq2qe9.jpg', {dpr: "2.0", width: 600, crop: "scale"}).toHtml();
jQuery:
$.cloudinary.image("imagecon_banner_2018_vq2qe9.jpg", {dpr: "2.0", width: 600, crop: "scale"})
React:
<Image publicId="imagecon_banner_2018_vq2qe9.jpg" >
  <Transformation dpr="2.0" width="600" crop="scale" />
</Image>
Angular:
<cl-image public-id="imagecon_banner_2018_vq2qe9.jpg" >
  <cl-transformation dpr="2.0" width="600" crop="scale">
  </cl-transformation>
</cl-image>
.Net:
cloudinary.Api.UrlImgUp.Transform(new Transformation().Dpr(2.0).Width(600).Crop("scale")).BuildImageTag("imagecon_banner_2018_vq2qe9.jpg")
Android:
MediaManager.get().url().transformation(new Transformation().dpr(2.0).width(600).crop("scale")).generate("imagecon_banner_2018_vq2qe9.jpg");
iOS:
imageView.cldSetImage(cloudinary.createUrl().setTransformation(CLDTransformation().setDpr(2.0).setWidth(600).setCrop("scale")).generate("imagecon_banner_2018_vq2qe9.jpg")!, cloudinary: cloudinary)
ImageCon

So… much… better.

When you can automatically optimize your images for delivery based on the viewing device, that’s great. When you can do it all within the URL - without having to upload multiple images - that’s even better.

With a small addition of dpr_2.0 to the image URL in Cloudinary, I was able to sharpen the image almost instantly:

http://res.cloudinary.com/demo/image/upload/dpr_2.0,w_600/imagecon_banner_2018_vq2qe9.jpg

You are technically able to accomplish the exact same thing by simply doubling the image resolution. However, with this URL in hand, I can repurpose the exact same image and replicate it across any of our assets and site pages via a simple modification of the URL. This saves serious hassles for me, my design team and my developers a huge headache since I don’t have to bug them for multiple copies of the exact same image.

With that easy change to the URL, I now have a new image that I’m content to send out enhance the email I’m planning to send, as well as a replicable asset that I can modify with minuscule effort. Email is done, frustrations have subsided, a plan is in motion for additional ImageCon assets, and all is right in the world.

Life is so much easier when your images look good, isn’t it?

Recent Blog Posts

 New Image File Format: FUIF:Lossy, Lossless, and Free

I've been working to create a new image format, which I'm calling FUIF, or Free Universal Image Format. That’s a rather pretentious name, I know. But I couldn’t call it the Free Lossy Image Format (FLIF) because that acronym is not available any more (see below) and FUIF can do lossless, too, so it wouldn’t be accurate either.

Read more
Optimizing Video Streaming and Delivery: Q&A with Doug Sillars

Doug Sillars, a digital nomad and a freelance mobile-performance expert, answers questions about video streaming and delivery, website optimization, and more.

Doug Sillars, a freelance mobile-performance expert and developer advocate, is a Google Developer Expert and the author of O’Reilly’s High Performance Android Apps. Given his extensive travels across the globe—from the UK to Siberia—with his wife, kids, and 11-year-old dog, Max, he has been referred to as a “digital nomad.” So far in 2018, Doug has spoken at more than 75 meetups and conferences!

Read more
Building a Music Discovery Service

In May 2018, Cloudinary sponsored Capitol Music Group’s first hackathon held by its new Capitol360 Innovation Center, which aims at connecting musicians and software technologists to facilitate and stimulate the creation of music. See this interview for details. As a starter project for the hackathon, we built a sample app called Music Discovery Service.

Read more
Once a Hackathon Participant, Now a Judge

Over the past several years, I've had a chance to participate in hackathons, as part of teams that developed a social payment app and helped users decide meals to cook. But it wasn't until last month that I got to experience a hackathon from the other side, as a judge.

Read more
10 Website Videos Mistakes and How to Solve Them

It should come as no surprise that video use on the internet is exploding. You can see the dramatic growth of video on the average site in this SpeedCurve blog post.

With the growth in video comes greater bandwidth use, which is not only costly for your IT budget, but for your visitors as well. Beyond the expense, there is the user experience to consider. The heavier the page, the longer it will take to load, and the greater likelihood visitors will abandon your site. Page load speed is also an important factor in SEO ranking, so clearly video is something we need to take seriously and get right. Video is challenging, presenting terms still unfamiliar to developers - like codecs, bitrate and adaptive bitrate streaming. As a result, mistakes are being made in video implementation.

Read more
Android Data Saver: Optimizing Mobile Data Usage with Cloudinary

Over the life of a mobile device, the cost of a cellular data plan often exceeds that of the device itself. To optimize data usage and purge useless data on their mobile devices, users can enable Data Saver from Android 7.0 (API level 24). To do so, users toggle Data Saver in quick settings under the Notification shade or under Settings > Data usage. With Data Saver enabled, apps that aren't whitelisted cannot use cellular data in the background. They are also directed to consume less data while active.

Read more