The Iron Code

decorative triangles

Programming

Bits and bytes. Still my favorite kind of chaos, just a bit more intentional these days.

As mentioned on the about page: I spent many years in C++. These days, almost everything I build is Rust. Being a father means time is limited, so I choose tools that let me ship without daily wrestling matches. Rust gives me that way more often than C++ did. I care a lot about boring deploys, predictable builds, and code I can trust six months later.

image-compare

My newest project is image-compare. It's a crate for comparing images. It has cucumber tests, score outputs, and diff-image generation. Below is a food example: pad gaprao with egg and riceberry rice. First image is original, second one is intentionally broken. Third image is RMS: great for hard pixel differences, but a bit weak for the oily blur effect. Fourth image is MSSIM (8x8 windows): blurrier look, but better at perceived structure changes, at least to my eye. Pick the one that matches your problem. In practice I often run both and compare where they disagree.
original image of stir-fried holy basil with two fried eggs and riceberry rice
The original food
Image version of pad gaprao deliberately destroyed
Destroyed version
diff image produced with RMS algorithm
Diff image with RMS grayscale
diff image produced with MSSIM algorithm
Diff image with MSSIM grayscale
In the 0.2 series, I added histogram support and several RGB modes: MSSIM per channel, RMS per channel, and "hybrid compare". Hybrid compare converts to YUV, runs MSSIM on Y and RMS distance on UV. Reading the diff takes a minute: black means no difference, red means Y difference, and blue/green/cyan mostly mean color-only differences. RMS is strong on color differences. MSSIM is strong on structure differences. Hybrid tries to combine both. Not a silver bullet, but often a better signal for real images.
Image version of pad gaprao broken in structure and color in different places
Image destroyed with median filter (structure) and color filter in different places
diff image produced with RMS RGB algorithm
Diff image with RMS RGB
diff image produced with MSSIM RGB algorithm
Diff image with MSSIM RGB
diff image produced with hybrid comparison algorithm
Diff image with "hybrid compare"
In the upcoming 0.3 release, hybrid compare goes RGBA with two strategies. Strategy one: split to YUVA and use RMS on alpha, weighted by mean alpha because translucent pixels can look similar even when raw values differ a lot. Strategy two: blend RGBA onto a chosen background and compare in RGB. That's more viewer-centric: transparent and white can look the same on white, but very different on black. First method measures raw difference. Second method measures visible difference for a given background. For UI and rendering checks, that background-aware mode matters a lot.
A red underlined '100' on transparent background
A text image on transparent background
A typed '10ß' with gradient underlining
Color changes with red outline
diff image produced with RGBA hybrid algorithm
Diff image with hybrid comparison: structure in red, color differences in blue and green

Lazy async promises and a blog reader for this blog

The blog reader is a small side project. Goal was simple: combine egui with async/await on tokio, without turning everything into callback soup. The lazy async promise crate is here, and on crates.io as "lazy_async_promise". It's still early and incomplete, but I'm building it out and might do a short post series on the design decisions. I mostly build it when I need it in real tools, not as a pure framework exercise.
blog reader application in loading state
blog reader application showing a post