ham_convert

ham_convert is a freeware (also free for commercial use) graphic converter written by Sebastian Sieczko (mrsebe) that can convert a normal jpg/gif/png image to one of the graphic modes of the Commodore Amiga. It was written in java and should work on any operating system supported by the JRE8 or newer. It can produce ILBM IFF files (Amiga-compatible EHB, HAM6, HAM8, 4/8/16/32/64/128/256-color modes).

Feel free to send bug reports or feature suggestions. Contact e-mail is provided in the application (click on the copyright note at the bottom-left of the window). You also can post comments on this page.

I send thanks to the following people who helped me with testing and gave some interesting ideas:
Tomasz Rachwal, cholok

ham_convert 1.2.1

ham_convert 1.2.1

Features
  • ILBM IFF file generation (HAM6, HAM8, EHB, 4/8/16/32/64/128/256-color modes) with optional lossless compression. Hires and lace flag control is also available.
  • Dithering modes: Bayer, Atkinson, Floyd–Steinberg, Jarvis, Judice, and Ninke, Sierra Lite, 2-row Sierra, 3-row Sierra, Checks (includes a special line version for HAM6 introduced in 1.2.2 beta).
  • Dithering propagation factor selection (5%-100%, most used values: 75%, 85%, 100%).
  • Dual mode – dual pixel HAM error calculation. This feature exploits the dependence of the possible set/modify operations of the next pixel on the choice made in current pixel in the same line. Supported in all HAM modes. Extended to triple and quad mode.
  • Triple mode (HAM6) – the same but with three pixels. That makes it both much slower and more efficient. Use this option for HAM6 over dual mode unless you’re really impatient. Enabled by default since 1.2.2 beta.
  • Quadruple mode (HAM6, since 1.2.2 beta) – the same but with four pixels. Warning: very slow, experimental.
  • Build-in palette generator using the Java Advanced Imaging library. The NeuQuant Neural-Net image quantization algorithm is used by default. There are several modes. Mode 0 is a fast single-pass mode for slower computers. Multi-pass modes: 1-safest that doesn’t look great but always gives acceptable result with no side-effects. Other modes eliminate some very similar colors from a bigger palette to make palette more diverse and make room for colors of smaller details that wouldn’t normally appear in the palette. Mode 7 is the most aggressive and should be used with caution because it eliminates more colors than other mores and it can make the resulting picture look unnatural.
  • Color reduction is performed only when the source image contains more colors that is allowed in the selected Amiga mode. In OCS modes these colors still need to be converted to 12-bit RGB colorspace, so the image won’t look identical but very close. This allows the user to perform color reduction in a different program and use ham_convert to just save as an iff image.
  • Multithreaded HAM6 palette optimization. Attempts to minimize average error by inserting colors from the source image. Unlike previous methods this one performs HAM6 conversion each time to measure how palette modification affects average error. Its more efficient and reliable than CIEDE HAM palette generator but very slow. There is also a turbo switch that reduces source palette to 256 colors prior to calculation for a big speedup with little quality loss.
  • Batch conversion.
  • Importing a palette from a file (JASC palette file format).
  • Color mapping in non-HAM indexed modes is performed optionally using the CIEDE2000-based color difference function.
  • HAM map generation. It’s an image that illustrates what type of operation was used on every pixel of the HAM image. Legend: red – modify red, green – modify green, blue – modify blue, black – set.
  • Error map generation (saved together with the ham map). Brightness represents the color distance between the calculated ham pixel and the corresponding pixel of the source image (normalized to 0-255). Greater distance=brighter pixel.
  • Sample palette files of the various vintage home computers from the 80s like Commodore 64 and Atari 800xl. Use them with the 256-color mode.
  • Cli mode: java -jar ham_convert_1.1.1.jar full_image_path mode (example: java -jar ham_convert_1.1.1.jar C:\img\test.png ham6).
    • Parameter 1-source file path.
    • Parameter 2-mode: ham6, ham6_slow (ham6 with palette optimizer), ham8, ocs4, ocs8, ocs16, ocs32, ehb, aga64, aga128, aga256, dynamic_hires. None specified=ham6.
    • Parameter 3-optional settings: dither (enable Floyd-Steinberg dithering for most modes, Bayer+Floyd-Steinberg 75% for DynamicHires), norle (disable lossless iff rle compression).
    • Parameter 4-optional settings 2: norle (disable lossless iff rle compression, used if param. 3 was set to dither).
Supported modes
  • HAM-6 mode – 2 control bits+4 bits of data, 16-color palette, 12-bit color space (Amiga OCS/ECS), experimental dithering support. Note: the most common way to minimize fringing in HAM modes is to oversaturate and overbright the pictures so there are few dark tones close to each other and few tones close to grayscale.
  • HAM-8 mode – 2 control bits+6 bits of data, 64 color palette, 24-bit color space (Amiga AGA). The only mode supported in the earliest versions of the program. Later work moved into HAM6 and that mode is best supported.
  • HAM-10 mode – 2 control bits+8 bits of data, 256 color palette, 24-bit color space (unfinished Amiga AAA).
  • 64-color EHB (Extra Half-Brite) mode – 32 colors+the same 32, but with halved brightness, 12-bit color space (Amiga OCS/ECS).
  • OCS/ECS indexed modes – 4-32 colors, 12-bit color space.
  • AGA indexed modes – 64-256 colors, 24-bit color space.
  • Color bit depth reducer for RGB bit depth reduction (every combination of 1-8 bits per channel).
  • ZX Spectrum mode – 15 colors divided into two palettes: bright1 and bright0. Two colors for every 8×8 pixel block, both from bright1 or both from bright0.
  • ZX Spectrum 8×1 mode available in some ZX Spectrum clones like Timex Sinclair, Pentagon. This mode uses a 8×1 pixel block size to improve the color resolution. The rest is the same as in normal mode.
  • C64 hires and multicolor modes.
  • Commodore Plus/4 hires and multicolor modes.
  • MSX screen2 – 2 colors out of 15 every 8×1 block.
  • VGA fakemode: fake 18-bit hicolor mode used to simulate more than 256 colors at once on a normal VGA card.
  • Sliced variants of HAM and indexed modes – different palette every horizontal line for better color reproduction.
  • Dynamic HiRes mode – 16-color palette, up to 14 new colors every line. On pre-AGA Amigas this software mode allowed displaying more than 16 colors in high resolution modes that didn’t support HAM and more than 16 colors at once.
Examples
  • Real hardware screenshots by retronav.
  • Test image – Mielno, Poland (54°15’44.0″N 16°03’06.8″E). Testing platform: WinUAE 3.0.0., emulated Amiga 1200 with 4 MB fast ram, clean installation of Workbench 3.1, no RTG.
Mielno - original image

Mielno – original image

Mielno - ham8 image on Deluxe Paint 5

Mielno – ham8 iff image (Deluxe Paint 5)

Mielno - ham map (ham8)

Mielno – ham map (ham8)

7 thoughts on “ham_convert

  1. Any chance for Gameboy Color support? It uses 8 palettes, 4 colors per each. Each palette is applied to 8*8 pixel block (tile). Kind of Speccy on steroids since you can have 4 colors per tile and twice as much to choose from. 🙂

    • I can’t promise anything. I will do some research but currently I’m concentrating my work on Amiga modes. Non-Amiga modes aren’t fully implemented and they use an almost brute-force approach to palette generation. Game Boy Color has a palette of 32,768 colors so the number of combinations it too high to check them all. NeuQuant algorithm which I use for color reduction doesn’t work well with less than 16 colors.

      • Oh, I see. I’m not familiar with this stuff so I just asked seeing that there’s support for other 8bit platforms. No problem!

  2. Nice converter! I’ve noticed the IFF saving option being disabled by modes that change the palette on a line by line basis. Would it be hard to implement writing the palette changes as PCHG chunk? Or at least as another simple text format file so it’s possible to convert it to a program/copperlist for the real machine!?

    • I’ve never had time to finish coding the sliced modes. There aren’t fully Amiga-compatible because in reality in 16-color mode not all 16 can be changed and with more colors it gets even worse. According to this document: http://wiki.amigaos.net/wiki/ILBM_IFF_Interleaved_Bitmap#ILBM.PCHG “in laced pictures the changes can only happen on even lines”.
      Number of color changes per line line can be selected in the DynamicHires mode, and in the latest beta version palettes are written to a png image (it was used for debugging but I’ve enabled it in the beta version).
      PCHG IFF support will be added after the current 1.2.0 release.

Leave a Reply

Your email address will not be published. Required fields are marked *