Done

GigaView

GoLeaflet.jsImage ProcessingTilesSelf-Hostedgigapixellibvips

What started as a "quick 2-hour project" turned into a 2+ day journey of building a gigapixel image viewer 😅

The idea was simple: create a web application that can display enormous images (multi-gigabyte files) in the browser, even on servers with limited RAM. I wanted to use Leaflet.js specifically for its excellent map API, which would also enable future features like annotation layers.

Live Demo: https://gigaview.public.kulikov.fi

Check out the project on GitHub: https://github.com/garfik/gigaview

Main Requirements

  • Memory-efficient processing - should work even with limited RAM
  • Self-hosted solution
  • Uses Leaflet.js for map-like image navigation
  • On-demand tile generation (no pre-processing required)

Technical Implementation

The application uses a surprisingly simple but effective architecture:

Backend (Go)

I'm not a professional Go developer, but I really enjoy the language and wanted to use it for this project. The backend handles:

  • libvips + vipsgen: The real hero of this project. These libraries use memory-mapped files and process images in chunks, making it possible to work with multi-gigabyte images without loading them entirely into memory.
  • On-demand tile rendering: Generates 256×256 JPEG tiles only when requested
  • LRU caching: Memory or file-based cache for rendered tiles
  • Upload endpoint: Allows uploading new images with optional token authentication

Frontend (Leaflet.js)

Leaflet provides smooth pan/zoom functionality and handles tile loading efficiently. It treats the gigapixel image as a map, requesting tiles as needed during navigation.

Key Features

  • Supports TIFF/BigTIFF, PNG, JPG, WebP formats
  • 256×256 pixel tiles for optimal browser performance
  • Smooth zooming and panning
  • Docker based deployment
  • Configurable memory/file caching

Why Not Existing Solutions?

Yes, there are similar projects like OpenSeadragon - an excellent open-source viewer for high-resolution zoomable images. However, I specifically wanted to use Leaflet.js for its map API, which opens up interesting possibilities.

Future Potential

Many options. You can build your own map for your game. You can use it for your own photography business. Or... maybe a doctor want to create a photo of your own eye and add some annotations and share it with you.

Format Recommendations

For very large images, TIFF format is highly recommended. TIFF files work efficiently with memory-mapped access, allowing libvips to process them without loading the entire file into memory.

PNG files can require significantly more memory when processing gigapixel images, as they may need to be fully decompressed.

Performance Configuration

The application offers extensive configuration options to balance performance and resource usage. Such as:

  • Control amount of CPU cores used for image processing
  • How much memory should be used for image processing
  • How much tiles should be cached in memory
  • Cache types: memory (fast, volatile) or file (persistent)

Project Notes

This is a proof-of-concept implementation, not production-ready code. The goal was to demonstrate the idea and explore the technology, not to write perfect code.