{"id":21222,"date":"2014-04-01T14:37:57","date_gmt":"2014-04-01T14:37:57","guid":{"rendered":"http:\/\/png_optimization_saving_bandwidth_on_transparent_pngs_with_dynamic_underlay"},"modified":"2025-05-04T15:17:21","modified_gmt":"2025-05-04T22:17:21","slug":"png_optimization_saving_bandwidth_on_transparent_pngs_with_dynamic_underlay","status":"publish","type":"post","link":"https:\/\/cloudinary.com\/blog\/png_optimization_saving_bandwidth_on_transparent_pngs_with_dynamic_underlay","title":{"rendered":"PNG optimization &#8211; saving bandwidth on transparent PNGs with dynamic underlay"},"content":{"rendered":"<div>There are many ways to optimize PNG files, but one <a href=\"https:\/\/cloudinary.com\/features\/optimization_fast_delivery\" target=\"_blank\" rel=\"noopener\">optimization<\/a> which is commonly overlooked involves the PNG&#8217;s transparent background. If you\u2019ve chosen to use PNGs instead of a more compact format like JPG, mainly for the PNG&#8217;s support of a transparent background (alpha channel), read on and see how dynamic underlays can reduce your file size by as much as <strong>1:5<\/strong>.<\/div>\n<div><\/div>\n<div>Graphic designers of sites and apps sometimes wish to display clipped photos on top of a certain background. A common example is a news site that shows a head shot of the author, or a figure mentioned in the article. Typically, the images are <a href=\"https:\/\/cloudinary.com\/glossary\/clipping-path\">clipped<\/a> using photo editing software like Photoshop, and then they can then be placed above background colors, patterns and between text paragraphs.<\/div>\n<div><\/div>\n<div>The issue is that the image may be placed in different contexts, and in each context the background could have a different color. The need arises to give the image a transparent background, and this requires a file format that supports transparency (alpha channel). The format typically chosen is PNG, and this can increase file size substantially.<\/div>\n<div><\/div>\n<h3>How it&#8217;s usually done &#8211; image saved as transparent PNG<\/h3>\n<div>For example, the following photo of a person was taken. It was saved using the JPG format as expected.<\/div>\n<div><\/div>\n<div><a href=\"https:\/\/res.cloudinary.com\/demo\/image\/upload\/business_man.jpg\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" style=\"margin-left: auto; margin-right: auto;\" src=\"https:\/\/res.cloudinary.com\/demo\/image\/upload\/w_300\/business_man.jpg\" alt=\"Business man photo\" width=\"300\" height=\"199\" \/><\/a><\/div>\n<div><\/div>\n<div>Then a graphic designer manually edited and clipped the photo. In order to maintain transparency (alpha channel) of the clipped photo, the image is uploaded using the <strong>PNG<\/strong> format that supports transparency, in contrast to the <strong>JPG<\/strong> photo format.<\/div>\n<div><\/div>\n<div><a href=\"https:\/\/res.cloudinary.com\/demo\/image\/upload\/w_200,h_250,c_fill,g_face\/business_man_clipped.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" style=\"margin-left: auto; margin-right: auto;\" src=\"https:\/\/res.cloudinary.com\/demo\/image\/upload\/w_200,h_250,c_fill,g_face\/business_man_clipped.png\" alt=\"Transparent background PNG thumbnail\" width=\"200\" height=\"250\" \/><\/a><\/div>\n<div><\/div>\n<div>This allows the image to be placed on any background, however, the PNG format is not optimal for photos. The generated thumbnail weighs <strong>59.8KB<\/strong> &#8211; almost <span style=\"color: #bb0000;\"><strong>500%<\/strong><\/span> its weight as a 90%-quality <a href=\"https:\/\/cloudinary.com\/tools\/compress-jpg\">JPG<\/a>, which is <strong>12.4KB<\/strong>. That might be a huge waste of bandwidth and money. It also harms the browsing experience of users, who need to wait much longer for images to load.<\/div>\n<div><\/div>\n<h3>Now check this out &#8211; PNG optimization with dynamic background color<\/h3>\n<div>Here&#8217;s an idea to dramatically cut the image size &#8211; not use PNG at all. The graphic designer can save the file as <strong>JPG<\/strong> and apply the desired background color dynamically.<\/div>\n<div><\/div>\n<div>One way to do this is by uploading the cropped photo to Cloudinary, and adding the dynamic background on the fly. In case you&#8217;re new here, Cloudinary is a cloud-based system that can help you store, administrate, traansform and deliver your website\u2019s images. Image transformation\u00a0is performed dynamically using URLs or API calls you can easily generate within your code.<\/div>\n<div><\/div>\n<div>The first step is to deliver the image as a JPG with 90% quality. Note that Cloudinary can also crop the clipped photo to 200&#215;250, on-the-fly, based on the automatically detected face.<\/div>\n<div><\/div>\n<div><a href=\"https:\/\/res.cloudinary.com\/demo\/image\/upload\/w_200,h_250,c_fill,g_face\/business_man_clipped.jpg\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" style=\"margin-left: auto; margin-right: auto;\" src=\"https:\/\/res.cloudinary.com\/demo\/image\/upload\/w_200,h_250,c_fill,g_face\/business_man_clipped.jpg\" alt=\"White background JPG\" width=\"200\" height=\"250\" \/><\/a><\/div>\n<div><\/div>\n<div><\/div>\n<div>We&#8217;re now down to <strong>12.4KB<\/strong> for the file &#8211; almost <strong>1\/5<\/strong> of its weight when it was saved as PNG. But of course the graphic designer still has the same problem &#8211; now to place the image over a non-white background, as in the example below.<\/div>\n<div><\/div>\n<div style=\"background-color: #c11e31; padding: 5px; height: 260px;\"><a href=\"https:\/\/res.cloudinary.com\/demo\/image\/upload\/w_200,h_250,c_fill,g_face\/business_man_clipped.jpg\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" style=\"float: right;\" src=\"https:\/\/res.cloudinary.com\/demo\/image\/upload\/w_200,h_250,c_fill,g_face\/business_man_clipped.jpg\" alt=\"White background JPG on a red background\" width=\"200\" height=\"250\" \/><\/a><\/div>\n<div style=\"clear: both;\"><\/div>\n<div>In Cloudinary, one simple solution is to create a JPG thumbnail on the fly, which already has the background color you need for the thumbnail. While you can do this manually using photo editing software, you definitely don&#8217;t want to create many different versions for all possible background colors in your site and modify them when your graphic design changes.<\/div>\n<div><\/div>\n<div>The following example sets the &#8216;<span style=\"color: #bb0000;\"><strong>background<\/strong><\/span>&#8216; transformation parameter (or &#8216;<span style=\"color: #bb0000;\"><strong>b<\/strong><\/span>&#8216; for URLs) to an RGB color (#c11e31 red color in this case). The result is the same JPG image, which is dynamically generated with a red background that can now be placed nicely on top of the page&#8217;s red background.<\/div>\n<div><\/div>\n<div>The generated JPG image weighs just <strong>12.8KB<\/strong>, an optimization compared to the PNG option. The JPG image saves <span style=\"color: #bb0000;\"><strong>80%<\/strong><\/span> of bandwidth and improves page load time. In addition, you can dynamically modify the color parameter of the transformation\u00a0URL to any desired color of your site or app.<\/div>\n<div><\/div>\n<div><strong><a href=\"https:\/\/res.cloudinary.com\/demo\/image\/upload\/w_200,h_250,c_fill,g_face,b_rgb:c11e31\/business_man_clipped.jpg\" target=\"_blank\" rel=\"noopener\"><span style=\"color: #808080;\">https:\/\/res.cloudinary.com\/demo\/image\/upload\/<\/span><span style=\"color: #bb0000;\">w_200,h_250,c_fill,g_face,b_rgb:c11e31\/<\/span><span style=\"color: #333399;\">business_man_clipped.jpg<\/span><\/a><\/strong><\/div>\n<div><\/div>\n<div><\/div>\n<div><img loading=\"lazy\" decoding=\"async\" style=\"float: left;\" src=\"https:\/\/res.cloudinary.com\/demo\/image\/upload\/w_200,h_250,c_fill,g_face,b_rgb:c11e31\/business_man_clipped.jpg\" alt=\"Red background JPG\" width=\"200\" height=\"250\" \/><\/div>\n<div>\u00a0\u00a0<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/res.cloudinary.com\/demo\/image\/upload\/w_200,h_250,c_fill,g_face,b_rgb:22860b\/business_man_clipped.jpg\" alt=\"Green background JPG\" width=\"200\" height=\"250\" \/>\u00a0\u00a0<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/res.cloudinary.com\/demo\/image\/upload\/w_200,h_250,c_fill,g_face,b_rgb:1540bc\/business_man_clipped.jpg\" alt=\"Blue background JPG\" width=\"200\" height=\"250\" \/><\/div>\n<div><\/div>\n<div>Same image tag and URL generation in PHP:<\/div>\n<pre>&lt;?php echo cl_image_tag(\"business_man_clipped.jpg\",\n        array( \"width\" =&gt; 200, \"height\" =&gt; 250, \"crop\" =&gt; \"fill\",\n               \"gravity\" =&gt; \"face\", \"background\" =&gt; \"#c11e31\" )); ?&gt;\n<\/pre>\n<div>In addition, further filters and effects can be applied on the clipped photo. The example below dynamically increases the strength of the red channel, reduces opacity, reduces color saturation and reduces contrast.<\/div>\n<div><strong><a href=\"https:\/\/res.cloudinary.com\/demo\/image\/upload\/w_200,h_250,c_fill,g_face,e_red:100,o_40\/e_saturation:-100\/e_contrast:-50,b_rgb:c11e31\/business_man_clipped.jpg\" target=\"_blank\" rel=\"noopener\"><span style=\"color: #808080;\">https:\/\/res.cloudinary.com\/demo\/image\/upload\/<\/span><span style=\"color: #bb0000;\">w_200,h_250,c_fill,g_face,e_red:100,o_40\/e_saturation:-100\/e_contrast:-50,b_rgb:c11e31\/<\/span><span style=\"color: #333399;\">business_man_clipped.jpg<\/span><\/a><\/strong><\/div>\n<div><strong>\u00a0<\/strong><\/div>\n<div style=\"background-color: #c11e31; padding: 5px; height: 260px;\"><a href=\"https:\/\/res.cloudinary.com\/demo\/image\/upload\/w_200,h_250,c_fill,g_face,e_red:100,o_40\/e_saturation:-100\/e_contrast:-50,b_rgb:c11e31\/business_man_clipped.jpg\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" style=\"float: right;\" src=\"https:\/\/res.cloudinary.com\/demo\/image\/upload\/w_200,h_250,c_fill,g_face,e_red:100,o_40\/e_saturation:-100\/e_contrast:-50,b_rgb:c11e31\/business_man_clipped.jpg\" alt=\"Watermark with red background JPG\" width=\"200\" height=\"250\" \/><\/a><\/div>\n<div style=\"clear: both;\"><\/div>\n<div><\/div>\n<h3>A harder case &#8211; PNG optimization with image-based backgrounds<\/h3>\n<div>The examples above are useful for a solid background color. However, modern websites might have gradient backgrounds or image-based backgrounds. Cloudinary can assist in optimizing bandwidth usage and user experience in this case as well.<\/div>\n<div><\/div>\n<div>For example, the following <a href=\"https:\/\/cloudinary.com\/background-remover\">background image<\/a> was uploaded to Cloudinary with the public ID of &#8216;bn_bg_wide&#8217;.<\/div>\n<div><\/div>\n<div><a href=\"https:\/\/res.cloudinary.com\/demo\/image\/upload\/bn_bg_wide.jpg\" target=\"_blank\" rel=\"noopener\"><strong><span style=\"color: #808080;\">https:\/\/res.cloudinary.com\/demo\/image\/upload\/<\/span><span style=\"color: #333399;\">bn_bg_wide.jpg<\/span><\/strong><\/a><\/div>\n<div><\/div>\n<p><a href=\"https:\/\/res.cloudinary.com\/demo\/image\/upload\/bn_bg_wide.jpg\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/res.cloudinary.com\/demo\/image\/upload\/w_630\/bn_bg_wide.jpg\" alt=\"Blue background sample\" width=\"630\" height=\"234\" \/><\/a><\/p>\n<div><\/div>\n<div><\/div>\n<div>This image weighs <strong>18.4KB<\/strong>. Saving it as a transparent background <strong>PNG<\/strong> means an extra <strong>59KB<\/strong>, for a total weight as PNG of <strong>78.2KB<\/strong>. Optimizing the PNG using a JPG image with a solid background is not an option at all in this case. Again, you can manually create a JPG image with the clipped photo and the background image underneath, but this will not work when you have plenty of photos and different background images.<\/div>\n<div><\/div>\n<div>You can use <strong>Cloudinary&#8217;s dynamic image overlays and underlays<\/strong> to overcome this issue and optimize the PNG.<\/div>\n<div><\/div>\n<div>In the following example, Cloudinary dynamically adds the cropped photo of the person as an overlay, 20 pixels from the top right corner, while scaling down the clipped photo to a height of 220 pixels.<\/div>\n<div><\/div>\n<div><a href=\"https:\/\/res.cloudinary.com\/demo\/image\/upload\/l_business_man_clipped,h_220,c_fill,g_north_east,x_20,y_20\/bn_bg_wide.jpg\" target=\"_blank\" rel=\"noopener\"><strong><span style=\"color: #808080;\">https:\/\/res.cloudinary.com\/demo\/image\/upload\/<\/span><span style=\"color: #bb0000;\">l_business_man_clipped,h_220,c_fill,g_north_east,x_20,y_20\/<\/span><span style=\"color: #333399;\">bn_bg_wide.jpg<\/span><\/strong><\/a><\/div>\n<div><\/div>\n<div><a href=\"https:\/\/res.cloudinary.com\/demo\/image\/upload\/l_business_man_clipped,h_220,c_fill,g_north_east,x_20,y_20\/bn_bg_wide.jpg\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/res.cloudinary.com\/demo\/image\/upload\/l_business_man_clipped,h_220,c_fill,g_north_east,x_20,y_20\/w_630\/bn_bg_wide.jpg\" alt=\"Transparent background person on a blue image\" width=\"630\" height=\"234\" \/><\/a><\/div>\n<div><\/div>\n<div>The resulting image weighs <span style=\"color: #bb0000;\"><strong>24.8KB<\/strong><\/span>. This PNG optimization saved almost 70% of image size and bandwidth.<\/div>\n<div><\/div>\n<div>Building the same URL, this time in Node.js:<\/div>\n<pre>cloudinary.image(\"bn_bg_wide.jpg\",\n  { overlay: \"business_man_clipped\", height: 220, crop: \"fill\",\n    gravity: \"north_east\", x: 20, y: 20 })\n<\/pre>\n<div>Another option: instead of adding the clipped photo as an overlay, create a 200&#215;250 face detection based thumbnail of the clipped photo and add the blue background image as an underlay image.<\/div>\n<div><\/div>\n<div><a href=\"https:\/\/res.cloudinary.com\/demo\/image\/upload\/w_200,h_250,c_fill,g_face\/u_bn_bg_wide,w_1.0,h_1.0,fl_relative,c_crop,g_north_east\/business_man_clipped.jpg\" target=\"_blank\" rel=\"noopener\"><strong><span style=\"color: #808080;\">https:\/\/res.cloudinary.com\/demo\/image\/upload\/<\/span><span style=\"color: #bb0000;\">w_200,h_250,c_fill,g_face\/u_bn_bg_wide,w_1.0,h_1.0,fl_relative,c_crop,g_north_east\/<\/span><span style=\"color: #333399;\">business_man_clipped.jpg<\/span><\/strong><\/a><\/div>\n<div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" style=\"margin-left: auto; margin-right: auto;\" src=\"https:\/\/res.cloudinary.com\/demo\/image\/upload\/w_200,h_250,c_fill,g_face\/u_bn_bg_wide,w_1.0,h_1.0,fl_relative,c_crop,g_north_east\/business_man_clipped.jpg\" alt=\"Blue underlay image\" width=\"200\" height=\"250\" \/><\/p>\n<div><\/div>\n<div><\/div>\n<div>The generated JPG image image including the underlay, weighs just <span style=\"color: #bb0000;\"><strong>13.7KB<\/strong><\/span>.<\/div>\n<div><\/div>\n<div>Same example using Python (and Django):<\/div>\n<pre>cloudinary.CloudinaryImage(\"business_man_clipped.jpg\").image(\n  transformation = [\n    { \"width\": 200, \"height\": 250, \"crop\": 'fill', \"gravity\": \"face\" },\n    { \"underlay\": \"bn_bg_wide\", \"width\": 1.0, \"height\": 1.0,\n      \"flags\": 'relative', \"crop\": 'crop', \"gravity\": 'north_east' }] )\n<\/pre>\n<h3><\/h3>\n<h3>Using the WebP format &#8211; and delivering it only on supported browsers<\/h3>\n<div>Another simple option to optimize the PNG is to convert and deliver the clipped image using the <strong>WebP<\/strong> format. This modern format is optimized for photos and also supports transparent backgrounds.<\/div>\n<div><\/div>\n<div>The following 200&#215;250 thumbnail was automatically converted by Cloudinary to the WebP format with the high 90% quality. The resulting image weighs just <span style=\"color: #bb0000;\"><strong>10.5KB<\/strong><\/span>. This means saving <span style=\"color: #bb0000;\"><strong>82%<\/strong><\/span> of the size and bandwidth of the PNG image, while having an almost identical result.<\/div>\n<div><\/div>\n<div><strong><a href=\"https:\/\/res.cloudinary.com\/demo\/image\/upload\/w_200,h_250,c_fill,g_face,q_90\/business_man_clipped.webp\" target=\"_blank\" rel=\"noopener\"><span style=\"color: #808080;\">https:\/\/res.cloudinary.com\/demo\/image\/upload\/<\/span><span style=\"color: #bb0000;\">w_200,h_250,c_fill,g_face,q_90\/<\/span><span style=\"color: #333399;\">business_man_clipped.webp<\/span><\/a><\/strong><\/div>\n<div><strong>\u00a0<\/strong><\/div>\n<div style=\"background-color: #c11e31; padding: 5px; height: 260px;\"><img loading=\"lazy\" decoding=\"async\" style=\"float: right;\" src=\"https:\/\/res.cloudinary.com\/demo\/image\/upload\/w_200,h_250,c_fill,g_face,q_90\/business_man_clipped.webp\" alt=\"Red background WebP\" width=\"200\" height=\"250\" \/><\/div>\n<div style=\"clear: both;\">\n<div><\/div>\n<div><\/div>\n<div>The following Ruby on Rails command creates an image tag with the same transformation\u00a0and CDN delivery URL:<\/div>\n<pre>&lt;%= cl_image_tag(\"business_man_clipped.webp\", :width =&gt; 200, :height =&gt; 250, \n                 :crop =&gt; :fill, :gravity =&gt; :face, :quality =&gt; 90 %&gt;\n<\/pre>\n<div>The only issue with the WebP format is that most browsers don&#8217;t support it yet. Google Chrome and Android are the only major platforms that currently supports it. You can use Cloudinary&#8217;s smart URLs with the &#8216;<span style=\"color: #bb0000;\"><strong>f_auto<\/strong><\/span>&#8216; parameter which delivers using the WebP format to supported devices and using the PNG format to other devices.<\/div>\n<div><\/div>\n<div><a href=\"https:\/\/res.cloudinary.com\/demo\/image\/upload\/w_200,h_250,c_fill,g_face,q_90,f_auto\/business_man_clipped.png\" target=\"_blank\" rel=\"noopener\"><strong><span style=\"color: #808080;\">https:\/\/res.cloudinary.com\/demo\/image\/upload\/<\/span><span style=\"color: #bb0000;\">w_200,h_250,c_fill,g_face,q_90,f_auto\/<\/span><span style=\"color: #333399;\">business_man_clipped.png<\/span><\/strong><\/a><\/div>\n<div><\/div>\n<div>You can read more about selective WebP image delivery here: <a href=\"https:\/\/cloudinary.com\/blog\/transparent_webp_format_cdn_delivery_based_on_visitors_browsers\" target=\"_blank\" rel=\"noopener\">Transparent WebP format CDN delivery based on visitors&#8217; browsers<\/a>.<\/div>\n<div><\/div>\n<h3>Summary<\/h3>\n<div>One of our missions at Cloudinary is to [optimize](https:\/\/cloudinary.com\/documentation\/image_optimization) the performance of our customers&#8217; sites and apps, while improving their user experience and saving them money by reducing unnecessary bandwidth usage. Together with other cloud-based image transformation\u00a0capabilities, developers can perform complex image transformations\u00a0with optimized size and delivery, without spending precious time on achieving these tasks manually or building the automation themselves.<\/div>\n<div><\/div>\n<div>In this blog post we showed a use case in which we easily <strong>save about 80% of bandwidth<\/strong> with a simple PNG optimization, while delivering photos using Cloudinary&#8217;s cloud-based image management. These capabilities are available in our perpetual <strong><a href=\"https:\/\/cloudinary.com\/users\/register\/free\" target=\"_blank\" rel=\"noopener\">free plan<\/a><\/strong>. We invite you to sign up, <strong><a href=\"https:\/\/cloudinary.com\/users\/register\/free\" target=\"_blank\" rel=\"noopener\">try out the dynamic background<\/a><\/strong> and overlay features, give us some feedback and share your insights in the comments below.<\/div>\n<div><\/div>\n<\/div>\n<div>\n<p dir=\"ltr\" style=\"line-height: 1.38; margin-top: 0pt; margin-bottom: 0pt;\"><strong><span style=\"font-size: 11pt; font-family: Arial; background-color: transparent; vertical-align: baseline;\">Further Reading on Image Optimization<\/span><\/strong><\/p>\n<ul>\n<li><span style=\"font-size: 11pt; font-family: Arial; vertical-align: baseline;\"><a href=\"https:\/\/cloudinary.com\/blog\/image_optimization_for_websites_beautiful_pages_that_load_quickly\" target=\"_blank\" rel=\"noopener\">Website image optimization and fast delivery<\/a> with Cloudinary <\/span><\/li>\n<li><span style=\"font-size: 11pt; font-family: Arial; vertical-align: baseline;\">The complete guide to <a href=\"https:\/\/cloudinary.com\/blog\/image_optimization_in_php\" target=\"_blank\" rel=\"noopener\">PHP image compression and optimization<\/a><\/span><\/li>\n<li><a href=\"https:\/\/cloudinary.com\/blog\/image_optimization_in_python\" target=\"_blank\" rel=\"noopener\"><span style=\"font-size: 11pt; font-family: Arial; vertical-align: baseline;\">Python Image Optimization and Transformation<\/span><\/a><\/li>\n<li><a href=\"https:\/\/cloudinary.com\/blog\/image_optimization_in_ruby\" target=\"_blank\" rel=\"noopener\"><span style=\"font-size: 11pt; font-family: Arial; vertical-align: baseline;\">Image Optimization in Ruby<\/span><\/a><\/li>\n<li><a href=\"https:\/\/cloudinary.com\/blog\/image_optimization_in_wordpress\" target=\"_blank\" rel=\"noopener\"><span style=\"font-size: 11pt; font-family: Arial; vertical-align: baseline;\">Image Optimization for WordPress <\/span><\/a><\/li>\n<li><span style=\"font-size: 11pt; font-family: Arial; vertical-align: baseline;\">Learn about the <a href=\"https:\/\/cloudinary.com\/blog\/the_great_jpeg_2000_debate_analyzing_the_pros_and_cons_to_widespread_adoption\" target=\"_blank\" rel=\"noopener\">pros and cons of JPEG 2000 <\/a><\/span><\/li>\n<li><span style=\"font-size: 11pt; font-family: Arial; vertical-align: baseline;\">Adopting the <a href=\"https:\/\/cloudinary.com\/blog\/quick_guide_using_webp_on_your_website_or_native_apps\" target=\"_blank\" rel=\"noopener\">WebP Image Format for Android<\/a> on Websites Or Native Apps <\/span><\/li>\n<li><span style=\"font-size: 11pt; font-family: Arial; vertical-align: baseline;\">10 <a href=\"https:\/\/cloudinary.com\/blog\/top_10_mistakes_in_handling_website_images_and_how_to_solve_them\" target=\"_blank\" rel=\"noopener\">Website Image Mistakes<\/a> that Slow Load Times <\/span><\/li>\n<li><span style=\"font-size: 11pt; font-family: Arial; vertical-align: baseline;\">Automatically <a href=\"https:\/\/cloudinary.com\/blog\/adaptive_browser_based_image_format_delivery\" target=\"_blank\" rel=\"noopener\">Reduce Image Size<\/a> Without Losing Quality <\/span><\/li>\n<li><span style=\"font-size: 11pt; font-family: Arial; vertical-align: baseline;\">Automate <a href=\"https:\/\/cloudinary.com\/blog\/low_quality_image_placeholders_lqip_explained\" target=\"_blank\" rel=\"noopener\">Placeholder Generation<\/a> and Accelerate Page Loads<\/span><\/li>\n<li><span style=\"font-size: 11pt; font-family: Arial; vertical-align: baseline;\"><span style=\"font-family: Arial;\">3 Ways to Do <a href=\"https:\/\/cloudinary.com\/blog\/progressive_jpegs_and_green_martians\" target=\"_blank\" rel=\"noopener\">Progressive JPEG Encoding<\/a><\/span><\/span><\/li>\n<\/ul>\n<div><span style=\"font-size: 11pt; font-family: Arial; vertical-align: baseline;\">\u00a0<\/span><\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>There are many ways to optimize PNG files, but one optimization which is commonly overlooked involves the PNG&#8217;s transparent background. If you\u2019ve chosen to use PNGs instead of a more compact format like JPG, mainly for the PNG&#8217;s support of a transparent background (alpha channel), read on and see how dynamic underlays can reduce your [&hellip;]<\/p>\n","protected":false},"author":41,"featured_media":23378,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_cloudinary_featured_overwrite":false,"footnotes":""},"categories":[1],"tags":[91,165,214,227,229,257],"class_list":["post-21222","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized","tag-django","tag-image-transformation","tag-node","tag-performance-optimization","tag-php","tag-ruby-on-rails"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v25.6 (Yoast SEO v26.9) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>PNG Optimization with Dynamic Background Color<\/title>\n<meta name=\"description\" content=\"How to perform complex PNG optimization without spending time on manual tasks or building automation by using the Cloudinary\u2019s dynamic background feature\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/cloudinary.com\/blog\/png_optimization_saving_bandwidth_on_transparent_pngs_with_dynamic_underlay\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"PNG optimization - saving bandwidth on transparent PNGs with dynamic underlay\" \/>\n<meta property=\"og:description\" content=\"How to perform complex PNG optimization without spending time on manual tasks or building automation by using the Cloudinary\u2019s dynamic background feature\" \/>\n<meta property=\"og:url\" content=\"https:\/\/cloudinary.com\/blog\/png_optimization_saving_bandwidth_on_transparent_pngs_with_dynamic_underlay\" \/>\n<meta property=\"og:site_name\" content=\"Cloudinary Blog\" \/>\n<meta property=\"article:published_time\" content=\"2014-04-01T14:37:57+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-05-04T22:17:21+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/v1647045703\/46_PNG_optimization\/46_PNG_optimization-jpg?_i=AA\" \/>\n\t<meta property=\"og:image:width\" content=\"2000\" \/>\n\t<meta property=\"og:image:height\" content=\"1100\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"NewsArticle\",\"@id\":\"https:\/\/cloudinary.com\/blog\/png_optimization_saving_bandwidth_on_transparent_pngs_with_dynamic_underlay#article\",\"isPartOf\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/png_optimization_saving_bandwidth_on_transparent_pngs_with_dynamic_underlay\"},\"author\":{\"name\":\"\",\"@id\":\"\"},\"headline\":\"PNG optimization &#8211; saving bandwidth on transparent PNGs with dynamic underlay\",\"datePublished\":\"2014-04-01T14:37:57+00:00\",\"dateModified\":\"2025-05-04T22:17:21+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/png_optimization_saving_bandwidth_on_transparent_pngs_with_dynamic_underlay\"},\"wordCount\":1523,\"publisher\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/png_optimization_saving_bandwidth_on_transparent_pngs_with_dynamic_underlay#primaryimage\"},\"thumbnailUrl\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1647045703\/46_PNG_optimization\/46_PNG_optimization.jpg?_i=AA\",\"keywords\":[\"Django\",\"Image Transformation\",\"Node\",\"Performance Optimization\",\"PHP\",\"Ruby on Rails\"],\"inLanguage\":\"en-US\",\"copyrightYear\":\"2014\",\"copyrightHolder\":{\"@id\":\"https:\/\/cloudinary.com\/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/cloudinary.com\/blog\/png_optimization_saving_bandwidth_on_transparent_pngs_with_dynamic_underlay\",\"url\":\"https:\/\/cloudinary.com\/blog\/png_optimization_saving_bandwidth_on_transparent_pngs_with_dynamic_underlay\",\"name\":\"PNG Optimization with Dynamic Background Color\",\"isPartOf\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/png_optimization_saving_bandwidth_on_transparent_pngs_with_dynamic_underlay#primaryimage\"},\"image\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/png_optimization_saving_bandwidth_on_transparent_pngs_with_dynamic_underlay#primaryimage\"},\"thumbnailUrl\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1647045703\/46_PNG_optimization\/46_PNG_optimization.jpg?_i=AA\",\"datePublished\":\"2014-04-01T14:37:57+00:00\",\"dateModified\":\"2025-05-04T22:17:21+00:00\",\"description\":\"How to perform complex PNG optimization without spending time on manual tasks or building automation by using the Cloudinary\u2019s dynamic background feature\",\"breadcrumb\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/png_optimization_saving_bandwidth_on_transparent_pngs_with_dynamic_underlay#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/cloudinary.com\/blog\/png_optimization_saving_bandwidth_on_transparent_pngs_with_dynamic_underlay\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/cloudinary.com\/blog\/png_optimization_saving_bandwidth_on_transparent_pngs_with_dynamic_underlay#primaryimage\",\"url\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1647045703\/46_PNG_optimization\/46_PNG_optimization.jpg?_i=AA\",\"contentUrl\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1647045703\/46_PNG_optimization\/46_PNG_optimization.jpg?_i=AA\",\"width\":2000,\"height\":1100},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/cloudinary.com\/blog\/png_optimization_saving_bandwidth_on_transparent_pngs_with_dynamic_underlay#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/cloudinary.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"PNG optimization &#8211; saving bandwidth on transparent PNGs with dynamic underlay\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/cloudinary.com\/blog\/#website\",\"url\":\"https:\/\/cloudinary.com\/blog\/\",\"name\":\"Cloudinary Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/cloudinary.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/cloudinary.com\/blog\/#organization\",\"name\":\"Cloudinary Blog\",\"url\":\"https:\/\/cloudinary.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/cloudinary.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649718331\/Web_Assets\/blog\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877.png?_i=AA\",\"contentUrl\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649718331\/Web_Assets\/blog\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877.png?_i=AA\",\"width\":312,\"height\":60,\"caption\":\"Cloudinary Blog\"},\"image\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"PNG Optimization with Dynamic Background Color","description":"How to perform complex PNG optimization without spending time on manual tasks or building automation by using the Cloudinary\u2019s dynamic background feature","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/cloudinary.com\/blog\/png_optimization_saving_bandwidth_on_transparent_pngs_with_dynamic_underlay","og_locale":"en_US","og_type":"article","og_title":"PNG optimization - saving bandwidth on transparent PNGs with dynamic underlay","og_description":"How to perform complex PNG optimization without spending time on manual tasks or building automation by using the Cloudinary\u2019s dynamic background feature","og_url":"https:\/\/cloudinary.com\/blog\/png_optimization_saving_bandwidth_on_transparent_pngs_with_dynamic_underlay","og_site_name":"Cloudinary Blog","article_published_time":"2014-04-01T14:37:57+00:00","article_modified_time":"2025-05-04T22:17:21+00:00","og_image":[{"width":2000,"height":1100,"url":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/v1647045703\/46_PNG_optimization\/46_PNG_optimization-jpg?_i=AA","type":"image\/jpeg"}],"twitter_card":"summary_large_image","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"NewsArticle","@id":"https:\/\/cloudinary.com\/blog\/png_optimization_saving_bandwidth_on_transparent_pngs_with_dynamic_underlay#article","isPartOf":{"@id":"https:\/\/cloudinary.com\/blog\/png_optimization_saving_bandwidth_on_transparent_pngs_with_dynamic_underlay"},"author":{"name":"","@id":""},"headline":"PNG optimization &#8211; saving bandwidth on transparent PNGs with dynamic underlay","datePublished":"2014-04-01T14:37:57+00:00","dateModified":"2025-05-04T22:17:21+00:00","mainEntityOfPage":{"@id":"https:\/\/cloudinary.com\/blog\/png_optimization_saving_bandwidth_on_transparent_pngs_with_dynamic_underlay"},"wordCount":1523,"publisher":{"@id":"https:\/\/cloudinary.com\/blog\/#organization"},"image":{"@id":"https:\/\/cloudinary.com\/blog\/png_optimization_saving_bandwidth_on_transparent_pngs_with_dynamic_underlay#primaryimage"},"thumbnailUrl":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1647045703\/46_PNG_optimization\/46_PNG_optimization.jpg?_i=AA","keywords":["Django","Image Transformation","Node","Performance Optimization","PHP","Ruby on Rails"],"inLanguage":"en-US","copyrightYear":"2014","copyrightHolder":{"@id":"https:\/\/cloudinary.com\/#organization"}},{"@type":"WebPage","@id":"https:\/\/cloudinary.com\/blog\/png_optimization_saving_bandwidth_on_transparent_pngs_with_dynamic_underlay","url":"https:\/\/cloudinary.com\/blog\/png_optimization_saving_bandwidth_on_transparent_pngs_with_dynamic_underlay","name":"PNG Optimization with Dynamic Background Color","isPartOf":{"@id":"https:\/\/cloudinary.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/cloudinary.com\/blog\/png_optimization_saving_bandwidth_on_transparent_pngs_with_dynamic_underlay#primaryimage"},"image":{"@id":"https:\/\/cloudinary.com\/blog\/png_optimization_saving_bandwidth_on_transparent_pngs_with_dynamic_underlay#primaryimage"},"thumbnailUrl":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1647045703\/46_PNG_optimization\/46_PNG_optimization.jpg?_i=AA","datePublished":"2014-04-01T14:37:57+00:00","dateModified":"2025-05-04T22:17:21+00:00","description":"How to perform complex PNG optimization without spending time on manual tasks or building automation by using the Cloudinary\u2019s dynamic background feature","breadcrumb":{"@id":"https:\/\/cloudinary.com\/blog\/png_optimization_saving_bandwidth_on_transparent_pngs_with_dynamic_underlay#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/cloudinary.com\/blog\/png_optimization_saving_bandwidth_on_transparent_pngs_with_dynamic_underlay"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/cloudinary.com\/blog\/png_optimization_saving_bandwidth_on_transparent_pngs_with_dynamic_underlay#primaryimage","url":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1647045703\/46_PNG_optimization\/46_PNG_optimization.jpg?_i=AA","contentUrl":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1647045703\/46_PNG_optimization\/46_PNG_optimization.jpg?_i=AA","width":2000,"height":1100},{"@type":"BreadcrumbList","@id":"https:\/\/cloudinary.com\/blog\/png_optimization_saving_bandwidth_on_transparent_pngs_with_dynamic_underlay#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/cloudinary.com\/blog\/"},{"@type":"ListItem","position":2,"name":"PNG optimization &#8211; saving bandwidth on transparent PNGs with dynamic underlay"}]},{"@type":"WebSite","@id":"https:\/\/cloudinary.com\/blog\/#website","url":"https:\/\/cloudinary.com\/blog\/","name":"Cloudinary Blog","description":"","publisher":{"@id":"https:\/\/cloudinary.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/cloudinary.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/cloudinary.com\/blog\/#organization","name":"Cloudinary Blog","url":"https:\/\/cloudinary.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/cloudinary.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649718331\/Web_Assets\/blog\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877.png?_i=AA","contentUrl":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649718331\/Web_Assets\/blog\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877.png?_i=AA","width":312,"height":60,"caption":"Cloudinary Blog"},"image":{"@id":"https:\/\/cloudinary.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":""}]}},"jetpack_featured_media_url":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1647045703\/46_PNG_optimization\/46_PNG_optimization.jpg?_i=AA","_links":{"self":[{"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/posts\/21222","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/users\/41"}],"replies":[{"embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/comments?post=21222"}],"version-history":[{"count":7,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/posts\/21222\/revisions"}],"predecessor-version":[{"id":37579,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/posts\/21222\/revisions\/37579"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/media\/23378"}],"wp:attachment":[{"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/media?parent=21222"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/categories?post=21222"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/tags?post=21222"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}