emilk / emilk/egui

Feature Request - Implement `Serializable` and `Deserializable` for `egui::Image`

Open
#3,919 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Rust
Stars
30.6k
Forks
2.1k
Avg merge
1d 9h
Merged PRs (30d)
72

Description

**Is your feature request related to a problem? Please describe.**
For my use-case, I need to be able to (de)serialize images. I'm fine with serializing just the bytes, but there's no way (that I know of) to get the bytes of the image.

**Describe the solution you'd like**
Implement `Serializable` and `Deserializable` for `egui::Image`, or at least for `egui::ImageSource`.

**Describe alternatives you've considered**
Alternatively, just create a `.get_bytes()` function in `egui::ImageSource`. I can then (de)serialize that and construct a new Image. The other approach would be more convenient tho.

**Additional context**
This is due to the deprecation of RetainedImage. Prior to this, I created a RetainedImage from a ColorImage, which I created from a `&[u8]`. Now there's no clear way of replicating that with `egui::Image`s.

---

Thank you for your amazing work!

Contributor guide

Open the contributing guide

Research direction

Start by locating the definitions of egui::Image and egui::ImageSource, then review how RetainedImage and ColorImage handled image bytes before their deprecation. Determine a supported serialization boundary and verify that serialized image data can reconstruct an equivalent Image or ImageSource.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.