As part of my MODE 7 explorations I've written a general purpose image to teletext convertor. It's early days, and command-line only I'm afraid, but I thought I would share it on here for testing & feedback and to see what people might be able to do with it.
Executable is attached in the zip. Usage for the app is as follows:
Code: Select all
image2mode7: MODE 7 image convertor.
Usage : image2mode7 [options] (Sep 20 2016, 21:48:19)
-i 0 Input filename
-o 0 Output filename
-sat 64 Saturation threshold (below this colour is considered grey)
-val 64 Value threshold (below this colour is considered black)
-black 64 Black threshold (grey below this considered pure black - above is colour brightness ramp)
-white 128 White threshold (grey above this considered pure white - below is colour brightness ramp)
-nohold false Disallow Hold Graphics control code
-nofill false Disallow New Background control code
-test false Save test image (post-quantisation) before Teletext conversion
-inf false Save inf file for image
-v false Verbose output
-url false Spit out URL for edit.tf
Where second column is the default value. Output filename is optional (otherwise just adds .bin to input filename.) Takes jpg & png format as input only.
Here are some examples (not sure if this is going to put the pics inline or not!)
Note this is a hard problem to solve so lower your expectations for what can be achieved!! I cannot claim full credit for the work as this is based on an algorithm created by Julian Brown for the VIA/Neurotypical demo from a few years ago. I dusted it off, got it working, rewrote it to understand it better, and speed it up a bit, then added support for the Hold Graphics mode. Source is on GitHub buried in a branch but I will post a clean repo for it.
The algorithm does sometimes produce weird and funky sequences of control codes, so could do with some further investigation and debugging, but overall it seems to work. Given the command-line parameters are a bit opaque, it could do with a lovely Windows app with real-time preview to tweak the values with sliders but I don't really write Windows apps (oh, the irony.)
I'll post more about how the algorithm works tomorrow (getting a bit late now) but enjoy and let me know if you manage to produce anything fun with it.
Note that the current version of Image2BBC_ImportTTX tool has a bug which doesn't handle Hold Graphics properly, so you may end up with black character gaps. Use your favourite emulator, e.g. B-Em or jsbeeb, for better preview or use the -url option to spit out an edit.tf URL and just paste it into your browser.