Skip to main content

Thumbnail Generation

The BaseImageStorageService includes thumbnail generation for single images, used by the frontend to display camera previews without loading full-resolution images.

Algorithm​

  1. Calculate the target dimensions while preserving the original aspect ratio
  2. Resize the image using System.Drawing / Emgu.CV
  3. Encode as JPEG
  4. Save to Blob Storage alongside the full image

Aspect Ratio Preservation​

The thumbnail maintains the source image's aspect ratio:

  • If the source is landscape (wider than tall), the width is used as the constraint
  • If the source is portrait (taller than wide), the height is used as the constraint
  • The other dimension is calculated proportionally

Where Thumbnails Are Used​

  • Frontend map β€” Camera pins show thumbnail previews on hover
  • Camera list β€” Compact image previews in admin dashboard tables
  • SignalR broadcasts β€” Thumbnail URLs are included in real-time metadata, allowing the frontend to display low-bandwidth previews instantly