Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
show-image
show-image
is a library for quickly displaying images.
It is intended as a debugging aid for writing image processing code.
The library is not intended for making full-featured GUIs,
but you can process keyboard events from the created windows.
Supported image types.
The library aims to support as many different data types used to represent images. To keep the dependency graph as small as possible, support for third party libraries must be enabled explicitly with feature flags.
Currently, the following types are supported:
- Tuples of binary data and
ImageInfo
. image::DynamicImage
andimage::ImageBuffer
with theimage
feature.tch::Tensor
with thetch
feature.
If you think support for a some data type is missing, feel free to send a PR or create an issue on GitHub.
Keyboard events.
You can handle keyboard events for windows using Window::wait_key
or Window::wait_key_deadline
.
These functions will wait for key press events while discarding key up events.
Alternatively you can use Window::events
to get direct access to a channel with all keyboard events.
Keyboard events are reported using types re-exported from the keyboard-types
crate for easy interoperability with other crates.
Saving displayed images.
If the save
feature is enabled, windows allow the displayed image to be saved using Ctrl+S
.
This will open a file dialog to save the currently displayed image.
Example 1: Showing an image.
This example uses a tuple of (&[u8], ImageInfo)
as image,
but any type that implements ImageData
will do.
use ;
let image = ;
// Create a window and display the image.
let window = make_window?;
window.set_image?;
Example 2: Handling keyboard events.
use ;
#
// Create a window and display the image.
let window = make_window?;
window.set_image?;
// Print keyboard events until Escape is pressed, then exit.
// If the user closes the window, wait_key() will return an error and the loop also exits.
while let Ok = window.wait_key