emilk / emilk/egui

Remove `image` dependency from `eframe` (currently necessary for `IconData`)

Open
#5,602 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
30.6k
Forks
2.1k
Avg merge
1d 9h
Merged PRs (30d)
72

Description

Currently, eframe has a mandatory dependency on the `image` crate. This is because of [the `eframe::icon_data::from_png_bytes` API](https://docs.rs/eframe/latest/eframe/icon_data/fn.from_png_bytes.html).

This could probably be replaced with [the `ImageLoader` API](https://docs.rs/egui/0.30.0/egui/load/trait.ImageLoader.html) and `ImageSource`, but there are a couple wrinkles in the API:

- It conflates image *loading* with image *decoding*; as far as I can tell, images are just blank until they're done asynchronously loading. This may not be what we want; we should probably set the window icon *before* starting the rest of the application.
- All other egui image APIs (e.g. `ColorImage`) return *premultiplied* images, whereas `IconData` stores non-premultiplied images. I'm not actually sure if that's correct for all platforms, but that's the current state of things. Also, `From for ColorImage` treats it like it *is* premultiplied, so that code in general should probably be cleaned up.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading eframe::icon_data::from_png_bytes and the egui ImageLoader, ImageSource, ColorImage, and IconData APIs. Resolve whether loading and decoding should remain synchronous for window icons and clarify premultiplied versus non-premultiplied pixels, including From for ColorImage. Done means eframe no longer requires image while icon handling remains correct across platforms.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
desktop-dev
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.