Skip to content
rheitPublic

About

Convert IFF ILBM/ANIM files to GIFs

Resources

Stars

16 stars

Watchers

4 watching

Forks

Repository files navigation

build workflow

iff2gif

Convert IFF ILBM/ANIM files to GIF files

ILBM and ANIM were very popular formats on the Amiga. ILBM also saw some limited use on other platforms in the early '90s, while ANIM never really made its way off of the Amiga. This program will convert them both to GIF, which has more widespread support across several platforms.

For animations, iff2gif tries to minimize the amount of data per frame. The first frame is stored in its entirety. Succesive frames only store the rectangular regions that contain actual changes. Within that region, unchanged pixels may either be stored as-is or substituted with a transparent color, depending on which iff2gif decides results in smaller image data.

Usage

Usage: iff2gif [options] input file [output file]

The output file name is optional. If not provided, it will be generated by attaching a .gif extension to the input file name.

Options

  • -c frame-list
    Clips out the specified frames from the input file and only writes those to the output file. This accepts both a single frame or a range of frames of the form start-end. If the start frame of a range is omitted, frame 1 is implied. If the end frame of a range is omitted, the range continues to the final frame of the input file. Multiple entries may be separated by commas.

    Examples:

    • -c -50
      Write the first 50 frames.
    • -c 50-
      Skip the first 49 frames, and write all the rest.
    • -c 10,20,30
      Only write frames 10, 20, and 30.
    • -c 1,15-20
      Write frame 1 and frames 15-20.
  • -f
    Write each frame to a separate file. If the output file name has a series of 0s at the end before the file extension, they will be replaced by the frame number. This will dynamically expand if the field width isn't large enough for the frame number. Note that 0s embedded in the middle of the filename will not be replaced with the frame number. They must be at the end of the filename.

    If there are no 0s to replace, then the frame number is inserted before the extension. In this case, if the input file contains a DPAN chunk, the frame count stored in it will be used to decide how many 0s to pad with.

    Examples with the -f option:

    • For the output file name "funtime-00.gif", frame 1 will be written to "funtime-01.gif". Frame 12 will be written to "funtime-12.gif". If there is a frame 1000, it will be written to "funtime-1000.gif"
    • For the output file name "hello.gif" and the input file has a DPAN chunk that indicates 156 frames, frame 1 will be written to "hello001.gif". Frame 10 will be written to "hello010.gif". Frame 100 will be written to "hello100.gif".
    • For the output filename "world.gif" and the input file has no DPAN chunk, frame 1 will be written to "world1.gif". Frame 10 will be written to "world10.gif". Frame 100 will be written to "world100.gif". And so on.
  • -m
    Use the video mode stored in the file to determine the aspect ratio instead of using the aspect ratio recorded in the BMHD chunk. Hires and interlaced super hires images are vertically doubled, super hires images are vertically quadrupled, and interlaced lores images are horizontally doubled in order to preserve the aspect ratio they had on the Amiga.

    Aspect ratio correction is applied on top of the scaling specified with the -s, -x, or -y options.

  • -n
    No aspect ratio correction. The image will only be scaled according to the -s, -x, or -y options.

  • -r frame-rate
    Write the GIF with the specified frame rate instead of the one from the ANIM.

  • -s scale
    Set both horizontal and vertical scale to the same value. Must be an integer greater than 0.

  • -x X scale
    Set horizontal scale. Must be an integer greater than 0.

  • -y Y scale
    Set vertical scale. Must be an integer greater than 0.

  • -t Frame timing mode
    Set frame timing mode. 0 makes ANIM frame times relative to the start of the current frame. 1 makes ANIM frame times relative to the start of the preceding frame. (1 is what the spec says to use.) Omit this option or use any other value to try and autodetect which timing mode to use.

  • -u Disable "unipalette" detection
    When a CMAP chunk contains nothing but the same color, a grayscale palette is normally used instead. This option disables that detection and uses the palette as given, even though it means you won't see anything in the output GIF.

Limitations

24-bit (aka "Deep ILBM") and HAM images will be converted to paletted images. If there are more unique colors than can be represented with a palette, then some color information will be lost.

Build instructions

Requirements

Common
Windows
  • Microsoft Visual Studio 2017 or higher with C++ workload selected (download here)
Linux
  • make
  • gcc
  • libc6-dev package on Debian-based distributions, glibc on RPM and Arch-based distros

How to build

Windows
  1. Open the Developer Command Prompt for Visual Studio.
  2. Run cd project_path, substituting project_path correspondingly.
  3. Run cmake . to generate a Visual Studio solution.
  4. Either open iff2gif.sln in Visual Studio or run msbuild -m iff2gif.sln to build the solution from the command line.
    msbuild will build a debug version by default, use msbuild -m -p:Configuration=Release iff2gif.sln to build a release version.
    Executable file will be in either Debug or Release directory depending on the configuration.
Linux
  1. Open a terminal window.
  2. Run cd project_path, substituting project_path correspondingly.
  3. Run cmake . to generate a Makefile.
  4. Run make to build the project.
    Executable file will be in the project root, you can run it with ./iff2gif.

About

Convert IFF ILBM/ANIM files to GIFs

Resources

Stars

16 stars

Watchers

4 watching

Forks

Releases

Packages

Used by

Contributors

Languages