Skip to content

[Feature] Image asset loader #139

Open

Description

@vmarcella

Overview

Add an asset loader for common image formats that produces GPU-ready texture
data.

Current State

No response

Scope

Goals:

  • Load PNG images
  • Load JPEG images
  • Load BMP images
  • Convert to GPU texture format
  • Handle sRGB vs linear color space

Non-Goals:

  • DDS/KTX compressed formats
  • HDR images
  • Animated images

Proposed API

pub struct ImageLoader;

impl AssetLoader for ImageLoader {
  type Asset = ImageAsset;
  type Error = ImageError;
  
  fn extensions(&self) -> &[&str] {
    &["png", "jpg", "jpeg", "bmp"]
  }
  
  fn load(&self, path: &Path, bytes: &[u8]) -> Result<ImageAsset, ImageError>;
}

pub struct ImageAsset {
  pub width: u32,
  pub height: u32,
  pub format: TextureFormat,
  pub data: Vec<u8>,
}

impl ImageAsset {
  pub fn to_texture(&self, gpu: &Gpu) -> Texture;
}

Acceptance Criteria

  • Load PNG with transparency
  • Load JPEG images
  • Detect sRGB and use correct format
  • Provide dimensions before GPU upload
  • Handle corrupted images gracefully

Affected Crates

lambda-rs, lambda-rs-platform

Notes

  • Consider using image crate for decoding
  • RGBA8 as intermediate format

Activity

  1. added
    enhancement
    lambda-rs
    lambda-rs-platform
    assets
    on Jan 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    assetsenhancementlambda-rslambda-rs-platform

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions