Skip to content

Add reusable DZI tile generator script#380

Closed
mattleibow wants to merge 1 commit intomainfrom
feature/dzi-generator-script
Closed

Add reusable DZI tile generator script#380
mattleibow wants to merge 1 commit intomainfrom
feature/dzi-generator-script

Conversation

@mattleibow
Copy link
Collaborator

DZI Tile Generator

A reusable .NET 10 file-based app (scripts/generate-dzi.cs) that generates Deep Zoom Image (DZI) tile pyramids from any source image using SkiaSharp.

Usage

dotnet run --file scripts/generate-dzi.cs -- <input-image> <output.dzi> [options]

# Example — generate from a JPEG with JPEG tiles:
dotnet run --file scripts/generate-dzi.cs -- myphoto.jpg output/myphoto.dzi --format jpg --quality 85

# Example — PNG tiles with overlap:
dotnet run --file scripts/generate-dzi.cs -- gigapixel.tiff output/gigapixel.dzi --tile-size 256 --overlap 1

Options

Option Default Description
--tile-size 256 Tile size in pixels
--overlap 1 Tile overlap in pixels
--format png Output format: png or jpg
--quality 90 JPEG quality (1–100)

How it works

  • Computes maxLevel = ceil(log2(max(width, height)))
  • Generates all levels 0 → maxLevel (level 0 is 1×1, each level doubles)
  • Writes tile files to {output}_files/{level}/{col}_{row}.{format}
  • Writes DZI XML descriptor at the output path

Requirements

  • .NET 10 SDK (uses file-based apps feature)
  • SkiaSharp is auto-restored via the #:package directive — no project file needed

A reusable .NET 10 file-based app that generates Deep Zoom Image (DZI)
tile pyramids from any source image using SkiaSharp.

Usage:
  dotnet run --file scripts/generate-dzi.cs -- <input> <output.dzi> [options]

Options:
  --tile-size  Tile size in pixels (default: 256)
  --overlap    Tile overlap in pixels (default: 1)
  --format     Output format: png or jpg (default: png)
  --quality    JPEG quality 1-100 (default: 90)

Generates all levels from 0 (1×1 pixel) up to the max level determined
by log2(max(width, height)), creating standard DZI-compatible tiles.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
github-actions bot pushed a commit that referenced this pull request Mar 14, 2026
@github-actions
Copy link

📖 Documentation Preview

The documentation for this PR has been deployed and is available at:

🔗 View Staging Documentation

🔗 View Staging Blazor Sample

This preview will be updated automatically when you push new commits to this PR.


This comment is automatically updated by the documentation staging workflow.

@mattleibow
Copy link
Collaborator Author

Superseded by PR #381 which includes both the generator script and the regenerated 16-level testgrid (32768×32768).

@mattleibow mattleibow closed this Mar 14, 2026
github-actions bot pushed a commit that referenced this pull request Mar 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant