hamify

hamify

Information

hamify converts image files into Amiga OCS HAM6 mode. It supports a few quality modes for choosing trade-off between speed and quality. It can automatically scale images down to the native Amiga resolution, taking optional interlacing into account. It can also apply dithering for better results.

It is designed to have little external dependencies and be portable. It only requires a C++17 compiler (GCC recommended) and can optionally support libSDL for reading more image formats. Without SDL, it reads binary PPM files.

It can output ILBM IFF files, or PPM with pixel values chosen to match HAM6 requirements.

hamify is free software released under the GNU General Public License V3 or later. For details read COPYING.

hamify (C) 2024 Ralf Hoffmann.

Features

Download

The current release is hamify 0.1 (171 kB) (signature) from 2024-02-10.

Changes

Requirements

Installation

Compile it with
$ ./configure && make
You can install it with "make install", but you don't have to. It is a stand-alone program with no additional files required for execution.

hamify can use SDL if installed for more input image file type support, but it can compile without SDL too.

Usage

The most basic usage is:
hamify input.png -o output.iff
and if scaling and interlacing is wanted, use:
hamify input.png -o output.iff --scale --interlace
See the following section for all options.

Options

-V, --version
Print the program version and exit
-h, --help
Print help and exit
-o, --output=<path>
Set output file
-t, --type=<type>
Output type
Possible values: iff, ppm
--scale
Scale image to OCS LoRes
--interlace
Use interlace screen size
--adjust-interlace
When used without scaling, still adjust the width so the aspect ratio is correct on interlace screen.
--ntsc
Select NTSC screen size
--no-dither
Disable dithering when converting to OCS color space.
-q, --quality
Select quality (speed vs accuracy)
Possible values: 0 or fast, 1 or normal (default), 2 or good, 3 or best
fast and normal are reasonable fast, while good or best take signifcant amount of time to find most accurat representation.
-l, --ham-lookahead
Select type of lookahead mode for HAM calculation.
Possible values:
  • 0 for fast calculation
  • 1 use HAM step with lowest error
  • 2 use one lookahead pixel to choose best HAM step
Default value: 2
--compress
Enable ILBM compression
--quiet
Suppress regular output
--threads=<threads>
Use given number of threads for faster processing in good and best quality mode.
Defaults to number of threads available on system.

Example images

The images below show the conversion results for different types of images. A photo, a computer-generated graphic, and a random graphic. The conversion done by GIMP is shown for comparison of what would be the best possible result given the 4 Bit per channel color space limition of the OCS graphic mode.
Image description Conversions Conversion duration
(CPU AMD Ryzen 7 4800H)
Photo 1 - base image
Photo 1 - Gimp conversion OCS 12 bit color space (444) conversion w/o dithering
OCS 12 bit color space (444) conversion with FS dithering
Photo 1 - Hamify Quality Fast W/o dithering
With FS dithering
0.17 s
Photo 1 - Hamify Quality Normal W/o dithering
With FS dithering
0.85 s
Photo 1 - Hamify Quality Good W/o dithering
With FS dithering
20 s
Photo 1 - Hamify Quality Best W/o dithering
With FS dithering
165 s
Random plasma - base image
Random plasma - Gimp conversion OCS 12 bit color space (444) conversion w/o dithering
OCS 12 bit color space (444) conversion with FS dithering
Random plasma - Hamify Quality Fast W/o dithering
With FS dithering
0.09 s
Random plasma - Hamify Quality Normal W/o dithering
With FS dithering
0.37 s
Random plasma - Hamify Quality Good W/o dithering
With FS dithering
12 s
Random plasma - Hamify Quality Best W/o dithering
With FS dithering
118 s
Mandelbrot - base image
Mandelbrot - Gimp conversion OCS 12 bit color space (444) conversion w/o dithering
OCS 12 bit color space (444) conversion with FS dithering
Mandelbrot - Hamify Quality Fast W/o dithering
With FS dithering
0.07 s
Mandelbrot - Hamify Quality Normal W/o dithering
With FS dithering
0.45 s
Mandelbrot - Hamify Quality Good W/o dithering
With FS dithering
13 s
Mandelbrot - Hamify Quality Best W/o dithering
With FS dithering
128 s

Links