mktohgr is a utility for converting images for display on the Apple II, and is written using Ruby/GTK2.
|280x192 1bpp (monochrome)||560x192 1bpp (monochrome)||140x192 4bpp (16-color)|
|standard hi-res||double hi-res||double hi-res|
More supported formats like 40x48 and 80x48 lo-res and double lo-res are planned for the future. 140x196 (effectively 70x196 due to the way colors are selected) 3bpp standard hi-res mode may be tackled in the future - due to the nature of Apple II hardware and its severe color limitations in that mode, the algorithm will be more complicated.
mktohgr started out as a utility to convert images to display on the monochrome 280x192 Apple II 'hi-res' display. I knew that ImageMagick's excellent
convert utility could do the scaling, color reduction, dithering, etc, but there are many options that can be configured. So I wrote a GUI wrapper for the input picture configure options, and saved the output as a 1bpp xpm image; because of its nature it is easy to parse. I then read the xpm in and created an algorithm to write the pixels to a format the II can recognize. I then refactored the overall code to be modular in nature, and added new modes. I am now using imlib2 to read the pixel values of the converted image.
% ruby mktohgr.rb <mode> infile.jpg out.bin
Will pull up the graphical user interface and allow you to adjust before saving the file. The file can be transferred to a disk image with the excellent utility AppleCommander
% cat out.bin | java -jar AppleCommander.jar -p floppy.dsk OUT.BIN BIN
and then loaded into Apple memory by
] BLOAD OUT.BIN,A$2000 (for hi-res images) ] BLOAD OUT.BIN,A$1F00 (for double hi-res images that require a loader) ] BLOAD OUT.BIN,A$400 (for lo-res)
This is a work in progress. Things to do: