<?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: banggui</title>
    <description>The latest articles on DEV Community by banggui (@banggui_song_498de81f6a95).</description>
    <link>https://dev.to/banggui_song_498de81f6a95</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%2F4221142%2F0f03e37f-a4f7-4f87-abb2-8e8e21799924.png</url>
      <title>DEV Community: banggui</title>
      <link>https://dev.to/banggui_song_498de81f6a95</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/banggui_song_498de81f6a95"/>
    <language>en</language>
    <item>
      <title>Auditing a 4,361-byte ICO: six PNG payloads and a 102-byte directory</title>
      <dc:creator>banggui</dc:creator>
      <pubDate>Fri, 20 Nov 2026 22:31:58 +0000</pubDate>
      <link>https://dev.to/banggui_song_498de81f6a95/auditing-a-4361-byte-ico-six-png-payloads-and-a-102-byte-directory-1om1</link>
      <guid>https://dev.to/banggui_song_498de81f6a95/auditing-a-4361-byte-ico-six-png-payloads-and-a-102-byte-directory-1om1</guid>
      <description>&lt;p&gt;The bundled ICO contains six separately decoded PNG images, and its entire 4,361-byte length can be accounted for: 4,259 bytes of image payloads plus 102 bytes of header and directory. A filename, a single preview, or the largest decoded image would not establish that all six entries are present and internally consistent.&lt;/p&gt;

&lt;h2&gt;
  
  
  Start with the file, not the preview
&lt;/h2&gt;

&lt;p&gt;This is a byte-layout audit of &lt;code&gt;wide-padding-browser.ico&lt;/code&gt;, not a compatibility benchmark. The original experiment used a self-made 512 × 128 lossless WebP, transparent padding, and six selected output sizes on November 18, 2026. Chrome's download-event wait timed out, but the downloaded file was present on disk and its embedded PNG images were decoded. This article reruns the inspector against that same stored file; it does not claim another browser conversion.&lt;/p&gt;

&lt;p&gt;The file's SHA-256 is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;b39e4c6e61f8d54e75a40aa0e79c711e0ebac28e16ee78f0d064c08fcb9d1c1f
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The measured entries are:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Decoded frame&lt;/th&gt;
&lt;th&gt;Payload offset&lt;/th&gt;
&lt;th&gt;Payload bytes&lt;/th&gt;
&lt;th&gt;End offset, exclusive&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;16 × 16&lt;/td&gt;
&lt;td&gt;102&lt;/td&gt;
&lt;td&gt;161&lt;/td&gt;
&lt;td&gt;263&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;32 × 32&lt;/td&gt;
&lt;td&gt;263&lt;/td&gt;
&lt;td&gt;182&lt;/td&gt;
&lt;td&gt;445&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;48 × 48&lt;/td&gt;
&lt;td&gt;445&lt;/td&gt;
&lt;td&gt;260&lt;/td&gt;
&lt;td&gt;705&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;64 × 64&lt;/td&gt;
&lt;td&gt;705&lt;/td&gt;
&lt;td&gt;325&lt;/td&gt;
&lt;td&gt;1,030&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;128 × 128&lt;/td&gt;
&lt;td&gt;1,030&lt;/td&gt;
&lt;td&gt;913&lt;/td&gt;
&lt;td&gt;1,943&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;256 × 256&lt;/td&gt;
&lt;td&gt;1,943&lt;/td&gt;
&lt;td&gt;2,418&lt;/td&gt;
&lt;td&gt;4,361&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Offsets and payload lengths come from the ICO directory; dimensions were checked by decoding each PNG. Each end offset above is calculated as &lt;code&gt;offset + payload_bytes&lt;/code&gt;. In this fixture, every payload ends where the next begins, and the last ends at the file length.&lt;/p&gt;

&lt;p&gt;The accounting is exact:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;payload bytes = 161 + 182 + 260 + 325 + 913 + 2418 = 4259
directory end = 6 + 16 × 6 = 102
total         = 4259 + 102 = 4361 bytes
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;6&lt;/code&gt; and &lt;code&gt;16&lt;/code&gt; in the second line are the header length and directory-entry length used by the included parser. This describes this file's contiguous layout, not a promise that every ICO has identical padding or payload order.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reproduce the audit locally
&lt;/h2&gt;

&lt;p&gt;The &lt;a href="https://github.com/songbanggui99-hash/icon-frame-audit" rel="noopener noreferrer"&gt;Icon Frame Audit repository&lt;/a&gt; contains the MIT-licensed inspector, source artwork, downloaded ICO, and measurement records.&lt;/p&gt;

&lt;p&gt;Download the repository files together, then run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python -m pip install -r requirements.txt
python inspect_ico.py wide-padding-browser.ico &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; audit.json
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For a spreadsheet comparison, download &lt;a href="https://raw.githubusercontent.com/songbanggui99-hash/icon-frame-audit/de8dab1bbdbca3f934dff6447bdaf708f0cd5d1a/measurements.csv" rel="noopener noreferrer"&gt;measurements.csv&lt;/a&gt;. It contains the offsets and payload lengths used in the table, alongside the decoded dimensions and alpha counts.&lt;/p&gt;

&lt;p&gt;The script rejects truncated headers, invalid payload bounds, and PNG dimensions that disagree with the directory. It explicitly reports non-PNG entries as unmeasured rather than inventing transparency results for BMP/DIB data. It does not prove that payloads never overlap, or provide exhaustive validation of every ICO variant.&lt;/p&gt;

&lt;h2&gt;
  
  
  What this check answers
&lt;/h2&gt;

&lt;p&gt;It answers a narrow question: does this stored file contain the six measured, decodable PNG entries described by its directory? For this fixture, yes. It does not tell us which entry Windows will select for a taskbar icon, which favicon a browser will cache, or whether a platform will accept an upload.&lt;/p&gt;

&lt;p&gt;The &lt;a href="https://icoforge.com/webp-to-ico#rectangular-webp-readings" rel="noopener noreferrer"&gt;original WebP-to-ICO measurement page&lt;/a&gt; records the conversion context behind this fixture. I maintain that site and the audit repository; the table above is a reproducible file inspection, not a ranking or a recommendation to use a particular converter.&lt;/p&gt;

</description>
      <category>python</category>
    </item>
    <item>
      <title>Does PNG to ICO keep transparency? A measured alpha test at 16, 32 and 48 px</title>
      <dc:creator>banggui</dc:creator>
      <pubDate>Sun, 01 Nov 2026 20:13:07 +0000</pubDate>
      <link>https://dev.to/banggui_song_498de81f6a95/does-png-to-ico-transparency-survive-a-measured-alpha-test-across-16-128-px-58om</link>
      <guid>https://dev.to/banggui_song_498de81f6a95/does-png-to-ico-transparency-survive-a-measured-alpha-test-across-16-128-px-58om</guid>
      <description>&lt;h1&gt;
  
  
  Does PNG to ICO keep transparency? A measured alpha test at 16, 32 and 48 px
&lt;/h1&gt;

&lt;p&gt;Yes. A PNG with an alpha channel, converted to ICO, keeps alpha = 0 in every transparent pixel at all three sizes tested. Below is the pixel-by-pixel proof.&lt;/p&gt;

&lt;h2&gt;
  
  
  The question
&lt;/h2&gt;

&lt;p&gt;When you save an image as JPEG, the alpha channel is gone — JPEG has no transparency. If your icon source was a JPG, renaming the file extension to &lt;code&gt;.ico&lt;/code&gt; does not bring alpha back; the pixel data simply doesn't contain it.&lt;/p&gt;

&lt;p&gt;But if your source is a PNG with an alpha channel, does the ICO conversion preserve it? I ran a measurement to find out.&lt;/p&gt;

&lt;h2&gt;
  
  
  Source image
&lt;/h2&gt;

&lt;p&gt;A test PNG with a gradient alpha channel: at 16×16, every row steps through alpha values 0, 64, 128, 255 — four columns of each. The image has 64 fully transparent pixels (alpha = 0), 128 partially transparent pixels (alpha 64 and 128), and 64 fully opaque pixels (alpha = 255). At 32×32 the pattern scales up to 256/512/256. At 48×48 the anti-aliasing produces a richer distribution but the transparent count is 528.&lt;/p&gt;

&lt;p&gt;The ICO file produced from this PNG is 625 bytes total, containing three frames: 16×16 (138 bytes), 32×32 (151 bytes), 48×48 (282 bytes). Pillow independently decoded each PNG entry inside the ICO to verify the pixel data.&lt;/p&gt;

&lt;h2&gt;
  
  
  Method
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Open the PNG in the converter at &lt;a href="https://icoforge.com/png-to-ico-transparency-test" rel="noopener noreferrer"&gt;icoforge.com/png-to-ico-transparency-test&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Convert to ICO and download the output file.&lt;/li&gt;
&lt;li&gt;Decode each frame inside the ICO using Pillow's &lt;code&gt;Image.open()&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Count pixels at each alpha value: 0 (transparent), 1–254 (partially transparent), 255 (opaque).&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Results
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Size (px)&lt;/th&gt;
&lt;th&gt;Frame bytes&lt;/th&gt;
&lt;th&gt;Alpha 0 (transparent)&lt;/th&gt;
&lt;th&gt;Alpha 1–254 (partial)&lt;/th&gt;
&lt;th&gt;Alpha 255 (opaque)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;16&lt;/td&gt;
&lt;td&gt;138&lt;/td&gt;
&lt;td&gt;64&lt;/td&gt;
&lt;td&gt;128&lt;/td&gt;
&lt;td&gt;64&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;32&lt;/td&gt;
&lt;td&gt;151&lt;/td&gt;
&lt;td&gt;256&lt;/td&gt;
&lt;td&gt;512&lt;/td&gt;
&lt;td&gt;256&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;48&lt;/td&gt;
&lt;td&gt;282&lt;/td&gt;
&lt;td&gt;528&lt;/td&gt;
&lt;td&gt;1,248&lt;/td&gt;
&lt;td&gt;528&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;ICO total: 625 bytes. Source SHA-256: &lt;code&gt;a6286835afc613468120d32d780b3d954bfb5b85e983cc0ea845617b8eb04e7a&lt;/code&gt;. Output ICO SHA-256: &lt;code&gt;33d026fca2ea106d6e46b51c944f20531f16105dd40797b155295b1e56715903&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Every number in this table comes from the measurements at &lt;a href="https://icoforge.com/png-to-ico-transparency-test" rel="noopener noreferrer"&gt;icoforge.com/png-to-ico-transparency-test&lt;/a&gt;, where the source PNG and output ICO are also available for download.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why alpha = 0 at the transparent pixels means transparency survived
&lt;/h2&gt;

&lt;p&gt;The source PNG has 64 pixels at alpha = 0 in the 16×16 frame. If the ICO conversion had flattened the image — filling transparent areas with white or black — those pixels would show alpha = 255. Instead, the ICO frame contains exactly 64 pixels at alpha = 0, matching the source. The same holds at 32×32 (256 pixels at alpha 0) and 48×48 (528 pixels at alpha 0). The transparent regions are preserved.&lt;/p&gt;

&lt;p&gt;The partially transparent pixel counts also match: 128 at 16×16, 512 at 32×32, 1,248 at 48×48. These are the pixels where the source alpha is 64 or 128 — and the ICO preserves those intermediate values exactly.&lt;/p&gt;

&lt;h2&gt;
  
  
  What about JPEG sources?
&lt;/h2&gt;

&lt;p&gt;JPEG does not store an alpha channel. A JPG file contains only RGB data. If you convert a JPG to ICO, the result has no transparency — not because the converter dropped it, but because the source never had it. Changing a &lt;code&gt;.jpg&lt;/code&gt; filename to &lt;code&gt;.ico&lt;/code&gt; doesn't change the pixel data inside.&lt;/p&gt;

&lt;h2&gt;
  
  
  Data and sources
&lt;/h2&gt;

&lt;p&gt;All measurements were taken on 2026-10-26 using Chrome's canvas rendering pipeline and verified with Pillow. The raw measurements JSON is available at:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;/samples/png-alpha-test/measurements.json&lt;/code&gt; — frame byte counts, alpha value distributions, and SHA-256 hashes for source and output.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The source PNG and output ICO files are downloadable from the &lt;a href="https://icoforge.com/png-to-ico-transparency-test" rel="noopener noreferrer"&gt;PNG to ICO transparency test page&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;License: CC0 (public domain).&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>css</category>
      <category>performance</category>
    </item>
  </channel>
</rss>
