<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[pixboost - Medium]]></title>
        <description><![CDATA[Website Performance Optimization - Medium]]></description>
        <link>https://medium.com/pixboost?source=rss----8849ed16d3e1---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>pixboost - Medium</title>
            <link>https://medium.com/pixboost?source=rss----8849ed16d3e1---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 13 Nov 2026 23:04:48 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/pixboost" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Optimising images for High DPI displays]]></title>
            <link>https://medium.com/pixboost/optimising-images-for-high-dpi-displays-c7e558de645f?source=rss----8849ed16d3e1---4</link>
            <guid isPermaLink="false">https://medium.com/p/c7e558de645f</guid>
            <category><![CDATA[html]]></category>
            <category><![CDATA[image-cdn]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Dmitry Pokidov]]></dc:creator>
            <pubDate>Thu, 12 May 2022 12:27:44 GMT</pubDate>
            <atom:updated>2022-05-12T12:27:44.009Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Optimising Images for High DPI displays hero banner" src="https://cdn-images-1.medium.com/max/1000/0*NvUQhv8tcuI0qC75" /></figure><p>Over the last decade, we’ve gone from having a home PC to having a pocket PC that can access the internet everywhere. It came with plenty of freedom and new problems to solve. For example, we had to figure out how to present content on different screens.</p><p>This was answered through responsive design, meaning that we could rely on one codebase with adaptive layouts depending on the output device. Say you had a website with a large image for desktop computers that you wanted to display on mobile devices with smaller screens.</p><p>When you write HTML code you could use the srcset attribute on the image tag or a picture tag. Subsequently, the same image would be available in different sizes, and the browser would select the appropriate version.</p><p>However, the problems don’t stop at adapting to different screen sizes. There’s another characteristic called DPI. Let’s discuss this concept in detail using this photo of a gorgeous cheetah to remind us how quickly we would like our images to load.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gFHrfowEhOjaL763Lkxmbg.jpeg" /></figure><p>Photo by Ahmed Galal on Unsplash</p><h3>What is DPI</h3><p>DPI stands for “Dots Per Inch.” Initially, this term was mostly used to refer to an attribute of devices that put digital images onto paper and vice versa. These included scanners and printers. Therefore, DPI wasn’t a big concern for web content.</p><p>However, in 2010, Apple released the iPhone 4 with a Retina display. The main goal of that display was to make the output on the screen look closer to an actual photo and remove pixelation. The image below shows the clear difference between the Retina and non-retina display.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/0*SR2vVfP0gsAJNblK" /><figcaption>Retina display on iPhone 4</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/0*nZRh2DHXW65iPiH9" /><figcaption>Standard display on iPhone 3GS</figcaption></figure><p><a href="https://en.wikipedia.org/wiki/Retina_display">Images from Wikipedia</a></p><h3>What was the significant change here?</h3><p>Before the Retina display, you could refer to a device’s screen resolution to determine how wide your page or other content to be displayed should be. But with the advent of Retina display, the pixel now has two interpretations; hardware pixels and software pixels (CSS pixels).</p><p>Device manufacturers choose how many hardware pixels go into a CSS pixel, and this attribute is known as the device pixel ratio. For example, the Apple Retina display had a device pixel ratio of 2, meaning that one CSS pixel was equal to four hardware pixels (2 pixels in height and 2 in width).</p><p>The Galaxy S4 then took it up a notch with a device pixel ratio of 3, meaning one CSS pixel was equal to nine hardware pixels (3 in height and 3 in width). LG then dropped the G3 with a device pixel ratio of 4, which Samsung also adopted with the Galaxy S6.</p><p>We should remember that a CSS pixel is designed to result in the same size when the same content is being displayed on different devices with the same screen dimensions. Therefore, their differing device pixel ratios are responsible for the slight variations in the similarly sized content.</p><p>These variations manifest in the form of sharper text and icons, which you can easily notice at the edges of the characters and objects or any other part where contrasting colors border each other. The web browser will automatically render the content to output a suitable result in each case.</p><h3>Support for DPI in HTML</h3><p>There are two standard ways of accommodating your HTML markup for high DPI screens when using a tag with the srcset attribute. The first option is to use the DPI (x) descriptor when specifying the URL:</p><pre>&lt;img srcset=&quot;<br>        cheetah.jpg,<br>        cheetah-2x.jpg 2x,<br>        cheetah-3x.jpg 3x,<br>    &quot;<br>     src=&quot;cheetah.jpg&quot;<br>     alt=&quot;Cheetah&quot;/&gt;</pre><p>In the example above, the image will have the same screen size on all devices, and a browser will pick the one that matches the user’s screen DPI. But what if we need an image to have different sizes on different screens? Say you want to have full width on mobile and 400px on the desktop.</p><p>In that case, we would need to go with the width descriptor in the srcset attribute:</p><pre>&lt;img srcset=&quot;<br>        cheetah-400w.jpg 400w,<br>        cheetah-500w.jpg 500w,<br>        cheetah-600w.jpg 600w,<br>        cheetah-800w.jpg 800w,<br>        cheetah-1000w.jpg 1000w,<br>        cheetah-1200w.jpg 1200w,<br>        cheetah-1500w.jpg 1500w,<br>        cheetah-1800w.jpg 1800w,<br>    &quot;<br>     src=&quot;cheetah.jpg&quot;<br>     sizes=&quot;<br>        (max-width: 768px) 100vw,<br>        400px<br>     &quot;<br>     alt=&quot;Cheetah&quot;<br>/&gt;</pre><p>Notice how many sizes we included? That’s because mobile devices are different in size and also in DPI. So for a 400px-wide screen, we would need to have three images; 400px, 800px and 1200px. A browser will work its magic to pick the appropriate image based on the visible image size, display characteristics and other factors.</p><p>By the way, picking the sizes for srcset can be quite tricky. On the one hand, you could look up devices or screen sizes using analytics tools and target them directly. You may find sizes like 390px wide for the iPhone 12, 393px for the Pixel 5 and 375px for the iPhone SE, among others.</p><p>However, this approach comes with some drawbacks. Firstly, you’d need to update sizes whenever a new device is released and becomes popular, which can be quite the hassle. Secondly, having too many variants could decrease your CDN cache hit ratio, meaning you won’t be leveraging the full power of network edges.</p><p>So rather than going with specific devices, we recommend sticking with ranges like 400, 500 and 600 pixels. If we open the Chrome web browser with the Developer console and select Samsung or iPhone 12 Pro, we will see that the browser will load the 1200 pixels version because the screen DPI is 3.</p><p><a href="https://youtube.com/shorts/rGnUG_yB44w">Images for High DPI displays</a></p><p>If we change the device to iPhone SE, the browser will opt for the 800 pixels version. On that note, let’s have a look at the sizes of the images loaded for 1, 2 and 3 DPI:</p><ul><li>cheetah-400w.jpg — 42 Kb</li><li>cheetah-800w.jpg — 141 Kb</li><li>cheetah-1200w.jpg — 298 Kb</li></ul><p>Therefore, upon loading an image on a higher DPI display, the size of the image will also increase. This becomes a bigger concern when we understand that high DPI displays are often mobile devices on networks that might not always be as good as home broadband. So how can we make images load faster in such cases?</p><h3>Delivering smaller images for High DPI screens</h3><p>When discussing images, their sizes and the bandwidth used, it is crucial to understand what happens when you display the bigger image (1200px) on a smaller physical screen (400 screen pixels). The quality improves, as seen in the example from the intro.</p><p>However, there’s only so much detail the human eye can see when it comes to photos. Consequently, we can use more aggressive compression for displays with higher DPIs. So let’s encode our 3x variant with lower quality.</p><p>The 3x version is 154Kb, which is still greater than the 1x, but two times smaller than the original version. So, now that we know what we’d like to achieve, here’s how to proceed:</p><p>Load the larger version of the image on high DPI displays, but use lower quality. Unfortunately, this isn’t possible to implement with the tag at the moment. This is because we can’t mix w and x descriptors; otherwise, we’d do something like <a href="https://website.com/images/logo-800w-2x.png">https://website.com/images/logo-800w-2x.png</a>, with 800w and 2x in the srcset attribute to tell the browser what image to load.</p><p>Instead, we can use the &lt;picture&gt; tag with media selectors. Fortunately, there’s a <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/@media/resolution">resolution CSS media selector</a> that we can use in this manner. But it may not be that easy, seeing as browsers like Safari still don’t support it. Nevertheless, there’s a similar solution known as the <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/@media/-webkit-device-pixel-ratio">–webkit-device-pixel-ratio selector</a> that is supported everywhere.</p><p>Accordingly, let’s take a look at how to combine it with the srcset attribute:</p><pre>&lt;picture&gt;<br>  &lt;source<br>      media=&quot;(-webkit-min-device-pixel-ratio: 2) and (-webkit-max-device-pixel-ratio: 2.9999)&quot;<br>      srcset=&quot;<br>            q50/cheetah-400w.jpg 400w,<br>            q50/cheetah-500w.jpg 500w,<br>            q50/cheetah-600w.jpg 600w,<br>            q50/cheetah-800w.jpg 800w,<br>            q50/cheetah-1000w.jpg 1000w,<br>            q50/cheetah-1200w.jpg 1200w,<br>            q50/cheetah-1500w.jpg 1500w,<br>            q50/cheetah-1800w.jpg 1800w<br>          &quot;<br>      sizes=&quot;(max-width: 768px) 100vw, 400px&quot;<br>  &gt;<br>  &lt;source<br>      media=&quot;(-webkit-min-device-pixel-ratio: 3)&quot;<br>      srcset=&quot;<br>            q40/cheetah-400w.jpg 400w,<br>            q40/cheetah-500w.jpg 500w,<br>            q40/cheetah-600w.jpg 600w,<br>            q40/cheetah-800w.jpg 800w,<br>            q40/cheetah-1000w.jpg 1000w,<br>            q40/cheetah-1200w.jpg 1200w,<br>            q40/cheetah-1500w.jpg 1500w,<br>            q40/cheetah-1800w.jpg 1800w<br>          &quot;<br>      sizes=&quot;(max-width: 768px) 100vw, 400px&quot;<br>  &gt;<br>  &lt;img<br>      src=&quot;cheetah.jpg&quot;<br>      srcset=&quot;<br>            cheetah-400w.jpg 400w,<br>            cheetah-500w.jpg 500w,<br>            cheetah-600w.jpg 600w,<br>            cheetah-800w.jpg 800w,<br>            cheetah-1000w.jpg 1000w,<br>            cheetah-1200w.jpg 1200w,<br>            cheetah-1500w.jpg 1500w,<br>            cheetah-1800w.jpg 1800w<br>          &quot;<br>      alt=&quot;Cheetah&quot;<br>      sizes=&quot;(max-width: 768px) 100vw, 400px&quot;<br>  &gt;<br>&lt;/picture&gt;</pre><p>Now that looks better as we load lower quality images for screens with a DPI of 2 or 3, and even lower quality from 3 onwards. Nonetheless, I wouldn’t recommend this example in the production because it’s not leveraging <a href="https://pixboost.com/blog/next-gen-avif-format/">next-generation formats</a> like WebP and AVIF.</p><p>Now, that looks better, as we load lower quality image for screens with DPI 2 to 3 and even lower quality from 3 onwards</p><p>To add next-gen formats into the mix, we need to use the type attribute of the tag and add a separate source for every format. It’s important to remember that the browser will use the first source it can load, so we should start with AVIF, then go to WebP, and lastly, JPEG.</p><pre>&lt;picture&gt;<br>  &lt;source<br>      media=&quot;(-webkit-min-device-pixel-ratio: 2) and (-webkit-max-device-pixel-ratio: 2.9999)&quot;<br>      type=&quot;image/avif&quot;<br>      srcset=&quot;<br>            q50-avif/cheetah-400w.avif 400w,<br>            q50-avif/cheetah-500w.avif 500w,<br>            q50-avif/cheetah-600w.avif 600w,<br>            q50-avif/cheetah-800w.avif 800w,<br>            q50-avif/cheetah-1000w.avif 1000w,<br>            q50-avif/cheetah-1200w.avif 1200w,<br>            q50-avif/cheetah-1500w.avif 1500w,<br>            q50-avif/cheetah-1800w.avif 1800w<br>          &quot;<br>      sizes=&quot;(max-width: 768px) 100vw, 400px&quot;<br>  &gt;<br>  &lt;source<br>      media=&quot;(-webkit-min-device-pixel-ratio: 2) and (-webkit-max-device-pixel-ratio: 2.9999)&quot;<br>      type=&quot;image/webp&quot;<br>      srcset=&quot;<br>            q50-webp/cheetah-400w.webp 400w,<br>            q50-webp/cheetah-500w.webp 500w,<br>            q50-webp/cheetah-600w.webp 600w,<br>            q50-webp/cheetah-800w.webp 800w,<br>            q50-webp/cheetah-1000w.webp 1000w,<br>            q50-webp/cheetah-1200w.webp 1200w,<br>            q50-webp/cheetah-1500w.webp 1500w,<br>            q50-webp/cheetah-1800w.webp 1800w<br>          &quot;<br>      sizes=&quot;(max-width: 768px) 100vw, 400px&quot;<br>  &gt;<br>  &lt;source<br>      media=&quot;(-webkit-min-device-pixel-ratio: 2) and (-webkit-max-device-pixel-ratio: 2.9999)&quot;<br>      srcset=&quot;<br>            q50/cheetah-400w.jpg 400w,<br>            q50/cheetah-500w.jpg 500w,<br>            q50/cheetah-600w.jpg 600w,<br>            q50/cheetah-800w.jpg 800w,<br>            q50/cheetah-1000w.jpg 1000w,<br>            q50/cheetah-1200w.jpg 1200w,<br>            q50/cheetah-1500w.jpg 1500w,<br>            q50/cheetah-1800w.jpg 1800w<br>          &quot;<br>      sizes=&quot;(max-width: 768px) 100vw, 400px&quot;<br>  &gt;<br>  &lt;source<br>      media=&quot;(-webkit-min-device-pixel-ratio: 3)&quot;<br>      type=&quot;image/avif&quot;<br>      srcset=&quot;<br>            q40-avif/cheetah-400w.avif 400w,<br>            q40-avif/cheetah-500w.avif 500w,<br>            q40-avif/cheetah-600w.avif 600w,<br>            q40-avif/cheetah-800w.avif 800w,<br>            q40-avif/cheetah-1000w.avif 1000w,<br>            q40-avif/cheetah-1200w.avif 1200w,<br>            q40-avif/cheetah-1500w.avif 1500w,<br>            q40-avif/cheetah-1800w.avif 1800w<br>          &quot;<br>      sizes=&quot;(max-width: 768px) 100vw, 400px&quot;<br>  &gt;<br>  &lt;source<br>      media=&quot;(-webkit-min-device-pixel-ratio: 3)&quot;<br>      type=&quot;image/webp&quot;<br>      srcset=&quot;<br>            q40-webp/cheetah-400w.webp 400w,<br>            q40-webp/cheetah-500w.webp 500w,<br>            q40-webp/cheetah-600w.webp 600w,<br>            q40-webp/cheetah-800w.webp 800w,<br>            q40-webp/cheetah-1000w.webp 1000w,<br>            q40-webp/cheetah-1200w.webp 1200w,<br>            q40-webp/cheetah-1500w.webp 1500w,<br>            q40-webp/cheetah-1800w.webp 1800w<br>          &quot;<br>      sizes=&quot;(max-width: 768px) 100vw, 400px&quot;<br>  &gt;<br>  &lt;source<br>      media=&quot;(-webkit-min-device-pixel-ratio: 3)&quot;<br>      srcset=&quot;<br>            q40/cheetah-400w.jpg 400w,<br>            q40/cheetah-500w.jpg 500w,<br>            q40/cheetah-600w.jpg 600w,<br>            q40/cheetah-800w.jpg 800w,<br>            q40/cheetah-1000w.jpg 1000w,<br>            q40/cheetah-1200w.jpg 1200w,<br>            q40/cheetah-1500w.jpg 1500w,<br>            q40/cheetah-1800w.jpg 1800w<br>          &quot;<br>      sizes=&quot;(max-width: 768px) 100vw, 400px&quot;<br>  &gt;<br>  &lt;img<br>      src=&quot;cheetah.jpg&quot;<br>      srcset=&quot;<br>            cheetah-400w.jpg 400w,<br>            cheetah-500w.jpg 500w,<br>            cheetah-600w.jpg 600w,<br>            cheetah-800w.jpg 800w,<br>            cheetah-1000w.jpg 1000w,<br>            cheetah-1200w.jpg 1500w,<br>            cheetah-1200w.jpg 1800w<br>          &quot;<br>      alt=&quot;Cheetah&quot;<br>      sizes=&quot;(max-width: 768px) 100vw, 400px&quot;<br>  &gt;<br>&lt;/picture&gt;</pre><p>And here it is! The snippet that will give us the best mix of quality and performance. It’s also worth mentioning that there’s no javascript involved. The downside is that we would need to prepare 48 variants of the source image. This is where an Image CDN can help.</p><h3>Using an Image CDN to reduce the number of source images</h3><p>With Pixboost as an example, let’s see how to produce all the required variants using an Image Processing API. Firstly, you’ll need to create a free account at Pixboost.com. Then, when you log in for the first time, add a new image source as in the video below.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FbbPEu86EKoo%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DbbPEu86EKoo&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FbbPEu86EKoo%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/a949e33bd9ec1b5e21df6d314238f224/href">https://medium.com/media/a949e33bd9ec1b5e21df6d314238f224/href</a></iframe><p>Now, you can use the /resize API to produce all the needed sizes and next-generation formats.</p><pre>&lt;img srcset=&quot;<br>        https://pixboost.com/api/2/img/http://www.midday.coffee/dppx-demo/cheetah.jpg/resize?size=400&amp;auth=MTA0ODU5NDA0NQ__ 400w,<br>        https://pixboost.com/api/2/img/http://www.midday.coffee/dppx-demo/cheetah.jpg/resize?size=500&amp;auth=MTA0ODU5NDA0NQ__ 500w,<br>        https://pixboost.com/api/2/img/http://www.midday.coffee/dppx-demo/cheetah.jpg/resize?size=600&amp;auth=MTA0ODU5NDA0NQ__ 600w,<br>        https://pixboost.com/api/2/img/http://www.midday.coffee/dppx-demo/cheetah.jpg/resize?size=800&amp;auth=MTA0ODU5NDA0NQ__ 800w,<br>        https://pixboost.com/api/2/img/http://www.midday.coffee/dppx-demo/cheetah.jpg/resize?size=1000&amp;auth=MTA0ODU5NDA0NQ__ 1000w,<br>        https://pixboost.com/api/2/img/http://www.midday.coffee/dppx-demo/cheetah.jpg/resize?size=1200&amp;auth=MTA0ODU5NDA0NQ__ 1200w,<br>        https://pixboost.com/api/2/img/http://www.midday.coffee/dppx-demo/cheetah.jpg/resize?size=1500&amp;auth=MTA0ODU5NDA0NQ__ 1500w,<br>        https://pixboost.com/api/2/img/http://www.midday.coffee/dppx-demo/cheetah.jpg/resize?size=1800&amp;auth=MTA0ODU5NDA0NQ__ 1800w<br>    &quot;<br>     src=&quot;cheetah.jpg&quot;<br>     sizes=&quot;<br>        (max-width: 768px) 100vw,<br>        400px<br>    &quot;<br>     alt=&quot;Cheetah&quot;<br>/&gt;</pre><p>The above code will cater to different sizes and next-generation formats by using the Accept header. A browser will send a list of supported formats to the API, and Pixboost will choose the best one to use. The only missing part now is the additional compression on screens with DPI &gt;= 2. Finally, we have our new API feature; the ?dppx query parameter.</p><h3>API support for High DPI screens</h3><p>The new ?dppx hint passes the screen DPI to the API, so we can perform optimizations based on its value.</p><p>Having a ?ddpx and not a direct quality gives us plenty of room to add more enhancements. We believe the end-user doesn’t need direct access to those configurations, which would become harder to support in the long run. The most recent example is the AVIF format that was introduced last year. It enables us to use much higher compression while keeping the same level of visual perception. We can also use different quality and types of compression for various kinds of images such as photos, illustrations and more.</p><p>To introduce ?dppx support into our HTML code, we still need to use the &lt;picture&gt; tag with media queries. But just like with the &lt;img&gt; example, we don’t need to specify a separate &lt;source&gt; for the next-generation formats.</p><pre>&lt;picture&gt;<br>  &lt;source<br>      media=&quot;(-webkit-min-device-pixel-ratio: 2) and (-webkit-max-device-pixel-ratio: 2.9999)&quot;<br>      srcset=&quot;<br>        https://pixboost.com/api/2/img/http://www.midday.coffee/dppx-demo/cheetah.jpg/resize?size=400&amp;dppx=2&amp;auth=MTA0ODU5NDA0NQ__ 400w,<br>        https://pixboost.com/api/2/img/http://www.midday.coffee/dppx-demo/cheetah.jpg/resize?size=500&amp;dppx=2&amp;auth=MTA0ODU5NDA0NQ__ 500w,<br>        https://pixboost.com/api/2/img/http://www.midday.coffee/dppx-demo/cheetah.jpg/resize?size=600&amp;dppx=2&amp;auth=MTA0ODU5NDA0NQ__ 600w,<br>        https://pixboost.com/api/2/img/http://www.midday.coffee/dppx-demo/cheetah.jpg/resize?size=800&amp;dppx=2&amp;auth=MTA0ODU5NDA0NQ__ 800w,<br>        https://pixboost.com/api/2/img/http://www.midday.coffee/dppx-demo/cheetah.jpg/resize?size=1000&amp;dppx=2&amp;auth=MTA0ODU5NDA0NQ__ 1000w,<br>        https://pixboost.com/api/2/img/http://www.midday.coffee/dppx-demo/cheetah.jpg/resize?size=1200&amp;dppx=2&amp;auth=MTA0ODU5NDA0NQ__ 1200w,<br>        https://pixboost.com/api/2/img/http://www.midday.coffee/dppx-demo/cheetah.jpg/resize?size=1500&amp;dppx=2&amp;auth=MTA0ODU5NDA0NQ__ 1500w,<br>        https://pixboost.com/api/2/img/http://www.midday.coffee/dppx-demo/cheetah.jpg/resize?size=1800&amp;dppx=2&amp;auth=MTA0ODU5NDA0NQ__ 1800w<br>      &quot;<br>      sizes=&quot;(max-width: 768px) 100vw, 400px&quot;<br>  &gt;<br>  &lt;source<br>      media=&quot;(-webkit-min-device-pixel-ratio: 3)&quot;<br>      srcset=&quot;<br>        https://pixboost.com/api/2/img/http://www.midday.coffee/dppx-demo/cheetah.jpg/resize?size=400&amp;dppx=3&amp;auth=MTA0ODU5NDA0NQ__ 400w,<br>        https://pixboost.com/api/2/img/http://www.midday.coffee/dppx-demo/cheetah.jpg/resize?size=500&amp;dppx=3&amp;auth=MTA0ODU5NDA0NQ__ 500w,<br>        https://pixboost.com/api/2/img/http://www.midday.coffee/dppx-demo/cheetah.jpg/resize?size=600&amp;dppx=3&amp;auth=MTA0ODU5NDA0NQ__ 600w,<br>        https://pixboost.com/api/2/img/http://www.midday.coffee/dppx-demo/cheetah.jpg/resize?size=800&amp;dppx=3&amp;auth=MTA0ODU5NDA0NQ__ 800w,<br>        https://pixboost.com/api/2/img/http://www.midday.coffee/dppx-demo/cheetah.jpg/resize?size=1000&amp;dppx=3&amp;auth=MTA0ODU5NDA0NQ__ 1000w,<br>        https://pixboost.com/api/2/img/http://www.midday.coffee/dppx-demo/cheetah.jpg/resize?size=1200&amp;dppx=3&amp;auth=MTA0ODU5NDA0NQ__ 1200w,<br>        https://pixboost.com/api/2/img/http://www.midday.coffee/dppx-demo/cheetah.jpg/resize?size=1500&amp;dppx=3&amp;auth=MTA0ODU5NDA0NQ__ 1500w,<br>        https://pixboost.com/api/2/img/http://www.midday.coffee/dppx-demo/cheetah.jpg/resize?size=1800&amp;dppx=3&amp;auth=MTA0ODU5NDA0NQ__ 1800w<br>      &quot;<br>      sizes=&quot;(max-width: 768px) 100vw, 400px&quot;<br>  &gt;<br>  &lt;img<br>      src=&quot;cheetah.jpg&quot;<br>      srcset=&quot;<br>        https://pixboost.com/api/2/img/http://www.midday.coffee/dppx-demo/cheetah.jpg/resize?size=400&amp;auth=MTA0ODU5NDA0NQ__ 400w,<br>        https://pixboost.com/api/2/img/http://www.midday.coffee/dppx-demo/cheetah.jpg/resize?size=500&amp;auth=MTA0ODU5NDA0NQ__ 500w,<br>        https://pixboost.com/api/2/img/http://www.midday.coffee/dppx-demo/cheetah.jpg/resize?size=600&amp;auth=MTA0ODU5NDA0NQ__ 600w,<br>        https://pixboost.com/api/2/img/http://www.midday.coffee/dppx-demo/cheetah.jpg/resize?size=800&amp;auth=MTA0ODU5NDA0NQ__ 800w,<br>        https://pixboost.com/api/2/img/http://www.midday.coffee/dppx-demo/cheetah.jpg/resize?size=1000&amp;auth=MTA0ODU5NDA0NQ__ 1000w,<br>        https://pixboost.com/api/2/img/http://www.midday.coffee/dppx-demo/cheetah.jpg/resize?size=1200&amp;auth=MTA0ODU5NDA0NQ__ 1200w,<br>        https://pixboost.com/api/2/img/http://www.midday.coffee/dppx-demo/cheetah.jpg/resize?size=1500&amp;auth=MTA0ODU5NDA0NQ__ 1500w,<br>        https://pixboost.com/api/2/img/http://www.midday.coffee/dppx-demo/cheetah.jpg/resize?size=1800&amp;auth=MTA0ODU5NDA0NQ__ 1800w<br>      &quot;<br>      alt=&quot;Cheetah&quot;<br>      sizes=&quot;(max-width: 768px) 100vw, 400px&quot;<br>  &gt;<br>&lt;/picture&gt;</pre><p>And now, we have the perfect snippet for showing responsive images on the website.</p><h3>Obsolete methods</h3><p>Some time ago, there was an approach that relied on the screen DPR client hint to pick an image source, and the Content-DPR header would confirm the image device pixel ratio in such requests.</p><p>Where the Content-DPR value differs from the DPR value (the screen DPR isn’t the same as the image DPR), the Content-DPR would be used to ascertain the inherent image size and scale the image accordingly.</p><p>This approach used the most recent instance of the Content-DPR if the Content-DPR header appeared more than once in a message. But over time, there was a lack of consensus around Content-DPR, with many not seeing image resolution as a transport-level feature.</p><p>Therefore, the new approach was to specify the intrinsic resolution within the EXIF metadata. As we speak, Content-DPR is no longer supported by many browsers, while others are in the process of dropping it, and a few have only kept it for backward-compatibility reasons.</p><h3>Conclusion</h3><p>The web changed a lot once we were able to use our phones, tablets, fridges and other devices to access the internet. To deliver images with higher visual fidelity, we need to support screens with DPI &gt; 2. However, for the internet to be more accessible, we need to cater to people without fast connections by sending them only the data they need.</p><p>We can achieve this goal by using higher compression on High DPI screens. Additionally, using an Image CDN comes with some practical long-term benefits such as:</p><ul><li>Making your processes more lightweight when storing only one source image</li><li>Cleaning up your markup by removing the need for a separate source for the next-gen formats</li><li>Future-proofing your image delivery with automatic support for new formats and features (it is vital to note that switching to formats like AVIF can enable you up to 80% more compression than JPEG offers without losing quality, which bodes well for your website’s performance)</li><li>Content-sensitive compression — an Image CDN can automatically change the compression quality for each image based on what’s in the image. For example, images with fewer colors and less detail will be compressed a lot more than those that are rich in detail, color and other patterns. By doing so, you can strike the perfect middle-ground between quality and size for each image.</li></ul><p>If you would like to discover the shortfalls in your web project’s image optimization and the extent to which they diminish overall website speed, you can use Google PageSpeed insights and zoom in on PageDetox.</p><h3>Credits</h3><p>The method and API design are based on <a href="https://jakearchibald.com/2021/serving-sharp-images-to-high-density-screens/">the article written by the web performance god — Jake Archibald</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c7e558de645f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/pixboost/optimising-images-for-high-dpi-displays-c7e558de645f">Optimising images for High DPI displays</a> was originally published in <a href="https://medium.com/pixboost">pixboost</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Choosing between lossy and lossless conversion for PNG]]></title>
            <link>https://medium.com/pixboost/choosing-between-lossy-and-lossless-conversion-for-png-2e43eaabe669?source=rss----8849ed16d3e1---4</link>
            <guid isPermaLink="false">https://medium.com/p/2e43eaabe669</guid>
            <category><![CDATA[web-performance]]></category>
            <category><![CDATA[image-cdn]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[image-processing]]></category>
            <dc:creator><![CDATA[Dmitry Pokidov]]></dc:creator>
            <pubDate>Wed, 17 Nov 2021 17:47:39 GMT</pubDate>
            <atom:updated>2021-11-17T17:47:39.431Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*968XTBcjPz9M_jsy0eh0Sw.jpeg" /></figure><p>PNG and JPEG are the two oldest image formats that web developers use to add graphics to their web pages. Web standards came a long way, and often we use next-generation formats, such as WebP/AVIF/JpegXL, to deliver an image to the end-user. But JPEG and PNG are still the source of truth most of the time.</p><p>In this article, I’ll explain why converting PNG to the next-gen format is not as straightforward and how we went about it.</p><p>It’s also the 1st of November, and very appropriate to talk about images!</p><p><a href="https://twitter.com/HenriHelvetica/status/1455172402405679106?ref_src=twsrc%5Etfw%7Ctwcamp%5Etweetembed%7Ctwterm%5E1455172402405679106%7Ctwgr%5E%7Ctwcon%5Es1_c10&amp;ref_url=https%3A%2F%2Fpixboost.com%2Fblog%2Fpng-to-next-gen-conversion%2F">https://twitter.com/HenriHelvetica/status/1455172402405679106</a></p><p>We use Go and <a href="https://imagemagick.org/script/magick-wand.php">MagickWand</a> library in the code snippets. You can get the latest version of the library using <a href="https://github.com/dooman87/imagemagick-docker">ImageMagick docker image</a> that I maintain.</p><p>Our opensource Image CDN <a href="https://github.com/Pixboost/transformimgs">“transformimgs” that is available on Github</a> is using the approach from this blog, and it works quite well in production.</p><p>Let’s get to it!</p><h3>PNG</h3><p>Let’s see what the main difference between JPEG and PNG are and when we use each.</p><p>Firstly, PNG is a <a href="https://en.wikipedia.org/wiki/Lossless_compression">lossless format</a>, meaning when you compress/uncompress the image it doesn’t change. This is like a ZIP archive that doesn’t change the source data after you extracted it. On the contrary, the resulting image is not the same when using JPEG. So, if it is important to display exactly the same image then PNG will be our choice. However, it’s rarely a requirement for the Web, rather we want our images to look good. JPEG could introduce visual artefacts to the image, and usually, the images with fewer details and colours are affected the most. Generally, it makes sense to use lossless compressions for sharp images with few colours. The examples could be <strong>logos, banners, illustrations</strong>. We’ll look at some examples in the next section</p><p>Secondly, PNG supports transparency. If you’d like to show a background of the page on some parts of the image then you make those parts transparent. The popular use case is <strong>product images</strong> on online shops.</p><p>Keeping the above in mind it shouldn’t be a problem to choose the format for the source image. Though, when we use modern formats to deliver the image, they support both lossy and lossless encoding, and we can pick which one to use.</p><p>So, here comes the problem:</p><p><em>When is it better to use lossy or lossless compression when converting PNG to the next generation format?</em></p><h3>Lossy or Lossless?</h3><p>Lossy compressed images are smaller compared to lossless, but they also might have visual artifacts and glitches. Let’s take a look at some examples.</p><p>We use ImageMagick with WebP format here because it’s supported by all browsers: magick image.png -define webp:lossless=[true/false] image.webp.</p><h3>Example 1. Illustration</h3><p>Original PNG image:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Z7soIccGxbC0lmS7.png" /><figcaption>Original PNG — 294Kb</figcaption></figure><p>When converting to:</p><ul><li><a href="https://pixboost.com/blog/png-to-next-gen-conversion/people-lossy.webp">lossy</a> — 100Kb</li><li><a href="https://pixboost.com/blog/png-to-next-gen-conversion/people-lossless.webp">lossless</a> — 108Kb</li></ul><p>The difference is 8 Kb which is <strong>3%</strong> of the original image. Now, let’s zoom in a bit and see what happened to quality:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/548/0*IOleRTkg-Pmx1dmj.png" /><figcaption>Lossy WebP — 100Kb</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/543/0*eGvjiL1DK-Q3SV3J.png" /><figcaption>Lossless WebP — 108Kb</figcaption></figure><p>The lossless version is the same as the original, and we could see that the lossy image became smoother and also have some artifacts around the red notebook and shadow from the sweater.</p><p>The conclusion for us here was — 8Kb doesn’t worth quality loss, and we would prefer <strong>lossless compression over lossy</strong> in this case.</p><h3>Example 2. Photo</h3><p>Let’s look at the other example where PNG used for transparency:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/0*sJjt6eJXYvn_SH4A.png" /><figcaption>Original PNG — 276Kb</figcaption></figure><p>When converting to:</p><ul><li><a href="https://pixboost.com/blog/png-to-next-gen-conversion/photo-lossy.webp">lossy</a> — 16Kb</li><li><a href="https://pixboost.com/blog/png-to-next-gen-conversion/photo-lossless.webp">lossless</a> — 143Kb</li></ul><p>The difference here is 127Kb which is <strong>46%</strong> of the original image.</p><p>Let’s compare zoomed-in fragments:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/303/0*AOI9zRN1BUhMtGZF.png" /><figcaption>Lossy WebP — 16Kb</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/272/0*SDLaW0Jtji2FBDwK.png" /><figcaption>Lossless WebP — 143Kb</figcaption></figure><p>There is a visible glitch in the plant’s pot texture, but most likely it will be lost to a human eye due to the number of details and colours. The difference in the size is huge, and the verdict is <strong>lossy compression would be much preferable</strong> in this case.</p><p>After running the experiments above on the bunch of PNGs, the requirement distilled itself:</p><p><em>We would like to distinguish between photos and illustration/logos then use lossy compression for the first and lossless for the latter</em></p><h3>Solution</h3><p>After the brainstorming session, we tabled two conceptually different approaches:</p><ol><li>Use machine learning (we are a startup after all). We have a good dataset, so we could train a model and use it. There are a few cons:</li></ol><ul><li>We don’t have an ML expert on the Team.</li><li>Deployment would be complicated. ML model + training and using it in the application.</li><li>How do you fix bugs in it?</li><li>What if it will break free and will take over our servers/planet??!!!</li></ul><p>2. Write a boring algorithm (we are a profitable startup after all) that would use image statistics. There are some cons here as well:</p><ul><li>Might be less accurate</li><li>Analysing images are memory and CPU intensive and could be a showstopper in the case of Image CDN where images should be processed in a reasonable time on the first request.</li></ul><p>We decided to go with option number 2 and fallback to the first if performance will become a problem.</p><h3>Implementation</h3><p>The next two sections are all about technical implementation. TLDR: The code works and is currently deployed in production. You could jump to the <a href="https://pixboost.com/blog/png-to-next-gen-conversion/#results">results</a> section if going through the walls of code is not your cup of tea.</p><p>Before diving into the implementation we picked different types of <a href="https://github.com/Pixboost/transformimgs/tree/master/img/processor/test_files/is_illustration">PNGs that we want to classify</a>. Using them we wrote a table unit test:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/394685136fdd7e047326f2c8e70999d0/href">https://medium.com/media/394685136fdd7e047326f2c8e70999d0/href</a></iframe><p>Now, we need to make it green :)</p><p>After digging the Internet, we found a very <a href="https://legacy.imagemagick.org/Usage/compare/#type_reallife">good article on image classification using ImageMagick</a>. There was a solution from Jim Van Zandt:</p><blockquote>write out the color of every pixel</blockquote><blockquote>sort by color</blockquote><blockquote>write out the pixel count for every color</blockquote><blockquote>sort by pixel count</blockquote><blockquote>Work your way through the list until you have accounted for half the pixels in the image.</blockquote><blockquote>If #pixels »&gt; #colors then it’s cartoon like.</blockquote><p>We’ve also reached out to the ImageMagick community and had quite a few very useful suggestions in <a href="https://github.com/ImageMagick/ImageMagick/discussions/4315">this discussion thread</a>.</p><p>That was a good starting point, so we implemented the algorithm, but got mixed results. The original approach intended to work on cartoon images, however, we would also want to include illustrations that have more colours and could be more complex than drawings.</p><p>However, it felt that idea of looking at 50% of the image is a step in the right direction, but the stat we make the decision on doesn’t behave exactly as we wish. After several hours of digging deeper and looking at numbers, we figured that instead of comparing the number of pixels to the number of colours it would be better to compare the ratio of the number of colors needed for 50% divided by the total number of colours. Here is the first implementation:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/26c68a997dd3a9ec4449c839989962a1/href">https://medium.com/media/26c68a997dd3a9ec4449c839989962a1/href</a></iframe><p>It worked for all test images except for the cases with a background. What we wanted is to exclude background from our calculation. We wrote a simple algorithm that removes the background colour:</p><ul><li>If the most popular colour covers more than 10% of the image then assume it’s a background and ignore it</li></ul><p>That solved our unit tests, and we were ready to take a new version for a spin on the bigger scale!</p><p>We downloaded 300 most popular PNGs that are currently optimised through Pixboost and ran them through the func. Then we compared results manually and made some minor tweaks to increase accuracy, which is now in between 98–99%.</p><p>Ready for production, we thought. However, we ran all the tests on powerful laptops and once moved to servers and put under the load we realised one thing:</p><p><em>It ate all the memory!</em></p><h3>Performance</h3><p>Image processing is a resource intensive task. The MagickWand library we use builds an in-memory tree(cube) to calculate image histogram (number of colours). The tree grows proportionally to the number of colours used. At first, we thought there was a <a href="https://github.com/gographics/imagick/issues/265">memory leak</a>, and we spent a lot of time trying to fix it. We failed in the end because there was no memory leak, but Golang and Linux are very smart on when to release memory of the process.</p><p>But we still had a memory problem to solve. We identified 2 hotspots where memory footprint increased dramatically:</p><ul><li>Images with a big number of colours. That was a case mainly with real-life photos that would have 60k+ colours. What we also found is that PNG compression works poorly on those and, we could find them by calculating a ratio between a number of bytes and pixels:</li></ul><pre>if float32(len(imgData))/float32(imgWidth*imgHeight) &gt; 1.0 {<br>	return false, nil<br>}</pre><ul><li>When we process a medium size image (1000x1000) with not too many colours (under 5k) the memory consumption would still be high (more than 1Gb). We solved that problem, by downscaling images to 500 pixels wide before extracting a histogram:</li></ul><pre>err := mw.ReadImageBlob(imgData)<br>if err != nil {<br>	return false, err<br>}<br><br>if imgWidth*imgHeight &gt; 500*500 {<br>	aspectRatio := float32(imgWidth) / float32(imgHeight)<br>	err = mw.ScaleImage(500, uint(500/aspectRatio))<br>	if err != nil {<br>		return false, err<br>	}<br>}<br><br>colorsCnt, colors = mw.GetImageHistogram()</pre><p>We’ve also added a few more optimisations that helped us to reduce the execution time and memory consumption further. Here is the final result that you could also find on <a href="https://github.com/Pixboost/transformimgs/blob/master/img/processor/imagemagick.go#L322">Github</a>:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/097952361259c0f97ff1283d2fe615bf/href">https://medium.com/media/097952361259c0f97ff1283d2fe615bf/href</a></iframe><p>The code we ended up with is straightforward which means it will be easy to maintain and improve in the future.</p><p>At the end of the day, we still had to bump the type of instances in our clusters from 8 to 16Gb which made everyone happy.</p><h3>Results</h3><p>In the greater scheme of things PNGs only account for 5% of all Pixboost traffic, but:</p><ul><li>We believe in accessible Web and doing a poor job on one format makes it not</li><li>We have few customers that heavily use PNG images</li><li>5% of our traffic is still about 20Gb daily and growing.</li></ul><p>Once released a canary version to production, we ran 2 tests on different data sets that again included the most popular processed images. We compared the current production version output with a new one:</p><ul><li>350 PNG images</li><li>202 images became smaller and 47 larger</li><li>The overall size of optimised images dropped from 21Mb to 8.5Mb which is <em>3x</em> better compression!</li><li>The response time dropped by 2%.</li></ul><p><em>Converted PNGs became 3 times smaller.</em></p><ul><li>500 mix of PNG and JPEG images</li><li>Overall size dropped from 45.7Mb to 43Mb which is <em>5%</em> improvement</li><li>The processing time dropped by 5%</li></ul><h3>Conclusion</h3><p>It’s been fun working on this feature which involved a lot of discovery, testing and performance tuning. After all, our main goal is to deliver the best images to the users, and we could accomplish it in this case. Happy days and we look forward to improving the service further.</p><p>And you could all try it yourself using our <a href="https://github.com/Pixboost/transformimgs">Open Source version</a> or <a href="https://pixboost.com/">SaaS offering</a>!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2e43eaabe669" width="1" height="1" alt=""><hr><p><a href="https://medium.com/pixboost/choosing-between-lossy-and-lossless-conversion-for-png-2e43eaabe669">Choosing between lossy and lossless conversion for PNG</a> was originally published in <a href="https://medium.com/pixboost">pixboost</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Load Your Images Faster with the Next-Gen AVIF Format]]></title>
            <link>https://medium.com/pixboost/load-your-images-faster-with-the-next-gen-avif-format-3a0a6d2936eb?source=rss----8849ed16d3e1---4</link>
            <guid isPermaLink="false">https://medium.com/p/3a0a6d2936eb</guid>
            <category><![CDATA[wev-development]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[image-processing]]></category>
            <category><![CDATA[image-cdn]]></category>
            <dc:creator><![CDATA[Dmitry Pokidov]]></dc:creator>
            <pubDate>Thu, 03 Dec 2020 02:10:43 GMT</pubDate>
            <atom:updated>2020-12-03T02:10:42.934Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*sMTaPZ3bpZlnITXv" /></figure><p>Images have come to dominate the Internet. Most of today’s websites are comprised of 50 to 80 percent images. Here at Pixboost, our mission is to optimize images, making them as small as possible so that we can serve them to our users as fast as possible.</p><p>So we were excited to begin implementing the new image format, AVIF, which is supported in the latest version of Chrome (86), and which will be supported in the next version of Firefox. AVIF also has significant corporate support, in fact it’s championed specifically by Netflix. In this post, I’ll briefly cover the current state of web image formats and then I’ll do a comparison to show how AVIF enables pages to load faster.</p><h3>Image Types and Formats</h3><p>There are two fundamental image types: raster and vector.</p><p>Vectors are the type you would use to create geometric primitives like lines, circles, rectangles, etc. They are mathematically based so can be scaled to an infinite size. Vectors also support text, so they tend to be used for things like icons and logos. The most popular file format for vectors is SVG, but we won’t be expanding upon that format in this post :).</p><p>Raster images on the other hand are made up of pixels (points), with each pixel having its own color. Graphics and photos tend to be raster, and the most popular raster file formats on the web are JPEG and PNG. The JPEG format is good for photos because it compresses them with some quality loss, but significantly reduces file sizes. The PNG format maintains complete quality and supports transparency, but doesn’t reduce file sizes as much. So from a practical perspective, JPEG is used in most cases and PNG is used primarily when transparency is required.</p><p>Then there’s WebP, a relatively new format developed about 10 years ago <a href="https://caniuse.com/?search=webp">that is now supported by most browsers</a>. Generally speaking, if you convert a JPEG or PNG image to a WebP image, the resulting file size will be 30% smaller and there will be no loss of quality. Nice, right?</p><p>However, <strong>AVIF</strong>, the new kid on the block, pushes the envelope even further for web developers. It compresses images better than WebP with the same quality!</p><h3>File sizes: AVIF vs WebP vs PNG/JPEG</h3><p>We ran tests using our clients’ images. We picked 500 of our most popular images and ran them through our <a href="https://help.pixboost.com/api/optimise">/optimise</a> endpoint with the following output formats: the original format (PNG/JPEG), WebP, and finally AVIF.</p><p>Here are the results:</p><ul><li>In 93% of cases, the AVIF image was smaller than the WebP image</li><li>On average, the AVIF image was 47% smaller than the WebP image</li><li>The WebP image was smaller than an optimized PNG/JPEG image in 99% of cases</li><li>On average, the WebP image was smaller than the PNG/JPEG image by 33%</li></ul><p>So from these numbers, we can suggest the following best practices with respect to raster formats on the Web:</p><ul><li>Use AVIF if it’s browser supported, else</li><li>Use WebP if it’s browser supported, else</li><li>Use PNG or JPEG</li></ul><p>Let’s take a look at one specific example. Here’s the source image:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*meGnXMCu7vPjONE-jA1Z_w.png" /></figure><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/48a0cfe4b9821443ac5283b56f3dafdf/href">https://medium.com/media/48a0cfe4b9821443ac5283b56f3dafdf/href</a></iframe><p>But what is the catch? Basically, AVIF is far more expensive to encode. It’s an extremely taxing process with respect to both CPU and memory. Using the same image set as above, we compared the required length of time to optimize images using WebP and AVIF, respectively. To process the 500 total images, it took:</p><ul><li>391 seconds to load all of the WebP images</li><li>919 seconds to load all of the AVIF images</li></ul><p>So that’s 2.5 times as long for AVIF, although the calculation included the time to download the images as well. When we compared just the CPU time to convert the images, we found that it took seven times more CPU time to convert AVIF vs. WebP.</p><p>Memory wise, when encoding a 1000x1000 image, the process consumed around 1GB of RAM.</p><p>But we also need to keep tooling in mind: it’s still early days for AVIF and so processes haven’t been optimized for it as they have been for WebP (for which it is possible to pick various performance options).</p><h3>How would I use it?</h3><p>In HTML, you can do as follows:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/336c269a06588156148838e7763fcf42/href">https://medium.com/media/336c269a06588156148838e7763fcf42/href</a></iframe><p>Or if you use an image CDN (like Pixboost), it’s as simple as one line:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/40ebc5f5873a4f94bf011fb70d13f2e0/href">https://medium.com/media/40ebc5f5873a4f94bf011fb70d13f2e0/href</a></iframe><p>But if you aren’t using an image CDN, you would need to convert your source image into an AVIF, so let’s have a look at the tools you could use for that.</p><h3>Tools that support AVIF encoding</h3><p>As I write this article in November 2020, it’s still early days for AVIF, so there aren’t currently a lot of options for using it.</p><p>But here are some of the existing ones:</p><ul><li><a href="https://imagemagick.org/">ImageMagick</a>: AVIF files have been writable since version 7.0.8. If you know Docker, you can <a href="https://github.com/dooman87/imagemagick-docker">use this image</a> that I’m maintaining. ImageMagick has quite a powerful CLI, so you could easily automate AVIF conversion if necessary.</li><li><a href="https://squoosh.app/">Squoosh</a> is a web app that lets you upload an image and then choose the formats to which you’d like to convert it. It’s quite powerful with a lot of settings, but doesn’t allow you to do batch processing, so you would need to convert each image individually.</li></ul><h3>Supporting AVIF in the Pixboost Image CDN</h3><p>Pixboost was one of the first image CDNs to introduce AVIF. Our API doesn’t require you to manually choose an image’s target format, but rather automatically selects the optimal format on a case-by-case basis. So if a client (web browser) supports AVIF, then generally an AVIF will be served. Pixboost uses Accept HTTP header to determine supported formats.</p><p>Let’s imagine that you have an image on your website that you currently serve as follows:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/718ff2ef2bedf5b89bd7c5704649952e/href">https://medium.com/media/718ff2ef2bedf5b89bd7c5704649952e/href</a></iframe><p>To leverage the full power of AVIF with Pixboost, you can simply wrap the source URL like so:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2c1a69da22acbb56de746d8d45ffe38e/href">https://medium.com/media/2c1a69da22acbb56de746d8d45ffe38e/href</a></iframe><p>From this moment on, your image will be served in the optimal format!</p><p>Note that we currently have two limitations with respect to AVIF files:</p><ul><li>Source images cannot be larger than 1024x1024 pixels, which is related to memory consumption. We are working on a solution for this and will have it fixed soon.</li><li>Transparent source images aren’t supported at the moment. This was a limitation of ImageMagick, which is used by Pixboost on the backend. ImageMagick actually already <a href="https://github.com/ImageMagick/ImageMagick/pull/2487">merged our pull request</a> related to the issue, though, so we just need to update to the new version on our side. This will be done in the coming weeks.</li></ul><h3>Conclusion</h3><p>AVIF is a great addition to the Web, and I think it’ll soon see wide adoption since in most cases, it produces images that are much smaller than the JPEG/PNG/WebP formats. After all, smaller website images allow you to support users with slower Internet connections and also have a positive impact on SEO.</p><p>But at the moment adding AVIF support is a bit of a hassle. However, you can avoid the hassle by simply using a third-party service like the Pixboost CDN. By the way, if you’d like to learn more about the AVIF format, I’d highly recommend watching this video by Google engineers:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FF1kYBnY6mwg%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DF1kYBnY6mwg&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FF1kYBnY6mwg%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/1eaa9f31d819bf6a346744f8f6a47797/href">https://medium.com/media/1eaa9f31d819bf6a346744f8f6a47797/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3a0a6d2936eb" width="1" height="1" alt=""><hr><p><a href="https://medium.com/pixboost/load-your-images-faster-with-the-next-gen-avif-format-3a0a6d2936eb">Load Your Images Faster with the Next-Gen AVIF Format</a> was originally published in <a href="https://medium.com/pixboost">pixboost</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Web Performance News, July 2020]]></title>
            <link>https://medium.com/pixboost/web-performance-news-july-2020-3244a11f46e?source=rss----8849ed16d3e1---4</link>
            <guid isPermaLink="false">https://medium.com/p/3244a11f46e</guid>
            <category><![CDATA[perfmatters]]></category>
            <category><![CDATA[web-performance]]></category>
            <dc:creator><![CDATA[Dmitry Pokidov]]></dc:creator>
            <pubDate>Wed, 22 Jul 2020 02:24:33 GMT</pubDate>
            <atom:updated>2020-07-22T02:24:33.373Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Fz-Xt-YRI1OXrXLl2LU_ew.png" /></figure><p><a href="https://webmasters.googleblog.com/2020/05/evaluating-page-experience.html">Google released a statement</a> about updates to its search ranking. It all goes back to Core Web Vitals and how they affect user experience. The other thing to note you won’t need the AMP version of your page to be featured in mobile’s search “Top Stories” feature which is a step forward in my mind!</p><p>We covered Core Web Vitals last time, and it’s getting more popular with more tooling becoming available. There is a <a href="https://chrome.google.com/webstore/detail/web-vitals/ahfhijdlegdabablpippeagghigmibma?hl=en">Chrome plugin</a> now that could give you instant scores for the page. There is also a new <a href="https://web.dev/vitals-measurement-getting-started/">article about how you can measure</a> core web vitals for your site right now.</p><p><a href="https://twitter.com/dev_starikov">@dev_starikov</a> wrote an <a href="https://medium.com/better-programming/do-not-burn-you-cpu-working-with-css-animations-e4d19069fb0f">impressive piece</a> on CSS animations and how some time you’d need to decide between visual and performance.</p><p><a href="https://twitter.com/DebugBear">@DebugBear</a> did <a href="https://www.debugbear.com/blog/2020-chrome-extension-performance-report#performance-impact-of-the-top-1000-extensions">fantastic research</a> on Chrome Extensions and how they contribute to the Web performance. Have a look and think of replacing the slow ones! What I also found is you could disable auto load for some of the extensions, so you would need to click on it to activate it. For instance, I could do that for LastPass.</p><p><a href="https://developer.apple.com/documentation/safari-release-notes/safari-14-beta-release-notes">Apple released a beta version of Safari 14</a> with some significant features added. For me, WebP and HTTP/3 support are the most remarkable. But there are many more here.</p><p><a href="https://twitter.com/hdjirdeh">Houssein Djirdeh</a> made an outstanding web app called <a href="https://perf-track.web.app/">“Perf Track”</a>, which shows how different web frameworks perform. The app could be a great input for your new project when you can’t decide what framework to use :)</p><p><a href="https://web.dev/native-lazy-loading/#improved-data-savings-and-distance-from-viewport-thresholds">Native images lazy loading</a> gets some improvements in the latest Chrome release. So far we were still recommending using intersection observer with JS for lazy loading but looks like this is going to change soon.</p><p>Stay safe, Pixboost Team.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3244a11f46e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/pixboost/web-performance-news-july-2020-3244a11f46e">Web Performance News, July 2020</a> was originally published in <a href="https://medium.com/pixboost">pixboost</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Web Performance News, May 2020]]></title>
            <link>https://medium.com/pixboost/web-performance-news-april-2020-ba87bfd567f3?source=rss----8849ed16d3e1---4</link>
            <guid isPermaLink="false">https://medium.com/p/ba87bfd567f3</guid>
            <category><![CDATA[web-performance]]></category>
            <category><![CDATA[web-perf]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Dmitry Pokidov]]></dc:creator>
            <pubDate>Thu, 28 May 2020 15:17:26 GMT</pubDate>
            <atom:updated>2020-05-29T00:59:26.158Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*U7L54YKS-vUjb4x3YmgbqA.png" /></figure><p>Hey there,</p><p>There were some big announcements and updates in May. Let’s dive into it!</p><p>The new major version of <a href="https://web.dev/lighthouse-whats-new-6.0/">Lighthouse</a> has been released. TADAAM! Lighthouse is one of the most popular tools to measure web performance. In the link above you’ll find what’s changed and why the score is different now. There is also a new version of <a href="https://github.com/GoogleChrome/lighthouse-ci/releases/tag/v0.4.0">Lighthouse CI</a> available and we updated the <a href="https://github.com/Pixboost/lighthouse-ci-docker/releases">docker image</a> that we use to run tests continuously on pixboost.com.</p><p><a href="https://web.dev/vitals/">Google did a GOODle</a> and released a new set of metrics that impacts users the most. They called them Web Vitals. The core set includes just 3 items that you are measuring on the real users opposed to synthetic metrics from tools like Lighthouse. I really love an idea of simplifying the web performance and making it accessible for everyone: “Site owners should not have to be performance gurus in order to understand the quality of experience they are delivering to their users. The Web Vitals initiative aims to simplify the landscape, and help sites focus on the metrics that matter most, the Core Web Vitals.”. If you are interested in the story behind the metrics then you’ll find <a href="https://blog.chromium.org/2020/05/the-science-behind-web-vitals.html">this link interesting</a>.</p><p>@<a href="https://twitter.com/hdjirdeh">hdjirdeh</a> and <a href="http://twitter.com/addyosmani">@addyosmani</a> wrote about <a href="https://web.dev/optimize-fid/">optimising First Input Delay (FID) metric</a>. Worth to mention that it’s one of the metrics from Core Web Vitals. You’ll find good advice on how to tame JS execution on your web pages.</p><p>Keeping subject of metrics hot <a href="https://twitter.com/NicPenaM">@nicpenam</a> did an amazing job by <a href="https://chromium.googlesource.com/chromium/src/+/master/docs/speed_metrics/README.md">creating a website</a> with links to useful docs from Chromium Speed Metrics team!</p><p><a href="https://blog.chromium.org/2020/05/resource-heavy-ads-in-chrome.html?m=1">Chromium launched a new way of blocking ads</a> that consumes too much resources on your device. This will eventually land on Chrome around August. I think this is a good step forward to make the Internet a better place.</p><p><a href="https://medium.com/u/c9c867cd3209">Tim Kadlec</a> wrote an awesome piece on “<a href="https://timkadlec.com/remembers/2020-04-21-the-cost-of-javascript-frameworks/">The Cost of Javascript Frameworks</a>”. In the article he is using the real numbers from HTTP Archive to compare the big 4 — JQuery, React, Angular and Vue.js. The questions in conclusion are right on point and I enjoyed reading the blog. Sadly said, in my experience performance becomes important only once the first release is shipped. We need to change this mentality! And to add to this <a href="https://twitter.com/scottjehl">@scottjehl</a> posted a tweet that shows a stat with median web page size on the Internet just passed 2MB:</p><h3>Scott Jehl on Twitter</h3><p>According to httparchive, March marked the first time the median webpage size surpassed 2 megabytes... a big (but not necessarily good) milestone. Good to also keep in mind that many (most?) of the popular sites on the web are heavier than that median. https://t.co/CsrOCFNkbm</p><p>That’s it for today. Stay safe and load fast!</p><p><a href="https://pixboost.com/performance-newsletter.html">You could also subscribe to this newsletter to receive a copy on your email.</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ba87bfd567f3" width="1" height="1" alt=""><hr><p><a href="https://medium.com/pixboost/web-performance-news-april-2020-ba87bfd567f3">Web Performance News, May 2020</a> was originally published in <a href="https://medium.com/pixboost">pixboost</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Web Performance News, April 2020]]></title>
            <link>https://medium.com/pixboost/web-performance-news-april-2020-71cb6995ca94?source=rss----8849ed16d3e1---4</link>
            <guid isPermaLink="false">https://medium.com/p/71cb6995ca94</guid>
            <category><![CDATA[web-performance]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[perfmatters]]></category>
            <dc:creator><![CDATA[Dmitry Pokidov]]></dc:creator>
            <pubDate>Wed, 22 Apr 2020 01:38:35 GMT</pubDate>
            <atom:updated>2020-04-22T02:43:38.556Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fwV2FDK7IYB8jsFEoUgl_g.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@notaphotographer?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Kayle Kaupanger</a> on <a href="https://unsplash.com/s/photos/performance-engine?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>Hey there,</p><p>We skipped March because it was crazy! Our priority was to keep ourselves and close ones safe. We hope that all the curves will be flattened soon!</p><p>We’ve got quite a few blogs and videos in our April edition. So, let’s check them out!</p><p>One of the biggest web performance events is #PerfMatters Conference and it happened in April! It was fully remote this year, and you could find pretty much every video on <a href="https://www.youtube.com/results?search_query=%23PerfMatters+Conference+2020">youtube using “#PerfMatters Conference 2020” search term</a>. My favourites so far are</p><p>Responsive Images for the Web by @TheGreenGreek:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FXecoxR1ckbc%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DXecoxR1ckbc&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FXecoxR1ckbc%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/5e1fc560a7a839be76276d8a7c03cc4c/href">https://medium.com/media/5e1fc560a7a839be76276d8a7c03cc4c/href</a></iframe><p>Understanding Cumulative Layout Shift by @anniesullie:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fvideoseries%3Flist%3DPLSmH2HL6l9pwQmSgpKFtWiISOXua3zq8I&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DzIJuY-JCjqw&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FzIJuY-JCjqw%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/811dbf16d69d7892b83bd501a0afed35/href">https://medium.com/media/811dbf16d69d7892b83bd501a0afed35/href</a></iframe><p><a href="https://twitter.com/robinrendle">@robinrendle</a> created a neat web performance checklist that you could find and use <a href="https://www.notion.so/Web-performance-checklist-02fbc975d9bd432993bdadce73de1b17">here</a>. I found it quite comprehensive and detailed! Highly recommend using for your every web project!</p><p>A New major version of <a href="https://developers.google.com/web/tools/lighthouse/">Lighthouse</a> is coming, and things are going to change! Read this awesome blog by <a href="https://twitter.com/@fox">@fox</a> about <a href="https://calibreapp.com/blog/lighthouse-changes-scoring-algorithm">scoring algorithm changes</a>.</p><p><a href="https://twitter.com/tunetheweb">@tunetheweb</a> published a <a href="https://www.smashingmagazine.com/2020/03/setting-height-width-images-important-again/">very detailed article</a> on why you should set width and height on your images and how to avoid layout shifts.</p><p>This is not an article, but a new feature in Chrome Dev Tools, which I think is very important — you can now simulate different types of colour blindness!</p><h3>Mathias Bynens on Twitter</h3><p>New accessibility feature in @ChromeDevTools: simulate vision deficiencies, including blurred vision &amp;amp; various types of color blindness. 🔥 Find out how people with vision deficiencies experience your web app, and resolve contrast issues you didn&#39;t even know you had! https://t.co/QKLQmEhhMM</p><p>That’s it for today. I hope you liked it. To not miss future releases subscribe on our email newsletter <a href="https://pixboost.com/performance-newsletter.html">here</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=71cb6995ca94" width="1" height="1" alt=""><hr><p><a href="https://medium.com/pixboost/web-performance-news-april-2020-71cb6995ca94">Web Performance News, April 2020</a> was originally published in <a href="https://medium.com/pixboost">pixboost</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Connect private AWS S3 bucket to Pixboost]]></title>
            <link>https://medium.com/pixboost/connect-private-aws-s3-bucket-to-pixboost-a56074fd03c?source=rss----8849ed16d3e1---4</link>
            <guid isPermaLink="false">https://medium.com/p/a56074fd03c</guid>
            <category><![CDATA[perfmatters]]></category>
            <category><![CDATA[s3]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[web-performance]]></category>
            <category><![CDATA[image-cdn]]></category>
            <dc:creator><![CDATA[Dmitry Pokidov]]></dc:creator>
            <pubDate>Wed, 08 Apr 2020 20:15:20 GMT</pubDate>
            <atom:updated>2020-04-08T20:15:19.924Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2rK5p_zSBhq5h8DSbh5llw.png" /><figcaption>Photo by <a href="https://unsplash.com/@freeyorker?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Samur Isma</a> on <a href="https://unsplash.com/s/photos/buckets?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>Hi there,</p><p>I’m pleased to announce today a new feature that we released last week — connecting AWS S3 bucket to your Pixboost account!</p><p>So, why would you want to do that? Before we implemented this feature, the way to use Pixboost with S3 bucket was to make S3 bucket public and use public URLs with Pixboost API. For instance, if all your images are in a bucket called “bucket-with-images” in the Australian region (ap-southeast-2) then Pixboost API call would look like:</p><blockquote>https://pixboost.com/api/2/img/https://s3-ap-southeast-2.amazonaws.com/bucket-with-images/image.png/optimise?auth=your-api-key</blockquote><p>And this is a fine way of doing so. However, there could be some legitimate security concerns with the approach above:</p><ul><li>An attacker could see a bucket name from the URL</li><li>The bucket must have public access turned on</li></ul><p>In many enterprise organisations, there is a taboo on public S3 buckets. And that’s a good thing — there is no “too much” security if you deal with personal or financial data! So, let’s draw the solution we came up with:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zgLi4Wz9wf1orxbfPAm0sA.png" /></figure><p>Using the schema from the picture above, we solved both problems that we had:</p><ul><li>We use an alias instead of direct URL, so the name of the bucket is not a part of API call</li><li>Pixboost is using separate IAM user to access the bucket, so it doesn’t need to have public access</li></ul><p>Now let’s see how to connect S3 to your Pixboost account.</p><h3>Setting up</h3><h4>AWS</h4><p>We assume that you already have S3 bucket with your images stored there. If not, then you can read how to do that<a href="https://docs.aws.amazon.com/AmazonS3/latest/user-guide/create-bucket.html"> here</a>.</p><p>To set up a new user that you’ll integrate with Pixboost:</p><ul><li>Create a new<a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_users_create.html"> IAM user</a></li><li><a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html">Add new credentials</a> for the user.</li><li><a href="https://docs.aws.amazon.com/AmazonS3/latest/user-guide/add-bucket-policy.html">Update or create a bucket policy</a> and give the user s3:ListBucket and s3:GetObject permissions.</li></ul><p>Below is an example of a bucket policy:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e5363db13d46452edd7f42e085c2d304/href">https://medium.com/media/e5363db13d46452edd7f42e085c2d304/href</a></iframe><h4>Pixboost</h4><ol><li>Once you log in, there is a new panel called “Images Sources”. That’s where all your integrations will be! Click on “Add source”.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jebhRaOyQLBXonW5Rc0QMQ.png" /></figure><p>2. Select “Amazon AWS S3 Bucket” in “Type” dropdown and fill in the details</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WCiJFnggbwm1nCaYtUKgzQ.png" /></figure><p>Let’s quickly go through each field and see what it’s for:</p><ul><li><em>Alias</em> is a unique identifier of the source that will be used in the URL when calling API</li><li><em>Bucket name</em> is the name of a bucket</li><li><em>Region</em> is an AWS region ID of the bucket</li><li><em>Path Prefix</em> is an optional prefix that will be used for all requests. It could be used if all your images in the bucket stored in one folder. In that case, you could set “Path prefix”, and you won’t need to add it to each API call.</li><li><em>Access Key</em> is an AWS IAM user’s access key created in the step above.</li><li><em>Secret Key</em> is an AWS IAM user’s secret key created in the step above</li></ul><p>3. Click “Add”, and you are done!</p><h3>Testing</h3><p>The last but not least step is testing! So, let’s fire up an API call and check that integration works:</p><blockquote>https://pixboost.com/api/2/img/bucket/&lt;PATH_TO_THE_IMAGE&gt;/optimise?auth=&lt;API_KEY&gt;</blockquote><p>In response we should see our optimised image.</p><h3>What’s next?</h3><p>It’s worth mentioning that we developed not just S3 integration but “Images Source“ abstraction that allows us to easily plugin other types of sources. Stay tuned as we are going to release more integrations very soon!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a56074fd03c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/pixboost/connect-private-aws-s3-bucket-to-pixboost-a56074fd03c">Connect private AWS S3 bucket to Pixboost</a> was originally published in <a href="https://medium.com/pixboost">pixboost</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Web Performance News, February 2020]]></title>
            <link>https://medium.com/pixboost/web-performance-news-february-2020-5fb771ba2ed8?source=rss----8849ed16d3e1---4</link>
            <guid isPermaLink="false">https://medium.com/p/5fb771ba2ed8</guid>
            <category><![CDATA[web]]></category>
            <category><![CDATA[perfmatters]]></category>
            <category><![CDATA[web-perf]]></category>
            <category><![CDATA[web-performance]]></category>
            <dc:creator><![CDATA[Dmitry Pokidov]]></dc:creator>
            <pubDate>Sun, 23 Feb 2020 23:42:45 GMT</pubDate>
            <atom:updated>2020-02-23T23:42:45.277Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*krGwOH60q8xi4ReaQ1hnkg.png" /><figcaption>Slide from @bagder talk on HTTP/3</figcaption></figure><p>Hey there,</p><p>February was a real storm of exciting things around web performance. So, let’s go straight to it!</p><p><a href="https://csswizardry.com/2020/01/performance-budgets-pragmatically/">Performance Budgets, Pragmatically</a>- <a href="https://twitter.com/csswizardry">@csswizardry</a> wrote a short, but very practical guide about where to start with performance budgeting and how to come up with the initial numbers.</p><p><a href="https://www.tunetheweb.com/blog/should-you-self-host-google-fonts/">Should you self-host Google Fonts?</a> — That’s a very detailed guide written by <a href="https://twitter.com/@tunetheweb">@tunetheweb</a> on how Google Web Fonts loading works and all pros and cons around self-hosting those and cutting on their load time. We are currently thinking of doing so on Pixboost website, but in the “test test test” phase right now :)</p><p><a href="http://www.shopify.com/partners/blog/web-performance">Web Performance: 11 Must-Read Tips to Give Your Site a Speed Boost</a> — <a href="https://twitter.com/@oliverlindberg">@oliverlindberg</a> wrote a perfect practical intro about what to look at when starting to deal with web performance. And guess what? Optimizing images and lazy load images are on 3rd and 4th places. I would recommend going through the article if you’d like to speed up your website.</p><p><a href="https://fosdem.org/2020/schedule/track/web_performance/">Videos from FOSDEM Web Performance Dev Room</a> — FOSDEM 2020 took place on 1st and 2nd of February this year, and there was a separate dev room for web performance! All the videos are available! I would highly recommend watching all of them. My favourites are on OpenSpeedMonitor (it’s fantastic, check it out!) and HTTP resource prioritization.</p><p><a href="https://daniel.haxx.se/blog/2020/02/02/http-3-for-everyone/">HTTP/3 for everyone</a> — <a href="https://twitter.com/@bagder">@bagder</a> published a video, slides and wrote a quick intro from his awesome talk at Fosdem this year. HTTP/3 is coming, and I would recommend everyone in the Web industry to start looking and understanding what it is.</p><p><a href="https://speedcurve.com/blog/web-performance-resolutions/">Six web performance resolutions for the new year</a> — if you work in a big organization and wondering how to justify spending money on web performance then this article from <a href="https://twitter.com/@SpeedCurve">@SpeedCurve</a> is for you!</p><p><a href="https://css-tricks.com/innovation-cant-keep-the-web-fast/">Innovation Can’t Keep the Web Fast</a> — <a href="https://twitter.com/@malchata">@malchata</a> wrote an excellent post on how technologies are getting better and yet we are still building slower websites and hoping that 5G and HTTP/3 will fix them.</p><p><a href="https://textslashplain.com/2020/02/09/demystifying-browsers/">Demystifying Browsers</a> — if you ever wondered how web browsers work, where their source code is who is building them then <a href="https://twitter.com/@ericlaw">@ericlaw</a> got you covered! This post has all the links starting with comics about Chrome and ending up with a list of twitter accounts of core developers.</p><p>SSL certificates and web performance — <a href="https://twitter.com/@TheRealNooshu">@TheRealNooshu</a> and <a href="https://twitter.com/@aaronpeters">@aaronpeters</a> wrote two blogs about SSL certificates and how they affect web performance. You’ll find what types of certificates are used now and how they are different when browsers are verifying them — “<a href="https://nooshu.github.io/blog/2020/01/26/the-impact-of-ssl-certificate-revocation-on-web-performance/">The impact of SSL certificate revocation on web performance</a>” and <a href="https://www.aaronpeters.nl/blog/ev-certificates-make-the-web-slow-and-unreliable/">EV Certificates Make The Web Slow and Unreliable</a></p><p>And here is some browser updates from the trenches:</p><p><a href="https://trac.webkit.org/changeset/254669/webkit/">Safari will support width/height based aspect ratio for images</a> — the change has already landed into WebKit, so should be available soon in Safari. The change will allow avoiding unnecessary layout reflows on the page. Watch this video for more information about the feature — <a href="https://www.youtube.com/watch?v=4-d_SoCHeWE">https://www.youtube.com/watch?v=4-d_SoCHeWE</a></p><p>This is it for today, stay tuned and subscribe to our email newsletter <a href="https://pixboost.com/performance-newsletter.html">here</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5fb771ba2ed8" width="1" height="1" alt=""><hr><p><a href="https://medium.com/pixboost/web-performance-news-february-2020-5fb771ba2ed8">Web Performance News, February 2020</a> was originally published in <a href="https://medium.com/pixboost">pixboost</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Web Performance News, January 2020]]></title>
            <link>https://medium.com/pixboost/web-performance-news-january-2020-b2e29c8cf5c?source=rss----8849ed16d3e1---4</link>
            <guid isPermaLink="false">https://medium.com/p/b2e29c8cf5c</guid>
            <category><![CDATA[web-performance]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Dmitry Pokidov]]></dc:creator>
            <pubDate>Tue, 14 Jan 2020 20:40:42 GMT</pubDate>
            <atom:updated>2020-01-14T20:40:42.354Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fbSTtiIzXq1Pt-8yIus93Q.png" /><figcaption>CRP steps by Rodolfo Gonçalves. Source: <a href="https://itnext.io/high-performance-web-apps-2a469cfd3550">https://itnext.io/high-performance-web-apps-2a469cfd3550</a></figcaption></figure><p>Aloha everyone!</p><p>While some of us were resting during the festive season (totally me), others were writing blog posts! December and start of January were hot on good content. So, let’s get ball rolling:</p><p><a href="https://www.machmetrics.com/speed-blog/google-planning-a-new-badge-of-shame-for-slow-websites">Google planning a new ‘Badge of Shame’ for slow websites</a> — <a href="https://twitter.com/MachMetrics">MachMetrics</a> wrote about plans that Google has in regards to introduce an indicator for slow/fast websites. In this blog, you’ll find the author’s thoughts and links to the various discussions in the community.</p><p><a href="https://calibreapp.com/blog/get-started-with-performance">Getting Started with Web Performance</a> — <a href="https://twitter.com/fox">@fox</a> wrote a fantastic intro to “Web Performance”. If you are new to the subject and wondering what it is all about, then you should check it out.</p><p><a href="https://www.smashingmagazine.com/2020/01/front-end-performance-checklist-2020-pdf-pages/">Front-End Performance Checklist 2020</a> — <a href="https://twitter.com/smashingmag">Smashing Magazine</a> released its front end performance checklist 2020 editions. It covers all aspects of web performance from A to Z. I would recommend reading the whole thing for anyone who is touching web dev.</p><p><a href="https://nooshu.github.io/blog/2019/10/02/how-to-read-a-wpt-waterfall-chart/">How to read a WebPageTest Waterfall View chart</a> — <a href="https://twitter.com/TheRealNooshu">@TheRealNooshy</a> wrote an in-depth guide on waterfall charts that you get from WebPageTest. If you haven’t used <a href="https://webpagetest.org/">webpagetest.org</a> before, it’s a good time to start! It’s the essential tool in the web performance toolbox.</p><p><a href="https://medium.com/@rodolfogonalves/high-performance-web-apps-2a469cfd3550">High Performance Web Apps</a> — <a href="https://twitter.com/orenciorodolfo">@orenciorodolfo</a> wrote a blog about how browsers are rendering the page, what is “Critical Rendering Path” and what you could do to start showing your page faster. I found this one to be very explanatory with amazing illustrations. It describes complex things in a straightforward and clear way.</p><p><a href="https://twitter.com/digitalclubb/status/1199971461424910336?s=19">Improving third-party web performance</a> — <a href="https://twitter.com/digitalclubb">@digitalclubb</a> shared slides from the presentation he did. You’ll find out what processes you need to introduce in your project to get 3rd party dependencies under control.</p><p>Some other news:</p><p><a href="https://paul.kinlan.me/correct-image-orientation-for-images-chrome-81/">Correct Image Orientation in Chrome</a> — <a href="https://twitter.com/Paul_Kinlan">@Paul_Kinlan</a> announced that image orientation bug got fixed and will be shipped in version 81 of the browser. Long story short, Chrome will use orientation from an image EXIF metadata to show if it’s not set in image-orientation CSS attribute.</p><p>This is it for now. Follow us on <a href="https://medium.com/pixboost">Medium</a> or subscribe to the <a href="https://pixboost.com/performance-newsletter.html">email newsletter</a> to not miss new episodes!</p><p>Stay safe and load fast!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b2e29c8cf5c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/pixboost/web-performance-news-january-2020-b2e29c8cf5c">Web Performance News, January 2020</a> was originally published in <a href="https://medium.com/pixboost">pixboost</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Web Performance News, December 2019]]></title>
            <link>https://medium.com/pixboost/web-performance-news-december-2019-1a7fe0c3d679?source=rss----8849ed16d3e1---4</link>
            <guid isPermaLink="false">https://medium.com/p/1a7fe0c3d679</guid>
            <category><![CDATA[newsletter]]></category>
            <category><![CDATA[web-performance]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[web]]></category>
            <dc:creator><![CDATA[Dmitry Pokidov]]></dc:creator>
            <pubDate>Mon, 09 Dec 2019 10:10:58 GMT</pubDate>
            <atom:updated>2019-12-09T10:10:58.120Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S-PbDPB19OqaU1W88X2Rtw.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@jeremymcknight?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Jeremy McKnight</a> on <a href="https://unsplash.com/s/photos/sleigh?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>The festive season is on its way, so, to save you from boredom while away from a keyboard, we are sending you a December edition of our Web Performance Newsletter.</p><p><strong>Important update</strong> — to not miss a new edition of this newsletter you can now <a href="https://pixboost.com/performance-newsletter.html#mc_embed_signup_scroll">subscribe to it</a>. We are planning to send a new one every month or two.</p><p>We don’t have much experience with newsletters and your feedback is very important for us. If you have any suggestion or found a typo, please drop me a line at dmitry.pokidov@pixboost.com.</p><p>And here we go!</p><ul><li><a href="https://twitter.com/simonhearne">@simonhearne</a> wrote his #webperf prediction for 2020: <a href="https://simonhearne.com/2019/2020-predictions/">https://simonhearne.com/2019/2020-predictions/</a>. Definitely, have a look, there are some surprises there! I could only guess Web Assembly :)</li><li><a href="https://twitter.com/stoyanstefanov">@stoyanstefanov</a> published 2019 Web Performance Calendar again! I would like to recommend to read each and every post from it, including previous years — <a href="https://calendar.perfplanet.com/2019/">https://calendar.perfplanet.com/2019/</a>. My favourite is about images, of course — <a href="https://calendar.perfplanet.com/2019/the-ugly-truth-about-optimising-beautiful-images/">https://calendar.perfplanet.com/2019/the-ugly-truth-about-optimising-beautiful-images/</a>.</li><li>Instagram Engineer <a href="https://twitter.com/mr_sharpoblunto">@mr_sharpoblunto</a> wrote a series of posts about making instagram.com faster: <a href="https://instagram-engineering.com/making-instagram-com-faster-part-1-62cc0c327538">Part 1</a>, <a href="https://instagram-engineering.com/making-instagram-com-faster-part-2-f350c8fba0d4">Part 2</a>, <a href="https://instagram-engineering.com/making-instagram-com-faster-part-3-cache-first-6f3f130b9669">Part 3</a>, <a href="https://instagram-engineering.com/making-instagram-com-faster-code-size-and-execution-optimizations-part-4-57668be796a8">Part 4</a>.</li><li><a href="http://httparchive.org/">HTTPArchive</a> published the 2019 edition of their <a href="https://almanac.httparchive.org/en/2019/">Web Alamanac</a>. They tested 5.8 millions of websites and collected all the facts about them. For instance, did you know that almost half of the requests are still using HTTP/1.1?</li></ul><p>Some industry news that we found important:</p><ul><li>This one is a biggie — Safari now supports <a href="https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API">Intersection Observer</a>! Intersection Observer is a relatively new Web API for lazy loading content on the page. At Pixboost we are using it in our pixboost.js and pixboost-react libraries. My biggest problem with Intersection Observer was a polyfill that is quite buggy and most of the time we preferred to not use lazy loading at all if Intersection Observer was not available on the browser.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ZN1xrASowl8ZRx6c" /></figure><ul><li>Safari has just implemented Intersection Observer API, but there is a new version of spec coming: <a href="https://developers.google.com/web/updates/2019/02/intersectionobserver-v2">https://developers.google.com/web/updates/2019/02/intersectionobserver-v2</a>. The latest version is not a full rewrite, but adding some additional functionality to better track visibility of the elements.</li><li>Chrome is implementing a change to calculate image dimensions before loading it so that page layout won’t be affected. Worth to mention that Firefox already has this upgrade. To be ready just add <strong>width</strong> and <strong>height</strong> attributes to your &lt;img&gt; and &lt;video&gt; elements. <a href="https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/hbhKRuBzZ4o">Google Group discussion</a> and <a href="https://github.com/WICG/intrinsicsize-attribute/issues/16#issuecomment-500941775">explanation</a> from <a href="https://twitter.com/jensimmons">@jensimmons</a>:</li><li>In case you missed it, Google is using page speed as a ranking factor on the mobile search since 2018. Here is a quick summary of how that decision <a href="https://webmasters.googleblog.com/2019/04/user-experience-improvements-with-page.html?m=1">influenced the Web</a> so far.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1a7fe0c3d679" width="1" height="1" alt=""><hr><p><a href="https://medium.com/pixboost/web-performance-news-december-2019-1a7fe0c3d679">Web Performance News, December 2019</a> was originally published in <a href="https://medium.com/pixboost">pixboost</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>