Cloudinary Blog

How I Avoided My Blurry-Image-Induced Meltdown

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:
Copy to clipboard
cl_image_tag("imagecon_banner_2018_vq2qe9.jpg", :dpr=>2.0, :width=>600, :crop=>"scale")
PHP v1:
Copy to clipboard
cl_image_tag("imagecon_banner_2018_vq2qe9.jpg", array("dpr"=>"2.0", "width"=>600, "crop"=>"scale"))
PHP v2:
Copy to clipboard
(new ImageTag('imagecon_banner_2018_vq2qe9.jpg'))
  ->resize(Resize::scale()->width(600))
  ->delivery(Delivery::dpr(2.0));
Python:
Copy to clipboard
CloudinaryImage("imagecon_banner_2018_vq2qe9.jpg").image(dpr="2.0", width=600, crop="scale")
Node.js:
Copy to clipboard
cloudinary.image("imagecon_banner_2018_vq2qe9.jpg", {dpr: "2.0", width: 600, crop: "scale"})
Java:
Copy to clipboard
cloudinary.url().transformation(new Transformation().dpr(2.0).width(600).crop("scale")).imageTag("imagecon_banner_2018_vq2qe9.jpg");
JS:
Copy to clipboard
cloudinary.imageTag('imagecon_banner_2018_vq2qe9.jpg', {dpr: "2.0", width: 600, crop: "scale"}).toHtml();
jQuery:
Copy to clipboard
$.cloudinary.image("imagecon_banner_2018_vq2qe9.jpg", {dpr: "2.0", width: 600, crop: "scale"})
React:
Copy to clipboard
<Image publicId="imagecon_banner_2018_vq2qe9.jpg" >
  <Transformation dpr="2.0" width="600" crop="scale" />
</Image>
Vue.js:
Copy to clipboard
<cld-image publicId="imagecon_banner_2018_vq2qe9.jpg" >
  <cld-transformation dpr="2.0" width="600" crop="scale" />
</cld-image>
Angular:
Copy to clipboard
<cl-image public-id="imagecon_banner_2018_vq2qe9.jpg" >
  <cl-transformation dpr="2.0" width="600" crop="scale">
  </cl-transformation>
</cl-image>
.NET:
Copy to clipboard
cloudinary.Api.UrlImgUp.Transform(new Transformation().Dpr(2.0).Width(600).Crop("scale")).BuildImageTag("imagecon_banner_2018_vq2qe9.jpg")
Android:
Copy to clipboard
MediaManager.get().url().transformation(new Transformation().dpr(2.0).width(600).crop("scale")).generate("imagecon_banner_2018_vq2qe9.jpg");
iOS:
Copy to clipboard
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:

Copy to clipboard
https://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

Our $2B Valuation

By
Blackstone Growth Invests in Cloudinary

When we started our journey in 2012, we were looking to improve our lives as developers by making it easier for us to handle the arduous tasks of handling images and videos in our code. That initial line of developer code has evolved into a full suite of media experience solutions driven by a mission that gradually revealed itself over the course of the past 10 years: help companies unleash the full potential of their media to create the most engaging visual experiences.

Read more
Direct-to-Consumer E-Commerce Requires Compelling Visual Experiences

When brands like you adopt a direct–to-consumer (DTC) e-commerce approach with no involvement of retailers or marketplaces, you gain direct and timely insight into evolving shopping behaviors. Accordingly, you can accommodate shoppers’ preferences by continually adjusting your product offering and interspersing the shopping journey with moments of excitement and intrigue. Opportunities abound for you to cultivate engaging customer relationships.

Read more
Automatically Translating Videos for an International Audience

No matter your business focus—public service, B2B integration, recruitment—multimedia, in particular video, is remarkably effective in communicating with the audience. Before, making video accessible to diverse viewers involved tasks galore, such as eliciting the service of production studios to manually dub, transcribe, and add subtitles. Those operations were costly and slow, especially for globally destined content.

Read more
Cloudinary Helps Minted Manage Its Image-Generation Pipeline at Scale

Shoppers return time and again to Minted’s global online community of independent artists and designers because they know they can count on unique, statement-making products of the highest quality there. Concurrently, the visual imagery on Minted.com must do justice to the designs into which the creators have poured their hearts and souls. For Minted’s VP of Engineering David Lien, “Because we are a premium brand, we need to ensure that every single one of our product images matches the selected configuration exactly. For example, if you pick an 18x24 art print on blue canvas, we will show that exact combination on the hero images in the PDF.”

Read more
Highlights on ImageCon 2021 and a Preview of ImageCon 2022

New year, same trend! Visual media will continue to play a monumental role in driving online conversions. To keep up with visual-experience trends and best practices, Cloudinary holds an annual conference called ImageCon, a one-of-a-kind event that helps attendees create the most engaging visual experiences possible.

Read more