<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Shiva</title>
    <description>The latest articles on DEV Community by Shiva (@shiva_4a95d759a3578dbb8dd).</description>
    <link>https://dev.to/shiva_4a95d759a3578dbb8dd</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4202519%2F38f1fbbc-1ef9-45e1-adfb-1128bd28fa0c.png</url>
      <title>DEV Community: Shiva</title>
      <link>https://dev.to/shiva_4a95d759a3578dbb8dd</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/shiva_4a95d759a3578dbb8dd"/>
    <language>en</language>
    <item>
      <title>Image Optimization for Blogs: A Practical HTML and Performance Checklist</title>
      <dc:creator>Shiva</dc:creator>
      <pubDate>Fri, 23 Oct 2026 11:59:21 +0000</pubDate>
      <link>https://dev.to/shiva_4a95d759a3578dbb8dd/image-optimization-for-blogs-a-practical-html-and-performance-checklist-1cdh</link>
      <guid>https://dev.to/shiva_4a95d759a3578dbb8dd/image-optimization-for-blogs-a-practical-html-and-performance-checklist-1cdh</guid>
      <description>&lt;p&gt;A blog image can explain a complicated idea in seconds. It can also become the heaviest resource on the page.&lt;/p&gt;

&lt;p&gt;Image optimization involves several decisions: choosing useful visuals, exporting suitable files, delivering the right resolution, and controlling when the browser loads them.&lt;/p&gt;

&lt;p&gt;Here is a practical workflow for developers and bloggers who want sharper images without unnecessary downloads.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Disclosure: I run Shiva Lord Image, which publishes the two supplementary guides linked below.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Start with an image that helps the reader
&lt;/h2&gt;

&lt;p&gt;Before compressing anything, ask what the image contributes.&lt;/p&gt;

&lt;p&gt;A screenshot should show the interface relevant to the instructions. A diagram should explain a relationship that would take longer to describe in text. Decorative images should earn their place.&lt;/p&gt;

&lt;p&gt;For screenshots:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Capture only the relevant window or interface.&lt;/li&gt;
&lt;li&gt;Remove personal information, API keys, and account details.&lt;/li&gt;
&lt;li&gt;Crop empty space.&lt;/li&gt;
&lt;li&gt;Keep labels readable at the size readers will actually see.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you use an image from elsewhere, establish its source and permission for reuse. Finding it in a search engine does not establish ownership or a license.&lt;/p&gt;

&lt;p&gt;The &lt;a href="https://shivalordimage.com/image-search-techniques/" rel="noopener noreferrer"&gt;image search techniques guide on Shiva Lord Image&lt;/a&gt; explains ways to investigate earlier appearances and image context. Treat reverse-search results as clues, then verify permission at the source.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Compare formats using the actual image
&lt;/h2&gt;

&lt;p&gt;There is no single winning format for every visual.&lt;/p&gt;

&lt;p&gt;Useful starting points include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;PNG:&lt;/strong&gt; screenshots and graphics where preserving exact details matters.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SVG:&lt;/strong&gt; suitable vector illustrations, diagrams, and icons.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;WebP or AVIF:&lt;/strong&gt; candidates worth comparing for photographs and other raster images.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;JPEG:&lt;/strong&gt; another option for photographic content.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Compare exported files visually and by size. A photograph and a screenshot containing small text can respond very differently to the same compression settings.&lt;/p&gt;

&lt;p&gt;MDN’s &lt;a href="https://developer.mozilla.org/en-US/docs/Web/Media/Guides/Formats/Image_types" rel="noopener noreferrer"&gt;image format guide&lt;/a&gt; provides a useful reference.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Resize deliberately, then compress
&lt;/h2&gt;

&lt;p&gt;A 4,000-pixel-wide source image does not need to be the only file available for an 800-pixel article column.&lt;/p&gt;

&lt;p&gt;However, exporting everything at exactly 800 pixels can make images look soft on higher-density displays. Keep the original and generate appropriate variants.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;480 pixels for smaller layouts.&lt;/li&gt;
&lt;li&gt;800 pixels for the article column.&lt;/li&gt;
&lt;li&gt;1,600 pixels when a higher-resolution version is useful.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These are example sizes, not universal requirements.&lt;/p&gt;

&lt;p&gt;After resizing, compress the variants and inspect text, gradients, edges, and transparency.&lt;/p&gt;

&lt;p&gt;For a more detailed introduction, the &lt;a href="https://shivalordimage.com/blog/png-optimization/" rel="noopener noreferrer"&gt;PNG optimization guide&lt;/a&gt; covers resizing, compression, and checking the exported result.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Give the browser responsive image candidates
&lt;/h2&gt;

&lt;p&gt;Use &lt;code&gt;srcset&lt;/code&gt; to describe available files and &lt;code&gt;sizes&lt;/code&gt; to describe their expected display width.&lt;/p&gt;

&lt;p&gt;This example assumes an article column capped at 800 pixels with 16-pixel margins on smaller screens:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;img&lt;/span&gt;
  &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"article-image"&lt;/span&gt;
  &lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"/images/dashboard-800.webp"&lt;/span&gt;
  &lt;span class="na"&gt;srcset=&lt;/span&gt;&lt;span class="s"&gt;"
    /images/dashboard-480.webp 480w,
    /images/dashboard-800.webp 800w,
    /images/dashboard-1600.webp 1600w
  "&lt;/span&gt;
  &lt;span class="na"&gt;sizes=&lt;/span&gt;&lt;span class="s"&gt;"(max-width: 832px) calc(100vw - 32px), 800px"&lt;/span&gt;
  &lt;span class="na"&gt;width=&lt;/span&gt;&lt;span class="s"&gt;"1600"&lt;/span&gt;
  &lt;span class="na"&gt;height=&lt;/span&gt;&lt;span class="s"&gt;"900"&lt;/span&gt;
  &lt;span class="na"&gt;loading=&lt;/span&gt;&lt;span class="s"&gt;"lazy"&lt;/span&gt;
  &lt;span class="na"&gt;alt=&lt;/span&gt;&lt;span class="s"&gt;"Analytics dashboard showing weekly visits by traffic source"&lt;/span&gt;
&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.article-image&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;block&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;100%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;max-width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;800px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;auto&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="py"&gt;margin-inline&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;auto&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create the referenced files before using this example. Each width descriptor must match its file’s actual width, and the variants should share the intended aspect ratio.&lt;/p&gt;

&lt;p&gt;Adjust &lt;code&gt;sizes&lt;/code&gt; to match your layout. The browser uses these hints together with device conditions to choose a candidate.&lt;/p&gt;

&lt;p&gt;See MDN’s &lt;a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Guides/Responsive_images" rel="noopener noreferrer"&gt;responsive images guide&lt;/a&gt; for more examples.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Give important images different loading behavior
&lt;/h2&gt;

&lt;p&gt;The previous example is intended for an image farther down the article.&lt;/p&gt;

&lt;p&gt;An important image visible when the page opens needs different treatment. If the hero image is the Largest Contentful Paint element, avoid lazy loading it.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;img&lt;/span&gt;
  &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"article-image"&lt;/span&gt;
  &lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"/images/article-hero.webp"&lt;/span&gt;
  &lt;span class="na"&gt;width=&lt;/span&gt;&lt;span class="s"&gt;"1600"&lt;/span&gt;
  &lt;span class="na"&gt;height=&lt;/span&gt;&lt;span class="s"&gt;"900"&lt;/span&gt;
  &lt;span class="na"&gt;fetchpriority=&lt;/span&gt;&lt;span class="s"&gt;"high"&lt;/span&gt;
  &lt;span class="na"&gt;alt=&lt;/span&gt;&lt;span class="s"&gt;"Diagram of an image optimization workflow"&lt;/span&gt;
&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Use high priority selectively. Marking every image as important removes the distinction.&lt;/p&gt;

&lt;p&gt;The &lt;a href="https://web.dev/articles/optimize-lcp" rel="noopener noreferrer"&gt;web.dev LCP guide&lt;/a&gt; explains why delayed discovery and loading can hurt performance.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Preserve layout and write useful alternatives
&lt;/h2&gt;

&lt;p&gt;Explicit &lt;code&gt;width&lt;/code&gt; and &lt;code&gt;height&lt;/code&gt; attributes let the browser reserve space before an image arrives. Responsive CSS can still scale it.&lt;/p&gt;

&lt;p&gt;For meaningful images, write alternative text that communicates their purpose in context. Avoid filling it with keywords.&lt;/p&gt;

&lt;p&gt;For a purely decorative image, an empty alternative can be appropriate:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;img&lt;/span&gt; &lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"/images/divider.svg"&lt;/span&gt; &lt;span class="na"&gt;alt=&lt;/span&gt;&lt;span class="s"&gt;""&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A complicated chart may also need a nearby explanation or data table.&lt;/p&gt;

&lt;h2&gt;
  
  
  7. Verify the delivered page
&lt;/h2&gt;

&lt;p&gt;After publishing to a test environment:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open the page at mobile and desktop widths.&lt;/li&gt;
&lt;li&gt;Inspect image requests in the browser’s Network panel.&lt;/li&gt;
&lt;li&gt;Confirm that suitable variants load.&lt;/li&gt;
&lt;li&gt;Check for visible movement as images appear.&lt;/li&gt;
&lt;li&gt;Identify the LCP element.&lt;/li&gt;
&lt;li&gt;Compare repeated measurements under consistent conditions.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Keep a small record of the original file, optimized file, transferred size, and visual result. That makes future decisions easier to evaluate.&lt;/p&gt;

&lt;p&gt;Which image problem appears most often in your projects: oversized screenshots, incorrect responsive sizes, or a hero image that loads too late?&lt;/p&gt;




&lt;p&gt;&lt;em&gt;AI disclosure: This article was drafted with AI assistance.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>performance</category>
      <category>html</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
