2D drawing + image + UI


I'm building an app to annotate certain images for machine learning purposes, and I'm a little confused regarding the vast ecosystem(s) that seem to exist in this space. I want to

  • load images from disk in various formats
  • display them on-screen
  • maybe resize them for that purpose
  • make annotations / shapes / lines using mouse and keyboard. it should be possible to draw on things that are not displayed (e.g. to have one version of the image with annotations in the gui, and save only the annotations with black background to a file)
  • save the image and annotations

Ideally, I think I'd like something that does the 2d drawing operations on a framebuffer that i could then save to disk and/or display in the UI, and the UI framework should provide some method of input handling.

So far, i've considered:

  • Speedy2D: i like the ui handling approach based around a trait with lots of optional methods. However, the 2d drawing operation seem to change some internal library state and i cannot find how to access the resulting framebuffer, or how to draw on things that are not being displayed.
  • minifb: Seems to get the separation of framebuffer and UI right, but i don't think it provides drawing primitives and i cannot find libraries that seem to be an obvious fit with it for that purpose.
  • image: Good interface around file types and basic image processing operations, but no drawing primitives, no ui (expected), and i feel like there should be an ecosystem of crates around this for other features, but i cannot find any.

There also seem to be lots of half-maintained crates doing some really specific thing with no obvious interface to a broader ecosystem.

I appreciate any input/suggestions any of you might have on this.

You can use tiny-skia to draw on minifb framebuffer.

1 Like

I’m the author of pixels, which has a handful of examples, including two with GUIs (using egui and imgui) and one with vector shapes (using raqote). You can use a crate like image for image decoding with any of these options.


1 Like

I think softbuffer will be of interest to you.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.