<?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: Imazeo</title>
    <description>The latest articles on DEV Community by Imazeo (imazeo).</description>
    <link>https://dev.to/imazeo</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%2Forganization%2Fprofile_image%2F15957%2Fffea4173-4fc0-44bc-b9d0-cc4fe4af6ebf.png</url>
      <title>DEV Community: Imazeo</title>
      <link>https://dev.to/imazeo</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/imazeo"/>
    <language>en</language>
    <item>
      <title>What's New in Imazeo: Website Screenshots, Document Previews, and Dynamic QR Codes</title>
      <dc:creator>MANISH BALODIA</dc:creator>
      <pubDate>Mon, 23 Nov 2026 06:38:24 +0000</pubDate>
      <link>https://dev.to/imazeo/whats-new-in-imazeo-website-screenshots-document-previews-and-dynamic-qr-codes-2on0</link>
      <guid>https://dev.to/imazeo/whats-new-in-imazeo-website-screenshots-document-previews-and-dynamic-qr-codes-2on0</guid>
      <description>&lt;p&gt;A web application can end up needing a surprising number of media features. Product thumbnails, PDF previews, screenshots of public pages, images of presentation slides, QR codes on printed material—the requirements are often small individually, but each one needs its own processing workflow.&lt;/p&gt;

&lt;p&gt;In our &lt;a href="https://dev.to/imazeo/how-to-optimize-images-for-the-web-without-guesswork-4nim"&gt;previous post about web image optimization&lt;/a&gt;, we focused on choosing suitable dimensions, formats, and quality settings. Since then, we've expanded &lt;a href="https://imazeo.com/" rel="noopener noreferrer"&gt;Imazeo&lt;/a&gt; to cover more of the media tasks that show up around an application.&lt;/p&gt;

&lt;p&gt;Here are the newer capabilities, why we built them, and a few details worth knowing before integrating them.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Capture public websites as images
&lt;/h2&gt;

&lt;p&gt;Sometimes you need an image of a webpage rather than the webpage itself: a preview in a dashboard, a visual reference in a report, or a snapshot of a public landing page.&lt;/p&gt;

&lt;p&gt;Imazeo's website capture tool now supports four capture modes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Viewport:&lt;/strong&gt; Capture the visible area at a chosen browser width and height.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Full page:&lt;/strong&gt; Capture content beyond the initial viewport, within output limits.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Element:&lt;/strong&gt; Capture a specific section using a CSS selector.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Region:&lt;/strong&gt; Capture a rectangle using explicit coordinates and dimensions.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Outputs can be PNG, JPEG, or WebP. You can also adjust browser size, image quality, color scheme, wait behavior, and animation handling.&lt;/p&gt;

&lt;p&gt;For example, a team maintaining a library of public landing-page references might use full-page captures, while a developer documenting a UI component might capture only the relevant element.&lt;/p&gt;

&lt;p&gt;There are practical boundaries: this is for &lt;strong&gt;public HTTP(S) pages&lt;/strong&gt;, not logged-in dashboards or private network destinations. Some sites block automated browsers, and very long pages may exceed size limits.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://imazeo.com/product/website-to-image/" rel="noopener noreferrer"&gt;Explore website capture&lt;/a&gt; · &lt;a href="https://imazeo.com/docs/conversions/" rel="noopener noreferrer"&gt;API options&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Turn Office documents into image previews
&lt;/h2&gt;

&lt;p&gt;File uploads are easy to store, but not always easy to preview.&lt;/p&gt;

&lt;p&gt;A user might upload a Word document, spreadsheet, or slide deck, while your application only needs to show one part of that file in a browser.&lt;/p&gt;

&lt;p&gt;Imazeo now supports:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Input&lt;/th&gt;
&lt;th&gt;What you can select&lt;/th&gt;
&lt;th&gt;Example use&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;DOCX&lt;/td&gt;
&lt;td&gt;A page&lt;/td&gt;
&lt;td&gt;Preview a document inside a content library&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;XLSX&lt;/td&gt;
&lt;td&gt;A sheet or cell range&lt;/td&gt;
&lt;td&gt;Display a report table without opening a spreadsheet&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;PPTX&lt;/td&gt;
&lt;td&gt;A slide&lt;/td&gt;
&lt;td&gt;Create a thumbnail for a presentation&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Each conversion produces an image in PNG, JPEG, or WebP. You can adjust relevant format-specific options such as page selection, scale, spreadsheet range, and output quality.&lt;/p&gt;

&lt;p&gt;One detail matters: a converted image is a &lt;strong&gt;preview&lt;/strong&gt;, not a guarantee of pixel-perfect compatibility with Microsoft Office. Fonts, complex layouts, and document features can affect the result. For important documents, inspect the output before publishing it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://imazeo.com/product/document-conversion/" rel="noopener noreferrer"&gt;Explore document conversion&lt;/a&gt; · &lt;a href="https://imazeo.com/docs/conversions/" rel="noopener noreferrer"&gt;Conversion guide&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Create QR codes that can change destination
&lt;/h2&gt;

&lt;p&gt;Static QR codes work well when the encoded content never needs to change. But what happens after a QR code has been printed on a menu, label, flyer, or product card?&lt;/p&gt;

&lt;p&gt;With a dynamic QR code, you keep the same printed artwork while updating its destination later.&lt;/p&gt;

&lt;p&gt;The basic workflow is:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create a dynamic link with a destination URL.&lt;/li&gt;
&lt;li&gt;Generate a QR code for the stable redirect URL returned by Imazeo.&lt;/li&gt;
&lt;li&gt;Print or publish the code.&lt;/li&gt;
&lt;li&gt;Change the destination in the workspace when needed—without replacing the QR image.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Depending on the plan, you can also enable scan tracking and inspect activity by day, device, browser, and available country information, with CSV export.&lt;/p&gt;

&lt;p&gt;That data needs to be interpreted carefully. Scan reports reflect recorded requests; repeated scans and automated visits may be included. They are &lt;strong&gt;not&lt;/strong&gt; guaranteed counts of unique people.&lt;/p&gt;

&lt;p&gt;The QR designer also supports customization such as colors, patterns, frames, captions, and logos. Regardless of appearance, good contrast and real-device scanning tests still matter.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://imazeo.com/product/code-generation/" rel="noopener noreferrer"&gt;Explore QR codes and barcodes&lt;/a&gt; · &lt;a href="https://imazeo.com/docs/dynamic-qr/" rel="noopener noreferrer"&gt;Dynamic QR API guide&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  4. What the API workflow looks like
&lt;/h2&gt;

&lt;p&gt;The new document and website conversion APIs are job-based. You don't send a request and assume the finished image will arrive immediately.&lt;/p&gt;

&lt;p&gt;Instead, the typical flow is:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Get a quote&lt;/strong&gt; for the requested processing operation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Submit&lt;/strong&gt; the file or public URL with the quote ID and an idempotency key.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Poll&lt;/strong&gt; the returned job ID until processing completes or fails.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Download&lt;/strong&gt; the image before its expiry, or save it privately to the project's Outputs.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For a website capture, the submission is a JSON request with a public URL. The following shows the request shape; it assumes you've already obtained a valid quote:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="na"&gt;POST /v1/projects/{projectId}/conversions/website?mode&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;viewport&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;width&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1440&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;height&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;900&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;format&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;webp&lt;/span&gt;
&lt;span class="no"&gt;X&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="no"&gt;API&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Key&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;YOUR_SERVER_SIDE_PROJECT_KEY&lt;/span&gt;
&lt;span class="no"&gt;X&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Quote&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="no"&gt;ID&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;YOUR_QUOTE_ID&lt;/span&gt;
&lt;span class="nc"&gt;Idempotency&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Key&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;A_NEW_UUID_V4&lt;/span&gt;
&lt;span class="nc"&gt;Content&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;application&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;json&lt;/span&gt;

&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"url"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"https://example.com/"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;An accepted conversion returns a job, not the finished file. Handle its status and expiry explicitly, and keep the project API key on your server—not in browser-side code.&lt;/p&gt;

&lt;p&gt;The same general quote-and-job pattern applies to Office document conversion. Dynamic QR links have their own create, update, and analytics endpoints.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://imazeo.com/docs/conversions/" rel="noopener noreferrer"&gt;Read the conversion API documentation&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  5. SDKs and n8n automation
&lt;/h2&gt;

&lt;p&gt;We also provide six server SDKs covering core image, PDF, QR code, and barcode operations:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;JavaScript/TypeScript, Python, PHP, Go, Java, and .NET.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;For workflow automation, there's an &lt;a href="https://imazeo.com/docs/sdks/" rel="noopener noreferrer"&gt;Imazeo n8n community node&lt;/a&gt; for supported image, PDF, QR, and barcode tasks on self-hosted n8n instances with community nodes enabled.&lt;/p&gt;

&lt;p&gt;A distinction worth mentioning: &lt;strong&gt;website/document conversion jobs and dynamic QR management currently use direct HTTP APIs&lt;/strong&gt;, rather than the same convenience methods available in the core SDKs and n8n node.&lt;/p&gt;

&lt;p&gt;That keeps the integration expectations clear while we continue building out the platform.&lt;/p&gt;

&lt;h2&gt;
  
  
  A few things we're trying to get right
&lt;/h2&gt;

&lt;p&gt;Adding more tools is useful only if they remain predictable in real projects. For these workflows, we're paying attention to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Clear input and output formats instead of hidden defaults.&lt;/li&gt;
&lt;li&gt;Project-scoped API access and server-side credentials.&lt;/li&gt;
&lt;li&gt;Documented limits and processing states.&lt;/li&gt;
&lt;li&gt;The ability to preview a result in the workspace or integrate through an API.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can explore the tools through the workspace, or start with the &lt;a href="https://imazeo.com/docs/" rel="noopener noreferrer"&gt;developer documentation&lt;/a&gt;. There's a Free plan for getting started; feature access and usage limits depend on the plan.&lt;/p&gt;

&lt;h2&gt;
  
  
  What's next?
&lt;/h2&gt;

&lt;p&gt;We're continuing to improve the experience around media processing and automation. If you've built document previews, screenshot workflows, or QR systems into an application, I'd be interested to know which parts were the most difficult to implement.&lt;/p&gt;

&lt;p&gt;You can find the platform at &lt;a href="https://imazeo.com/" rel="noopener noreferrer"&gt;imazeo.com&lt;/a&gt;, and the API guides at &lt;a href="https://imazeo.com/docs/" rel="noopener noreferrer"&gt;imazeo.com/docs&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>api</category>
      <category>showdev</category>
      <category>javascript</category>
    </item>
    <item>
      <title>How to Optimize Images for the Web Without Guesswork</title>
      <dc:creator>MANISH BALODIA</dc:creator>
      <pubDate>Mon, 09 Nov 2026 04:49:34 +0000</pubDate>
      <link>https://dev.to/imazeo/how-to-optimize-images-for-the-web-without-guesswork-4nim</link>
      <guid>https://dev.to/imazeo/how-to-optimize-images-for-the-web-without-guesswork-4nim</guid>
      <description>&lt;p&gt;A common image performance problem is surprisingly simple: a browser downloads a 3000-pixel image, only to display it inside a 350-pixel-wide card.&lt;/p&gt;

&lt;p&gt;The image looks fine. The layout works. But the browser is transferring far more data than it needs.&lt;/p&gt;

&lt;p&gt;When optimizing images, I find it more useful to think about three things in order:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Dimensions:&lt;/strong&gt; How large does the image actually need to be?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Format:&lt;/strong&gt; Which format makes sense for this type of content?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Quality:&lt;/strong&gt; How much compression can you apply without affecting the result?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Let's walk through a small example using Node.js and Sharp.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Start with dimensions
&lt;/h2&gt;

&lt;p&gt;Suppose you have a product image that's 3000 × 2000 pixels.&lt;/p&gt;

&lt;p&gt;Your website displays it in a card that's approximately 350 pixels wide.&lt;/p&gt;

&lt;p&gt;You probably don't need to serve the original file.&lt;/p&gt;

&lt;p&gt;Depending on the layout and device pixel density, generating 640px and 1200px versions could be a reasonable starting point.&lt;/p&gt;

&lt;p&gt;The exact sizes should come from your layout, not from a fixed rule.&lt;/p&gt;

&lt;p&gt;One important detail: CSS resizing does not reduce the file the browser downloads. You need appropriately sized image assets.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Choose the right format
&lt;/h2&gt;

&lt;p&gt;Different formats have different strengths.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Format&lt;/th&gt;
&lt;th&gt;Good for&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;JPEG&lt;/td&gt;
&lt;td&gt;Photographs and broad compatibility&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;WebP&lt;/td&gt;
&lt;td&gt;Most modern website images&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;AVIF&lt;/td&gt;
&lt;td&gt;Potentially smaller image transfers&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;PNG&lt;/td&gt;
&lt;td&gt;Lossless graphics and pixel-precise assets&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SVG&lt;/td&gt;
&lt;td&gt;Icons and vector illustrations&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;For product photography, I usually start by comparing JPEG and WebP.&lt;/p&gt;

&lt;p&gt;AVIF is also worth testing, but don't assume it always produces the smallest acceptable file. Results depend on the image and encoder settings.&lt;/p&gt;

&lt;p&gt;The goal isn't to use the newest format. It's to deliver an image that looks good without transferring unnecessary bytes.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Generate optimized images with Sharp
&lt;/h2&gt;

&lt;p&gt;Sharp is a popular image-processing library for Node.js.&lt;/p&gt;

&lt;p&gt;Install it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm install sharp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Put a source image named &lt;code&gt;photo.jpg&lt;/code&gt; in your project directory. For this example, use a source at least 1200 pixels wide.&lt;/p&gt;

&lt;p&gt;Create &lt;code&gt;optimize.mjs&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;sharp&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s2"&gt;"sharp"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;stat&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s2"&gt;"node:fs/promises"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;input&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"photo.jpg"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;widths&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;640&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1200&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;width&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="n"&gt;widths&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;output&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sb"&gt;`photo-${width}.webp`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;sharp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;input&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;rotate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;resize&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="n"&gt;width&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="n"&gt;withoutEnlargement&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;webp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;quality&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;78&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toFile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;output&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;size&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;stat&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;output&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="nb"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="sb"&gt;`${output}: ${(size / 1024).toFixed(1)} KB`&lt;/span&gt;
  &lt;span class="p"&gt;)&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;Run it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;node optimize.mjs
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You should now have two WebP images.&lt;/p&gt;

&lt;p&gt;Open both and compare them with the original.&lt;/p&gt;

&lt;p&gt;Pay attention to small text, edges, texture, and areas containing subtle color variations.&lt;/p&gt;

&lt;p&gt;A quality setting of 78 is just a starting point. It isn't a universal recommendation.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Serve the correct image
&lt;/h2&gt;

&lt;p&gt;Creating smaller files is only half the job.&lt;/p&gt;

&lt;p&gt;Your browser also needs to know which size to download.&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;src&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"/images/photo-1200.webp"&lt;/span&gt;
  &lt;span class="na"&gt;srcset&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"
    /images/photo-640.webp 640w,
    /images/photo-1200.webp 1200w
  "&lt;/span&gt;
  &lt;span class="na"&gt;sizes&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"(max-width: 720px) 100vw, 720px"&lt;/span&gt;
  &lt;span class="na"&gt;width&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"1200"&lt;/span&gt;
  &lt;span class="na"&gt;height&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"800"&lt;/span&gt;
  &lt;span class="na"&gt;alt&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"Product photograph"&lt;/span&gt;
  &lt;span class="na"&gt;loading&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"lazy"&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;This example assumes a 3:2 source image and that the generated assets are available under &lt;code&gt;/images/&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;srcset&lt;/code&gt; attribute provides image alternatives. The &lt;code&gt;sizes&lt;/code&gt; attribute tells the browser approximately how much space the image will occupy.&lt;/p&gt;

&lt;p&gt;The browser can then select an appropriate source.&lt;/p&gt;

&lt;p&gt;Also, don't automatically lazy-load your main hero image. Images visible immediately when the page loads may need to load promptly.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Measure the result
&lt;/h2&gt;

&lt;p&gt;After optimization, open Chrome DevTools.&lt;/p&gt;

&lt;p&gt;Check:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Which image file was requested?&lt;/li&gt;
&lt;li&gt;How many bytes were transferred?&lt;/li&gt;
&lt;li&gt;Did the mobile viewport select the expected source?&lt;/li&gt;
&lt;li&gt;Does the image still look good at its actual display size?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Then check the page's performance.&lt;/p&gt;

&lt;p&gt;A smaller image may help, but optimizing one file doesn't automatically fix slow page loading. Server response times, JavaScript, CSS, and the position of your main image also matter.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. When should image processing move to an API?
&lt;/h2&gt;

&lt;p&gt;A small Sharp script works well when you control a limited set of images.&lt;/p&gt;

&lt;p&gt;Things become different when an application handles user uploads, product catalogs, multiple output formats, or dynamically requested dimensions.&lt;/p&gt;

&lt;p&gt;In those situations, a reusable image-processing API can keep transformation rules consistent across applications.&lt;/p&gt;

&lt;p&gt;This is one of the workflows we're working on with &lt;a href="https://imazeo.com/" rel="noopener noreferrer"&gt;Imazeo&lt;/a&gt;, alongside PDF processing and other media tools.&lt;/p&gt;

&lt;p&gt;Regardless of whether you use Sharp directly or an API, the same principle applies:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Start with the actual display requirements, generate suitable assets, and measure what the browser receives.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Final thought
&lt;/h2&gt;

&lt;p&gt;Before optimizing an entire image library, pick one real page and test a single image.&lt;/p&gt;

&lt;p&gt;Resize it, compare formats, inspect the quality, and check the browser's network requests.&lt;/p&gt;

&lt;p&gt;That small experiment will often tell you more than following a generic compression checklist.&lt;/p&gt;




&lt;p&gt;Originally published on the &lt;a href="https://blog.imazeo.com/how-to-optimize-images-for-the-web/" rel="noopener noreferrer"&gt;Imazeo Blog&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>node</category>
      <category>performance</category>
    </item>
  </channel>
</rss>
