tohgr

Description

tohgr: a very simple command line program to convert images in PNG, JPG, or XPM format to Apple II images.
Updated with changes by Mario Patino / Mario E. to support PNG and JPG images


Use it like this:

$ tohgr [options] a.xmp [options] b.png ... [options] z.jpg

Options accepted:

  -hgr   : convert following files to hires images
  -dhgr  : convert following files to double hires images
  -pack  : produce packed HGR/DHGR files (Filetype $08)
  -3200  : convert following files to 320x200 super hires 3200 color images
  -q [integer]  : quality value for super hires conversion (default = 16)
  -xpm : output preview files in XPM format instead of PNG
  -bmp : output DHGR file in BMP format

For every input file, tohgr will produce two output files: One is another file that approximates the appearance of the original image in Apple II hires or double hires graphics. The other output file is an Apple II file, which can be viewed on an Apple II computer. Hires and Double Hires files can be either raw memory images, which you can BLOAD into memory to view, or filetype $08 packed graphics images. Double hires memory images are stored as an 8192 byte auxiliary memory image followed by the 8192 main memory image. Super Hires images are stored as Apple Preferred Images (filetype $C0/$0002).

A Note About Super Hires Conversion: I am not currently really satisfied with the conversion to Super Hires. The results are decent but it takes too long. The conversion works by attempting to find a good palette for dithering each line by repeatedly dithering the line and improving the palette. The improvement step I use is not very great and acts to equalize the error between a palette entry and the each of pixels it replaces instead of finding a palette entry with minimum total error. This process tends to find local optima and so after each local optimum is found I randomly perturb the palette and repeat the iteration. The quality parameter "-q" listed above specifies how many times this will be attempted before giving up and using the best palette found so far.

Recent Changes

Problems

Executables

Mac (x86): tohgr.mac.zip (updated 12/26/14)
Mac (PPC): tohgr.pcc.gz (really old version)
Win (Win): tohgr.win.zip (updated 12/26/14)

Source Code

tohgr-source.zip (updated 12/26/14)

Note: If you wish to compile this program you must have libjpeg and libpng installed

Disk Images

3200 Color Images: pix.2mg.zip
DHGR Slideshow: BS1.DSK

Hires Samples (Scroll Down for Double Hires Below)

Original Image Approximate Hires Appearance

Using Atkinson Dithering

Double Hires Samples

Original Image Approximate Double Hires Appearance

Super Hires 3200 Color Samples

Original Image Approximate Super Hires 3200 Color Appearance