High Definition Image Manipulator
I built HDIM (High Definition Image Manipulator) to bring a modern, non-destructive image editing experience directly to the terminal. Built in Rust using Ratatui, the application leverages 24-bit TrueColor half-block rendering to display high-detail image previews in terminal viewports while supporting real-time perceptual color adjustments, EXIF metadata extraction, and a complete undo/redo history stack.
Half-Block Viewport Mapping & Color Sampling
To render detailed images within standard terminal constraints, HDIM maps each terminal character cell to two vertically stacked pixels using half-block characters (▀ / ▄). The View struct calculates scale ratios between source image pixels and terminal rows, while map_to_source locates the top and bottom half-block regions. The get_average_rgb function then calculates the mean RGB color for each region to deliver smooth downscaling across dynamic terminal grid sizes.
Perceptually Uniform Color Adjustments
Instead of performing naive RGB arithmetic which can cause color clipping, image processing functions convert pixels into perceptual color spaces like Lch using the palette crate. The apply_brightness function transforms RGB channels into Lch representations, modifies the lightness (l) channel uniformly within valid bounds [0, 100], and converts the result back to sRGB to ensure natural contrast shifts during editing.
Non-Destructive Undo/Redo State Stack
To support full non-destructive editing, HDIM encapsulates image transformations inside a History state manager. Image data is wrapped in atomic reference-counted smart pointers using DynamicImage to eliminate unnecessary deep copying during state pushes. When a user records a new adjustment after undoing, the stack automatically truncates future states before appending the new state.
Modular Crate Architecture
By decoupling core image mathematics (hdim-core), rendering math (hdim-render), and terminal UI layout (hdim-tui), HDIM achieves clear separation of concerns across a multi-crate workspace. The design ensures high terminal responsiveness while giving users granular control over metadata, image spatial transformations, and non-destructive image adjustments directly from their terminal.
Try It Out
DownloadIf you want to try this app out for yourself, click on the download button and install hdim.rar from GitHub, extract the .rar file and run the hdim executable. Alternatively you can use "cargo install hdim".
Video Demonstration
External Media Required
This video requires third-party cookies from YouTube to be displayed. Accepting will enable all external media across the site.