When I looked at TLM's new converter for his HD Picture Viewer's new version, I suppressed a shudder of disgust (Razz) 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!
Thank you so much Tari! I've made some changes since you started the port (mostly adding zx0 compression and image resize options) so I'll take a look at the source and see how I can implement those. The site looks great and easy to use. Great work!
Wow I just asked for this not to long ago this is amazing I saw some work on this in SAX. Great job.
I've updated this to emit images compatible with version 2.0.0-beta.1, as well as now using libimagequant to palettize images (same as convimg).
I've pushed a few updates to this after checking that the v2.0.0 viewer still works with images converted by this tool. Most notably I discovered a bug that caused conversion to fail in the webapp when run during January (because Javascript Dates use 0-based months and basically everybody else uses 1-based months where January is 1), and I've updated the links and help text to reflect that it works with v2.0 of the viewer..
Hey uhm i just have one question how do you open the image?
You use TLM's viewer, as the links in this thread and on the tool's web page say.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement