As a website/app developer or owner, you’ve undoubtedly experienced your fair share of glitches and mishaps when it comes to users or site visitors sharing your content. Many outlets such as news and media sites, social networks, or eCommerce sites include the option to "like" or "share" content such as blog posts or images. Once shared, the social network site displays a snippet of the shared content alongside a featured image. This way, your site content gets maximum exposure in social networks and attracts additional visitors.
But, have you ever noticed that sometimes the content that you shared isn’t what you expected it to be, displaying the wrong featured image for a post, or if the correct image is displayed, its quality is subpar? Are you given credit for every image or piece of content that’s shared from your site? In this article, we list five ways to overcome these challenges and create a consistent user experience when sharing images on sites such as social networks.
While a text abstract is important, a piece of content’s featured image is even more so. Images on popular social networks like Facebook and LinkedIn play a bigger role nowadays and have more prominent placements within a post. Image quality and content is crucial to creating deeper user engagement, and ultimately, leads to more shares. Therefore, it’s even more important that the correct image is displayed in the appropriate high resolution for the best look and feel of the content.
There are a few ways to ensure that your image is shared in its optimal form. The first is by giving Facebook access to a version of the image with a high enough resolution within Facebook’s required aspect ratio for maximum quality. You may also want to be credited for the image so it doesn’t get lost in the sea of web images or re-branded by someone else. This can be done by adding a watermark of your logo or simply a text overlay. You may want to create a different snippet of an image specifically for sharing purposes. For example, you can display two pictures in a single image to show a comparison of people or products.
Cloudinary allows you to easily solve all of these issues by enabling you to upload a single high resolution image and then adjusting it to build your social network snippet. Here are five ways in which images can be optimized for sharing on social networks:
1. Choosing the correct high resolution image
Social networks usually guess which image to use as the cover according to resolution and page placement. This can be counteracted by adding a meta tag to your post, allowing you to decide which one is used. The meta tag for Facebook defines a property named og:image
in the header of your HTML page, other networks require the use of other property names, such as itemprop='image'
for Google+. In addition, social networks have specific requirements for images. In order to boost your engagement in Facebook, for example, you need to comply with specific restraints, such as minimum image size and aspect ratio. This is particularly important for images in Facebook Ads as well as images shown on mobile devices.
Let’s say an image on your eCommerce site is too small to fit the requirements laid out by Facebook. Usually you would need two separate images: one for your site and one to share. In addition, if you use a CMS that allows you to set a link to the image for your meta tag, you can simply fill it in with a URL for a high resolution image that is within Facebook’s required aspect ratio.
With Cloudinary's dynamic image transformation, you can use the same original high resolution image and programmatically adjust it to be used anywhere. The image on the page can be a small thumbnail while the image you want to share on Facebook (using the the meta property URL) can be a full-size, high resolution or custom resolution image:
For example, the following hi-res (2464x1640) image was uploaded with the leather_bag
ID.
In your web pages you might want to include a small thumbnail of the image. The example below generated a 300x220 thumbnail that can fit well in a web page.
Now you can add a meta tag to your HTML page telling Facebook to use a much larger image of 1200x900 pixels for example:
<meta content='https://res.cloudinary.com/demo/image/upload/w_1200,h_900,g_custom,c_thumb/leather_bag.jpg' property='og:image'>
2. Add a watermark or image overlay
If the content you created goes viral, you will probably want credit and not have it simply spread all over the internet without any connection to the original post. Making an image traceable back to you is simple, just add a watermark of your logo, create a new image and set the meta tag accordingly. With Cloudinary you can programmatically add your logo or any specific image as an overlay on top of the shared blog post’s featured image.
As you can see below, when shared on Facebook, the image has the Cloudinary logo as a watermark overlay. A previously uploaded image was dynamically added as an overlay while the color brightness was increased and the opacity was reduced to 25% to create a semi-transparent result:
(new ImageTag('leather_bag.jpg')) ->resize(Resize::thumbnail()->width(400)->height(300)->gravity(Gravity::focusOn(FocusOn::custom()))) ->overlay( Overlay::source(Source::image('cloudinary_icon') ->transformation((new ImageTransformation()) ->resize(Resize::scale()->width(0.5)->relative()) ->adjust(Adjust::opacity(25)) ->adjust(Adjust::brightness()->level(200)) )));
imageView.cldSetImage(cloudinary.createUrl().setTransformation(CLDTransformation() .setWidth(400).setHeight(300).setGravity("custom").setCrop("thumb").chain() .setOverlay("cloudinary_icon").setOpacity(25).setEffect("brightness:200").setWidth(0.5).setFlags("relative")).generate("leather_bag.jpg")!, cloudinary: cloudinary)
3. Personalized images with a stylized text caption
Text can also be added to create a recognizable image. You may wish to add your brand name, your site's name, the photographer, product name, or teaser text with a call to action such as "Sign up to receive updates". With Cloudinary, text can be added dynamically. Again, simply add an overlay and insert your desired text, specifying the font style and size. You may want to take a look at how-to use Cloudinary to create a watermark or text overlay on your image.
The following image shows one of the many ways text can dynamically added as an overlay to an image and transformed for best placement and recognition. The caption 'Leather laptop bag' using the Arial font was dynamically added as an overlay above a semi-transparent black bar.
cl_image_tag("leather_bag.jpg", :transformation=>[ {:width=>350, :height=>250, :gravity=>"custom", :crop=>"thumb"}, {:overlay=>"black_bar", :width=>1.0, :height=>0.1, :flags=>"relative", :gravity=>"south", :opacity=>50}, {:overlay=>{:font_family=>"Arial", :font_size=>16, :font_weight=>"bold", :text=>"Leather%20laptop%20bag"}, :color=>"white", :gravity=>"south", :y=>4} ])
cl_image_tag("leather_bag.jpg", array("transformation"=>array( array("width"=>350, "height"=>250, "gravity"=>"custom", "crop"=>"thumb"), array("overlay"=>"black_bar", "width"=>"1.0", "height"=>"0.1", "flags"=>"relative", "gravity"=>"south", "opacity"=>50), array("overlay"=>array("font_family"=>"Arial", "font_size"=>16, "font_weight"=>"bold", "text"=>"Leather%20laptop%20bag"), "color"=>"white", "gravity"=>"south", "y"=>4) )))
(new ImageTag('leather_bag.jpg')) ->resize(Resize::thumbnail()->width(350)->height(250)->gravity(Gravity::focusOn(FocusOn::custom()))) ->overlay( Overlay::source(Source::image('black_bar') ->transformation((new ImageTransformation()) ->resize(Resize::scale()->width(1.0)->height(0.1)->relative()) ->adjust(Adjust::opacity(50)))) ->position((new Position()) ->gravity(Gravity::compass(Compass::south())))) ->overlay( Overlay::source( Source::text('Leather laptop bag', (new TextStyle('Arial', 16)) ->fontWeight(FontWeight::bold())) ->textColor(Color::WHITE)) ->position((new Position()) ->gravity(Gravity::compass(Compass::south())) ->offsetY(4) ));
CloudinaryImage("leather_bag.jpg").image(transformation=[ {'width': 350, 'height': 250, 'gravity': "custom", 'crop': "thumb"}, {'overlay': "black_bar", 'width': "1.0", 'height': "0.1", 'flags': "relative", 'gravity': "south", 'opacity': 50}, {'overlay': {'font_family': "Arial", 'font_size': 16, 'font_weight': "bold", 'text': "Leather%20laptop%20bag"}, 'color': "white", 'gravity': "south", 'y': 4} ])
cloudinary.image("leather_bag.jpg", {transformation: [ {width: 350, height: 250, gravity: "custom", crop: "thumb"}, {overlay: "black_bar", width: "1.0", height: "0.1", flags: "relative", gravity: "south", opacity: 50}, {overlay: {font_family: "Arial", font_size: 16, font_weight: "bold", text: "Leather%20laptop%20bag"}, color: "white", gravity: "south", y: 4} ]})
cloudinary.url().transformation(new Transformation() .width(350).height(250).gravity("custom").crop("thumb").chain() .overlay(new Layer().publicId("black_bar")).width(1.0).height(0.1).flags("relative").gravity("south").opacity(50).chain() .overlay(new TextLayer().fontFamily("Arial").fontSize(16).fontWeight("bold").text("Leather%20laptop%20bag")).color("white").gravity("south").y(4)).imageTag("leather_bag.jpg");
cloudinary.imageTag('leather_bag.jpg', {transformation: [ {width: 350, height: 250, gravity: "custom", crop: "thumb"}, {overlay: new cloudinary.Layer().publicId("black_bar"), width: "1.0", height: "0.1", flags: "relative", gravity: "south", opacity: 50}, {overlay: new cloudinary.TextLayer().fontFamily("Arial").fontSize(16).fontWeight("bold").text("Leather%20laptop%20bag"), color: "white", gravity: "south", y: 4} ]}).toHtml();
$.cloudinary.image("leather_bag.jpg", {transformation: [ {width: 350, height: 250, gravity: "custom", crop: "thumb"}, {overlay: new cloudinary.Layer().publicId("black_bar"), width: "1.0", height: "0.1", flags: "relative", gravity: "south", opacity: 50}, {overlay: new cloudinary.TextLayer().fontFamily("Arial").fontSize(16).fontWeight("bold").text("Leather%20laptop%20bag"), color: "white", gravity: "south", y: 4} ]})
<Image publicId="leather_bag.jpg" > <Transformation width="350" height="250" gravity="custom" crop="thumb" /> <Transformation overlay="black_bar" width="1.0" height="0.1" flags="relative" gravity="south" opacity="50" /> <Transformation overlay={{fontFamily: "Arial", fontSize: 16, fontWeight: "bold", text: "Leather%20laptop%20bag"}} color="white" gravity="south" y="4" /> </Image>
<cld-image publicId="leather_bag.jpg" > <cld-transformation width="350" height="250" gravity="custom" crop="thumb" /> <cld-transformation :overlay="black_bar" width="1.0" height="0.1" flags="relative" gravity="south" opacity="50" /> <cld-transformation :overlay="{fontFamily: 'Arial', fontSize: 16, fontWeight: 'bold', text: 'Leather%20laptop%20bag'}" color="white" gravity="south" y="4" /> </cld-image>
<cl-image public-id="leather_bag.jpg" > <cl-transformation width="350" height="250" gravity="custom" crop="thumb"> </cl-transformation> <cl-transformation overlay="black_bar" width="1.0" height="0.1" flags="relative" gravity="south" opacity="50"> </cl-transformation> <cl-transformation overlay="text:Arial_16_bold:Leather%20laptop%20bag" color="white" gravity="south" y="4"> </cl-transformation> </cl-image>
cloudinary.Api.UrlImgUp.Transform(new Transformation() .Width(350).Height(250).Gravity("custom").Crop("thumb").Chain() .Overlay(new Layer().PublicId("black_bar")).Width(1.0).Height(0.1).Flags("relative").Gravity("south").Opacity(50).Chain() .Overlay(new TextLayer().FontFamily("Arial").FontSize(16).FontWeight("bold").Text("Leather%20laptop%20bag")).Color("white").Gravity("south").Y(4)).BuildImageTag("leather_bag.jpg")
MediaManager.get().url().transformation(new Transformation() .width(350).height(250).gravity("custom").crop("thumb").chain() .overlay(new Layer().publicId("black_bar")).width(1.0).height(0.1).flags("relative").gravity("south").opacity(50).chain() .overlay(new TextLayer().fontFamily("Arial").fontSize(16).fontWeight("bold").text("Leather%20laptop%20bag")).color("white").gravity("south").y(4)).generate("leather_bag.jpg");
imageView.cldSetImage(cloudinary.createUrl().setTransformation(CLDTransformation() .setWidth(350).setHeight(250).setGravity("custom").setCrop("thumb").chain() .setOverlay("black_bar").setWidth(1.0).setHeight(0.1).setFlags("relative").setGravity("south").setOpacity(50).chain() .setOverlay("text:Arial_16_bold:Leather%20laptop%20bag").setColor("white").setGravity("south").setY(4)).generate("leather_bag.jpg")!, cloudinary: cloudinary)
4. Multiple images
In some cases, you may want to combine multiple pictures into one in order to properly represent the content of your post. For example, letting people vote between two people or a blog post feature image that contains one image that represents the story and another to show the author. In this case, you’d want to share a collage of multiple images in Facebook. With Cloudinary’s overlay capability, you can place images next to each other (and even enhance the feeling of comparison or competition by adding a “___ vs ___” to the caption).
In addition, if you combine two pictures, the aspect ratio of the resulting image will generally change. In some cases, Facebook will arbitrarily cut images in order to have them fit into the snippet, meaning they won't look as desired, especially if the images are narrow or tall. But, you should cut or crop and combine them, which can be easily done with Cloudinary by resizing and cropping images, then placing one as an overlay, generating a single image that appears as desired on different devices.
Below you can see another image of a bag that was uploaded with the given leather_bag_gray
ID.
Now we can use Cloudinary's image overlays to dynamically generate an image of both bags that might be compared in a web page. The URL of the combined image should be specified using a meta HTML tag for optimal Facebook sharing.
(new ImageTag('leather_bag.jpg')) ->resize(Resize::thumbnail()->width(600)->height(700)->gravity(Gravity::focusOn(FocusOn::custom()))) ->overlay( Overlay::source(Source::image('leather_bag_gray') ->transformation((new ImageTransformation()) ->resize(Resize::fill()->width(600)->height(700)))) ->position((new Position()) ->gravity(Gravity::compass(Compass::west())) ->offsetX(600) ));
imageView.cldSetImage(cloudinary.createUrl().setTransformation(CLDTransformation() .setWidth(600).setHeight(700).setGravity("custom").setCrop("thumb").chain() .setOverlay("leather_bag_gray").setWidth(600).setHeight(700).setX(600).setGravity("west").setCrop("fill")).generate("leather_bag.jpg")!, cloudinary: cloudinary)
5. Enhance photos for better engagement
Users show more interest in good looking photos. By making photos more eye-catching with stronger, sharper colors and improved color balance, you can enhance user engagement that could possibly lead to conversion. With Cloudinary, you can increase color saturation by setting the effect
transformation parameter to saturation
with a specified saturation level (e.g., saturation:80
), automatically balance contrast and sharpen the photo.
See the difference below:
<cl-image public-id="leather_bag.jpg" > <cl-transformation gravity="custom" height="350" width="350" crop="thumb"> </cl-transformation> <cl-transformation effect="auto_contrast"> </cl-transformation> <cl-transformation effect="saturation:80"> </cl-transformation> <cl-transformation effect="sharpen"> </cl-transformation> </cl-image>
imageView.cldSetImage(cloudinary.createUrl().setTransformation(CLDTransformation() .setGravity("custom").setHeight(350).setWidth(350).setCrop("thumb").chain() .setEffect("auto_contrast").chain() .setEffect("saturation:80").chain() .setEffect("sharpen")).generate("leather_bag.jpg")!, cloudinary: cloudinary)
Summary
In some cases, it may be ideal to change visual results just for social network sharing without having to change your site’s graphic design. If the look and feel of your site is generally simple, basic, or neutral, you may want your image to stand out on Facebook, in turn earning you a greater level of engagement. In addition to the five use cases listed above, with Cloudinary, there are various transformations you can make to your site/product/post to increase its chances of success when shared on Facebook and other social networks.
As the modern day direction of social network sharing is heading more and more towards images being the focal point of shared content, the importance of making them relevant and attention grabbing is increasing. Making the necessary adjustments is vital to successful shares and conversions. With Cloudinary, you can dynamically transform and create images that match your content and are appealing to social network users, consequently heightening engagement.
All of the features discussed above are available in our free and paid plans. If you don't have a Cloudinary account yet, you are welcome to sign up for a free account and try it out today.
Further Reading on Image Optimization
- Website image optimization and fast delivery with Cloudinary
- The complete guide to PHP image compression and optimization
- Python Image Optimization and Transformation
- Image Optimization in Ruby
- Image Optimization for WordPress
- Learn about the pros and cons of JPEG 2000
- Adopting the WebP Image Format for Android on Websites Or Native Apps
- 10 Website Image Mistakes that Slow Load Times
- Automatically Reduce Image Size Without Losing Quality
- Automate Placeholder Generation and Accelerate Page Loads
- 3 Ways to Do Progressive JPEG Encoding