Skip to content

GHagui/NanoGlyph-Share

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

25 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

NanoGlyph

๐Ÿ”ฎ NanoGlyph โ€” Share Images Without Internet



Note

What if you could share photos using just a URL โ€” no server, no cloud, no internet required?

NanoGlyph is an offline-first Progressive Web App (PWA) that encodes images into compact, URL-safe text. Share images via messaging apps on restrictive WiFi networks, air-gapped environments, or anywhere traditional image sharing fails.


๐Ÿ’ก Why NanoGlyph?

The idea came from a real frustration: restrictive WiFi networks (airports, hotels, corporate) that block image uploads but allow text messages. What if the image was the message?

NanoGlyph solves this by:

  • Encoding any image into a compact Base62 string
  • Embedding it directly in the URL fragment (#...)
  • Decoding it entirely in-browser โ€” no server ever sees the data

The entire image lives in the link. Send it via WhatsApp, Telegram, SMS, email โ€” anything that can carry text.


โœจ Features

Feature Description
๐ŸŽจ 99 Color Palettes 20 hand-crafted + 79 procedural palettes with Auto/Manual toggle
๐ŸŽ›๏ธ Instant Adjustments Saturation, Hue, Exposure, Contrast, and Temperature calculated instantly in WebAssembly
๐Ÿš€ Aggressive PWA Custom Service Worker bypasses "stuck cache" bugs standard to mobile PWAs for guaranteed updates
๐Ÿ“ฑ Platform-Aware Chunking Auto-splits URLs for WhatsApp (4K), Telegram (4K), Messenger (2K), Instagram (1K)
๐Ÿ–ผ๏ธ Multi-Format Support PNG, JPEG, GIF, WebP, BMP, HEIF/HEIC โ€” including animations
๐Ÿ’พ Save as PNG Download received images directly to your gallery with one tap
๐Ÿ”’ Zero Server Everything runs in your browser via WebAssembly โ€” no data leaves your device
๐Ÿ“ถ Offline-First Works without internet after first visit โ€” self-contained ImageSession Wasm layer
โšก Rust + WebAssembly Image processing at near-native speed using Bayer dithering and RLE
๐Ÿ—œ๏ธ Dual Compression Choose between Brotli (maximum compression) or Zlib (compatibility)
๐ŸŽš๏ธ Quality Control Low (64px) to Cosmic (2048px) โ€” you choose the tradeoff

๐Ÿ”ง How It Works

Encoding Pipeline

flowchart LR
    A["๐Ÿ–ผ๏ธ Image\n(Upload)"] --> B["๐Ÿ“ Resize & Cache\n(ImageSession)"]
    B --> C["๐ŸŽ›๏ธ Pixel Adjustments\n(Hue, Saturation...)"]
    C --> D["๐ŸŽจ Auto-Palette & \nBayer Dithering"]
    D --> E["๐Ÿ“ฆ Pack\n3-bit/px"]
    E --> F["๐Ÿ—œ๏ธ RLE\nEncode"]
    F --> G["๐Ÿ’จ Brotli/Zlib\nCompress"]
    G --> H["๐Ÿ”ค Base62\nEncode"]
    H --> I["๐Ÿ”— URL\nFragment #..."]
Loading

Decoding Pipeline

flowchart LR
    A["๐Ÿ”— URL\nFragment #..."] --> B["๐Ÿ”ค Base62\nDecode"]
    B --> C["๐Ÿ’จ Brotli/Zlib\nDecompress"]
    C --> D["๐Ÿ—œ๏ธ RLE\nDecode"]
    D --> E["๐Ÿ“ฆ Unpack\n3-bit/px"]
    E --> F["๐ŸŽจ Palette\nLookup"]
    F --> G["๐Ÿ–ผ๏ธ Canvas\nRender"]
    G --> H["๐Ÿ’พ Save\nas PNG"]
Loading

Step by step:

  1. Resize โ€” Scale to target dimension (64โ€“2048px) and cache in WebAssembly RAM
  2. Adjust โ€” Apply Exposure, Contrast, Saturation, Hue, and Temperature mathematically
  3. Palette โ€” Auto-detect or manually lock one of 99 palettes (8 colors each)
  4. Dither โ€” Bayer ordered dithering for smooth color transitions
  5. Pack โ€” 3 bits per pixel (8 colors = 3 bits, 62% size reduction vs 8-bit)
  6. RLE โ€” Run-length encoding for repeated color runs
  7. Compress โ€” Brotli (Q11) or Zlib (L9) for maximum entropy compression
  8. Base62 โ€” URL-safe encoding using A-Za-z0-9 only

The result is a self-contained URL like:

https://ghagui.github.io/NanoGlyph-Share/#2s54FcFnAlWr...

๐Ÿ› ๏ธ Tech Stack

  • Rust โ€” Core image processing, compression, and Base62 encoding
  • WebAssembly โ€” Compiled from Rust via wasm-pack for browser execution
  • Vanilla JS/CSS/HTML โ€” Zero-dependency frontend, no frameworks
  • Service Worker โ€” Offline caching for PWA support
  • GitHub Actions โ€” CI/CD pipeline builds Wasm and deploys to GitHub Pages

๐Ÿ—๏ธ Build from Source

Prerequisites

Build

cd nanoglyph_core
wasm-pack build --target web

Run locally

# From the project root
python3 -m http.server 8080
# Open http://localhost:8080

๐Ÿ“Š Compression Examples

Source Quality Palette Chunks (WhatsApp) URL Length
Photo (1080p) Medium (128px) Auto 1 ~8,000 chars
Photo (1080p) High (192px) Auto 5 ~18,000 chars
Photo (1080p) Extreme (256px) Auto 7 ~28,000 chars
Icon (64x64) Low (64px) Auto 1 ~800 chars

๐ŸŽจ Palette System

NanoGlyph includes 99 palettes:

  • #0 โ€” Default (RGB primaries)
  • #1 โ€” Classic CGA
  • #2 โ€” Real Photography Colors
  • #3-#20 โ€” Themed (Portraits, Cinema, Vintage, Cyberpunk, Food, etc.)
  • #21-#98 โ€” Procedural (full 360ยฐ hue spectrum)

Each palette contains 8 colors, and the encoder automatically selects the best-matching palette for your image.


๐Ÿ“‹ Platform Hyperlink Limits

Important

Messaging apps auto-hyperlink URLs only up to a certain length. Beyond that, the URL is sent as plain text โ€” the receiver must manually copy-paste it into the browser.

Platform Clickable Link Limit Auto-Chunk
WhatsApp ~4,096 chars โœ…
Telegram ~4,096 chars โœ…
Messenger ~2,000 chars โœ…
Instagram ~1,000 chars โœ…

NanoGlyph chunks based on the clickable limit so every shared part is a tappable link.


๐Ÿ“„ License

(MIT โ€” Use it, fork it, share images without the cloud.)[./LICENSE]


โค๏ธ Made by Gabriel Hagui in Rust

About

๐Ÿ”ฎ Share images without internet. Encode photos into URL-safe text. Offline-first PWA built with Rust + WebAssembly

Topics

Resources

License

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors