When I looked at TLM's new converter for his HD Picture Viewer's new version, I suppressed a shudder of disgust () when I saw it was implemented as a WinForms C# application that implements the actual conversion by running convimg in a subprocess.
What's a hacker to do? Reimplement it in a "better" way and provide it as a web application so it's more portable of course! So here's my converter written in Rust and built into a webapp:
https://taricorp.gitlab.io/hdpictureconverter-rs/
For loading and processing images I've used whatever library was convenient (image), but had to dig into what exactly convimg does with the options that TLM's converter runs it with; turns out it palettizes to 256 colors with two fixed entries (black and white) and emits 80x80 pixel blocks into individual appvars. convimg uses libimagequant for this, and although there are Rust bindings to it, it looked like cross-compiling to WebAssembly would be a little harder. I instead implemented palettizing with NeuQuant because there was a convenient implementation to use. Quality should be similar to libimagequant, though probably varies somewhat with the image to be converted; I wouldn't mind making libimagequant (or a reimplementation of the algorithm) available as an option.
Images are output as a downloadable zip file containing the appvars, though I'd also like to support b83/b84 bundles to simplify sending. It could emit individual 8xv files (and indeed the command-line non-webapp version does that), but that would be very cumbersome to use in a web browser since it needs to act like a file download. It uses a library I wrote for other uses to generate the appvar files, but which was convenient to use for this application as well so I broke it out .
The Rust code is run in the browser as WebAssembly, which should be supported in any reasonably new browser (basically every major browser supports it since 2019). I've also made it work offline and be installable, though that might not be a terribly important feature to anybody.
So that's that; you can explore the code on gitlab gitlab.com/taricorp/hdpictureconverter-rs or follow the link above to try out the tool. Discuss, provide suggestions, etc below!
What's a hacker to do? Reimplement it in a "better" way and provide it as a web application so it's more portable of course! So here's my converter written in Rust and built into a webapp:
https://taricorp.gitlab.io/hdpictureconverter-rs/
For loading and processing images I've used whatever library was convenient (image), but had to dig into what exactly convimg does with the options that TLM's converter runs it with; turns out it palettizes to 256 colors with two fixed entries (black and white) and emits 80x80 pixel blocks into individual appvars. convimg uses libimagequant for this, and although there are Rust bindings to it, it looked like cross-compiling to WebAssembly would be a little harder. I instead implemented palettizing with NeuQuant because there was a convenient implementation to use. Quality should be similar to libimagequant, though probably varies somewhat with the image to be converted; I wouldn't mind making libimagequant (or a reimplementation of the algorithm) available as an option.
Images are output as a downloadable zip file containing the appvars, though I'd also like to support b83/b84 bundles to simplify sending. It could emit individual 8xv files (and indeed the command-line non-webapp version does that), but that would be very cumbersome to use in a web browser since it needs to act like a file download. It uses a library I wrote for other uses to generate the appvar files, but which was convenient to use for this application as well so I broke it out .
The Rust code is run in the browser as WebAssembly, which should be supported in any reasonably new browser (basically every major browser supports it since 2019). I've also made it work offline and be installable, though that might not be a terribly important feature to anybody.
So that's that; you can explore the code on gitlab gitlab.com/taricorp/hdpictureconverter-rs or follow the link above to try out the tool. Discuss, provide suggestions, etc below!