<?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: daydayupc</title>
    <description>The latest articles on DEV Community by daydayupc (@daydayupc).</description>
    <link>https://dev.to/daydayupc</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%2F4089993%2Fda7f8a1a-fe47-468e-84d5-96a523e625e8.png</url>
      <title>DEV Community: daydayupc</title>
      <link>https://dev.to/daydayupc</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/daydayupc"/>
    <language>en</language>
    <item>
      <title>Compressing Images Without Losing Quality: What Actually Works in 2026</title>
      <dc:creator>daydayupc</dc:creator>
      <pubDate>Sat, 22 Aug 2026 17:43:38 +0000</pubDate>
      <link>https://dev.to/daydayupc/compressing-images-without-losing-quality-what-actually-works-in-2026-6l6</link>
      <guid>https://dev.to/daydayupc/compressing-images-without-losing-quality-what-actually-works-in-2026-6l6</guid>
      <description>&lt;h2&gt;
  
  
  Compressing Images Without Losing Quality: What Actually Works in 2026
&lt;/h2&gt;

&lt;p&gt;The short version: set quality to 75-80, resize the image to the width it's actually displayed at, and use WebP or AVIF when the destination allows it. That gets most photos from multi-megabyte files down to 100-300 KB with zero visible difference.&lt;/p&gt;

&lt;p&gt;I've shipped images this way on production sites for years, and I've A/B tested the settings below with designers who swear they can tell "quality loss" apart at 400% zoom. The numbers hold up. Here's the whole field guide.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why your 4 MB photo is 4 MB in the first place
&lt;/h2&gt;

&lt;p&gt;Modern phone cameras default to 48-megapixel photos. One shot from an iPhone 15/16 Pro or a Galaxy S-series lands at 5-8 MB before you do anything to it. Meanwhile the biggest any web page will ever display that image is usually 1200-2000 pixels wide.&lt;/p&gt;

&lt;p&gt;So you're shipping 48 megapixels to show about 2. That gap — between what the sensor captured and what the screen can render — is where almost all the wasted bytes live. Shrink it once and you barely need to obsess over the rest.&lt;/p&gt;

&lt;h2&gt;
  
  
  Lossy vs lossless: there are only two buckets
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Lossless&lt;/strong&gt; keeps every pixel intact. File sizes drop 10-40%. PNG, GIF, and lossless WebP work this way. Right choice for logos, screenshots, and anything with text or sharp edges.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Lossy&lt;/strong&gt; discards tiny color and detail variations your eyes rarely register. File sizes drop 60-90%. JPEG, lossy WebP, and AVIF work this way. Right choice for photos.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The trap people fall into: they think "quality 100" is the safe option. It isn't. A JPEG at quality 100 is mostly wasted data — the encoder is preserving artifacts you can't see. The real skill is finding the &lt;strong&gt;lowest&lt;/strong&gt; quality number where you can't see a difference, not the highest one where you can. For photos that number is almost always 75-80.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pick the format first, compress second
&lt;/h2&gt;

&lt;p&gt;Choosing the format does half the work before you touch a single slider:&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;Best for&lt;/th&gt;
&lt;th&gt;Typical savings&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;Photos, web, email&lt;/td&gt;
&lt;td&gt;60-80% at quality 80&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;PNG&lt;/td&gt;
&lt;td&gt;Logos, screenshots, transparency&lt;/td&gt;
&lt;td&gt;10-40% (lossless)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;WebP&lt;/td&gt;
&lt;td&gt;Modern websites&lt;/td&gt;
&lt;td&gt;25-35% smaller than JPEG at the same quality&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;AVIF&lt;/td&gt;
&lt;td&gt;Modern browsers&lt;/td&gt;
&lt;td&gt;roughly half of JPEG at the same quality&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SVG&lt;/td&gt;
&lt;td&gt;Icons, vector art&lt;/td&gt;
&lt;td&gt;tiny, infinitely scalable&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;WebP is supported in every modern browser (&lt;a href="https://caniuse.com/webp" rel="noopener noreferrer"&gt;caniuse&lt;/a&gt; lists it as green across the board), and AVIF covers everything except older Safari versions. The easiest win on the web: serve AVIF or WebP with a JPEG fallback and let the browser decide:&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;picture&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;source&lt;/span&gt; &lt;span class="na"&gt;srcset=&lt;/span&gt;&lt;span class="s"&gt;"photo.avif"&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"image/avif"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;source&lt;/span&gt; &lt;span class="na"&gt;srcset=&lt;/span&gt;&lt;span class="s"&gt;"photo.webp"&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"image/webp"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&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;"photo.jpg"&lt;/span&gt; &lt;span class="na"&gt;alt=&lt;/span&gt;&lt;span class="s"&gt;"Your photo"&lt;/span&gt; &lt;span class="na"&gt;width=&lt;/span&gt;&lt;span class="s"&gt;"1920"&lt;/span&gt; &lt;span class="na"&gt;height=&lt;/span&gt;&lt;span class="s"&gt;"1080"&lt;/span&gt; &lt;span class="na"&gt;loading=&lt;/span&gt;&lt;span class="s"&gt;"lazy"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/picture&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That snippet alone will cut your image payload by 50-70% on most browsers, and nobody who visits your site will ever know the difference.&lt;/p&gt;

&lt;h2&gt;
  
  
  The exact settings I use
&lt;/h2&gt;

&lt;p&gt;These are the numbers I actually ship with, not the ones from a random blog post:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Quality: 75-80.&lt;/strong&gt; Start at 80 for photos. Below 60, smooth gradients start to band and edges get crunchy.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Width: the display width.&lt;/strong&gt; Resize to the largest size the image will ever be shown at. A 4000px photo displayed at 1200px is about 80% waste.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Format: WebP or AVIF when possible, JPEG otherwise.&lt;/strong&gt; For screenshots and logos: PNG or lossless WebP — never lossy.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If you'd rather stay in the terminal, &lt;a href="https://imagemagick.org/" rel="noopener noreferrer"&gt;ImageMagick&lt;/a&gt; does all three in one line:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;magick photo.jpg &lt;span class="nt"&gt;-quality&lt;/span&gt; 80 &lt;span class="nt"&gt;-resize&lt;/span&gt; 1920x1920&lt;span class="se"&gt;\&amp;gt;&lt;/span&gt; photo.webp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or in Python with &lt;a href="https://python-pillow.org/" rel="noopener noreferrer"&gt;Pillow&lt;/a&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;PIL&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Image&lt;/span&gt;

&lt;span class="n"&gt;img&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Image&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;photo.jpg&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;convert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;RGB&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;img&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;thumbnail&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="mi"&gt;1920&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1920&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;          &lt;span class="c1"&gt;# resize to display size
&lt;/span&gt;&lt;span class="n"&gt;img&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;save&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;photo.webp&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;WEBP&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;quality&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;80&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;method&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c1"&gt;# method=6 = slowest, best compression
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And if you want a browser-only option, my tool &lt;a href="https://arktoolz.com/en/image-compressor" rel="noopener noreferrer"&gt;ArkToolz image compressor&lt;/a&gt; does the same thing in the browser — no upload, the file never leaves your device, batch mode handles a whole folder at once.&lt;/p&gt;

&lt;h2&gt;
  
  
  Four mistakes I see everywhere
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Quality 100.&lt;/strong&gt; Wasted bytes, no visible benefit. Start at 80 and step down until you notice.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Recompressing an already-compressed file.&lt;/strong&gt; Each lossy pass adds artifacts. Always compress from the original.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ignoring EXIF.&lt;/strong&gt; GPS, camera model, timestamps — that's kilobytes of metadata hiding in every photo. Most decent compressors strip it automatically.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Deleting the original.&lt;/strong&gt; Compression edits a copy, never the source. Storage is cheap; reshoots are not.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Frequently asked questions
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Does compressing an image ruin the quality?&lt;/strong&gt;&lt;br&gt;
Only if you push lossy compression too far. Between 75-80, the difference is invisible to the human eye. Lossless compression doesn't touch quality at all.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What's the best format for photos in 2026?&lt;/strong&gt;&lt;br&gt;
WebP at quality 80 is the best size-to-quality balance in most browsers right now. AVIF is smaller still if your audience runs modern browsers. For screenshots and text-heavy images, PNG or lossless WebP.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Can a 5 MB photo really become 100 KB?&lt;/strong&gt;&lt;br&gt;
Often yes — but usually it takes two levers at once: quality around 75 plus resizing to display width. Either one alone might not get you there.&lt;/p&gt;

&lt;h2&gt;
  
  
  Go compress something
&lt;/h2&gt;

&lt;p&gt;Format first, then quality 75-80, then display size. That's the whole playbook. A &lt;a href="https://arktoolz.com/en/image-compressor" rel="noopener noreferrer"&gt;free online image compressor&lt;/a&gt; applies all three in one go, right in your browser — drop a file in and watch it come back 60-90% smaller while the quality stays put.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This article was originally published on the &lt;a href="https://arktoolz.com/en/blog/compress-images-without-losing-quality" rel="noopener noreferrer"&gt;ArkToolz blog&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>webperf</category>
      <category>tutorial</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
