Lossless · open source · Apache-2.0

A lossless image format for charts, logos and icons

BIC stores flat graphics in fewer bytes than optimized PNG. Photographs stay as their original JPEG. The decoder runs in the browser, and you can try it below on real files.

Decoder for browsers and Node.js
npm install @proteo5/bic-runtime
Build step for Vite and webpack
npm install --save-dev @proteo5/bic-build
5.7 KiBdecoder, gzip, one dependency (fzstd)
53test cases checked against the Rust decoder
46%smaller than the best lossless format, best example

Why BIC: save bandwidth on solid-color images

Charts, interface screenshots, logos, icons and diagrams are made of large areas of one color. A PNG already compresses them, but BIC stores each run of identical pixels in a few bytes and compresses the result again. A smaller file is less data to download on every visit, and on a slow connection it is the difference between an image that appears at once and one that waits.

  • Good fit: flat graphics with few colors. For them BIC can be smaller than optimized PNG (see the results).
  • Not a fit: photographs have no long runs of equal pixels. BIC keeps their original JPEG inside the file and adds 32 bytes, so use JPEG or WebP for them.
  • Exact: each .bic decodes to the same pixels as its source. The examples below check that byte by byte.

Live: real .bic files, decoded in your browser

Each file below is decoded right now by @proteo5/bic-runtime from npm, with no server involved. The result is compared with the source pixels, byte for byte.

Try your own .bic file

Drop a .bic file here, or choose one. It is decoded in your browser; nothing is uploaded.

Export your own image to .bic

This page decodes .bic files but does not encode them yet, so exporting uses the command line. These commands compare your file the same way as the results table.

bic inspect photo.png --json   # sizes of PNG, oxipng, WebP and BIC
bic encode photo.png photo.bic   # keeps the smaller strategy
bic verify photo.png photo.bic   # decoded pixels must match exactly
  • The BIC algorithm: when it is smaller than the source. This is the usual result for charts, interfaces, icons and diagrams.
  • A wrapper: when the source file is already smaller (PNG, JPEG, WebP or HEIF), it is kept inside the .bic unchanged. Add --transcode to store the BIC algorithm anyway.

Results

Measured on the example images below. Sizes in KiB. Each row used one of two strategies: the BIC algorithm (flat graphics), or a wrapper that keeps the original JPEG inside the .bic with 32 bytes of header (photographs). "Best lossless" is the smallest of PNG, oxipng and WebP lossless. The last three columns are lossy formats, which change pixel values. "MB saved per 1,000 views" multiplies the difference by 1,000 transfers. Negative values mean BIC is larger.

ExamplePixelsPNGoxipngWebP losslessBIC fileBest losslessBIC smaller byMB saved / 1,000 viewsWebP q80AVIF q50JPEG q85Verdict
Software user interface (screenshot)1600×859204.5114.5130.4136.3oxipng: 114.5-19%-22.3850.829.6111.2Keep the PNG oxipng is smaller. Keep it.
Lossy AVIF q50 is 78% smaller than BIC, if exact pixels are not needed.
Flowchart diagram706×90560.510.011.811.1oxipng: 10.0-12%-1.2015.68.337.2Keep the PNG oxipng is smaller. Keep it.
Lossy AVIF q50 is 25% smaller than BIC, if exact pixels are not needed.
Bar chart1600×800256.787.7109.247.3oxipng: 87.7+46%+41.4174.230.7158.6Use BIC 46% smaller than oxipng.
Lossy AVIF q50 is 35% smaller than BIC, if exact pixels are not needed.
Icon with transparency512×51225.17.314.87.3oxipng: 7.3+0%+0.026.56.419.4Use BIC 0% smaller than oxipng.
Lossy AVIF q50 is 13% smaller than BIC, if exact pixels are not needed.
Pixel art800×480538.377.2190.989.0oxipng: 77.2-15%-12.14109.759.3151.1Keep the PNG oxipng is smaller. Keep it.
Lossy AVIF q50 is 33% smaller than BIC, if exact pixels are not needed.
Landscape photograph1600×10643,550.02,257.51,860.5492.5WebP lossless: 1,860.5n/an/a270.5139.9436.2Keep the JPEG The original JPEG is stored as it is, so BIC adds nothing here.
Lossless formats are far larger for photographs.
Landscape photograph1600×10672,957.81,571.51,601.7418.8oxipng: 1,571.5n/an/a236.3110.3365.2Keep the JPEG The original JPEG is stored as it is, so BIC adds nothing here.
Lossless formats are far larger for photographs.

When to use BIC

The measurements decide the cases. Flat graphics with few colors are where BIC is smaller than optimized PNG. Everything else in the table is not.

Use BIC for

  • Charts, diagrams and graphs with solid areas
  • Logos and brand marks
  • Icons and pixel art with few colors
  • Any image that must stay lossless and is smaller in BIC

Do not use BIC for

  • Photographs: store them as JPEG or WebP
  • Software screenshots with anti-aliased text: they have thousands of colors and BIC is larger
  • Images that may be lossy: WebP or AVIF are much smaller

The build step converts an image only when BIC is at least 10% smaller than the best lossless format, and never for JPEG or for images with more than 4096 colors.

Use it in your project

The decoder works wherever JavaScript runs. The build step converts your images and serves them through a Service Worker, under their original URLs, so your HTML and CSS do not change.

How it works

  • Images are encoded in planes, with palettes or color transforms, predictors and run-length blocks, then compressed with Zstandard.
  • The encoder tries a small set of candidates and keeps the smallest. The result decodes to exactly the same pixels.
  • With the build step, a Service Worker answers requests for converted images. Without it, the browser downloads the PNG as usual.
  • The decoded image is kept in the browser's cache, so each .bic is downloaded once per device.

How it is checked

  • 53 cases made by the Rust encoder: each decodes in the JavaScript runtime to the Rust decoder's exact pixels.
  • Malformed and randomly corrupted files throw an error, never a crash.
  • End-to-end tests in Chrome with Vite and webpack: the first visit downloads the PNG; later visits show the .bic with identical pixels.
  • Not tested yet: Firefox and Safari.

Full reference in the documentation →

Downloads

The command-line tool and the viewer for Windows, Linux and macOS, from release v0.2.1. The build step installs the right binary by itself.

Windows x64bic-v0.2.1-x86_64-pc-windows-msvc.zipDownload
Linux x64bic-v0.2.1-x86_64-unknown-linux-gnu.tar.gzDownload
macOS Apple Siliconbic-v0.2.1-aarch64-apple-darwin.tar.gzDownload
macOS Intelbic-v0.2.1-x86_64-apple-darwin.tar.gzDownload

All releases and checksums

Example images and licenses

Each example is republished under its license, from Wikimedia Commons. Images larger than 1600 px were resized, as noted.