File types · Explainer

The SGI image file (.sgi, .rgb, .rgba, .bw)

An SGI file is a Silicon Graphics image: the native raster format of SGI's IRIS workstations, a 512-byte header followed by the pixels, stored as is or with lossless run-length encoding, and still read by 3D, VFX and image tools. This guide explains what's inside one, how its run-length encoding works, what the different extensions mean, and how to open and convert it.

At a glance

Full name
Silicon Graphics Image, also called SGI RGB or IRIS RGB
Extensions
.sgi and .rgb; .rgba with alpha; .bw or .int for greyscale; .inta for greyscale with alpha
MIME type
None registered with IANA; image/x-sgi and image/sgi are used
Kind
Binary raster image; uncompressed (verbatim) or lossless run-length encoding
Standard or owner
Silicon Graphics; the SGI Image File Format specification, version 1.00, by Paul Haeberli
First released
On SGI's IRIS workstations, as the format of SGI's image library; already established by 1991
Channels
1 (grey), 3 (RGB) or 4 (RGBA), 8 or 16 bits each
Max size
65,535 × 65,535 pixels (16-bit width and height)
Magic number
01 DA (474), then a 512-byte header
Opens with
GIMP, ImageMagick, Pillow, FFmpeg, Netpbm, Blender and Autodesk FCheck; not web browsers

The basics

What is an SGI image file?

SGI is the image format of Silicon Graphics, the maker of the IRIS workstations that were standard equipment for 3D graphics, film effects and scientific visualisation in the late 1980s and the 1990s. It was the file format of SGI's image library, libimage, which programs on IRIX used for screen dumps, greyscale and colour images, and image tools. Paul Haeberli of SGI wrote up the format as the SGI Image File Format specification, version 1.00.

The design is simple: a fixed 512-byte header, then each channel stored as a separate plane of rows, either raw or with run-length encoding (RLE). It handles greyscale, RGB and RGBA, at 8 or 16 bits per channel.

SGI workstations are long gone, but the files aren't:

  • 3D and VFX tools still read them. Autodesk's FCheck image viewer, which comes with Maya, opens .rgb, .sgi and .bw files, and Blender reads and writes the format under the name Iris, at 8 or 16 bits with alpha.
  • Textures and rendered image sequences in older 3D projects and archives.
  • Video test material. The master files of the SVT High Definition Multi Format Test Set, a series of video test sequences, are SGI images.

For new work, PNG covers the same 8 and 16-bit lossless cases with better compression, and EXR is the VFX standard for high dynamic range.

Anatomy

What's inside an SGI file

An SGI file is a 512-byte header, then, in a run-length encoded file, two tables that say where each compressed row is, then the rows. All numbers are big-endian. Below is a 590-byte file we made for this page with Netpbm's pnmtosgi and checked in four decoders: 3 × 2 pixels, red, green and blue on top, yellow, white and black below. Most of the header is zeros, shortened here. It isn't offered for download.

tiny.sgi (hex, 590 bytes)
tiny.sgi: 3 × 2 pixels, RGB, run-length encoded, 590 bytes

offset  bytes                        header field (big-endian)
0000    01 DA                        magic: 474
0002    01                           storage: 1 (RLE)
0003    01                           bytes per channel: 1
0004    00 03                        dimension: 3
0006    00 03  00 02  00 03          xsize 3, ysize 2, zsize 3 channels
000C    00 00 00 00  00 00 00 FF     pixmin 0, pixmax 255
0014    00 00 00 00                  unused
0018    39 39 68 65 6C 70 65 72 73 00 …
                                     image name "99helpers" (80 bytes)
0068    00 00 00 00                  colormap: 0 (normal)
006C    00 00 00 …                   404 unused bytes, to offset 512

0200    00 00 02 30  00 00 02 35  00 00 02 3A
        00 00 02 3F  00 00 02 44  00 00 02 49
                                     start table: where each row begins
0218    00 00 00 05  × 6             length table: each row is 5 bytes

0230    02 FF 81 00 00               red,   bottom row: FF FF 00
0235    83 FF 00 00 00               red,   top row:    FF 00 00
023A    02 FF 81 00 00               green, bottom row: FF FF 00
023F    83 00 FF 00 00               green, top row:    00 FF 00
0244    83 00 FF 00 00               blue,  bottom row: 00 FF 00
0249    02 00 81 FF 00               blue,  top row:    00 00 FF
  1. 101 DA

    Magic number

    474 as a big-endian 16-bit number. Every SGI image starts with these two bytes, whatever its extension.

  2. 201 01

    Storage and precision

    Storage 1 means run-length encoded, 0 means verbatim (uncompressed). Bytes per channel is 1 for 8-bit images or 2 for 16-bit.

  3. 300 03

    Dimension

    3: the image has several channels. 1 means a single row, and 2 a single greyscale channel; with 1 or 2, the later size fields that don't apply are ignored.

  4. 400 03 00 02 00 03

    Width, height, channels

    3 pixels wide, 2 rows high, 3 channels (red, green, blue). A greyscale image has 1 channel and an RGBA image 4.

  5. 500 00 00 00 00 00 00 FF

    Pixel range

    The smallest and largest pixel values in the image: 0 and 255, so 255 is full brightness.

  6. 639 39 68 65 6C 70 65 72 73 00

    Image name

    Up to 79 characters of text and a zero byte, in an 80-byte field. Here 99helpers, set with pnmtosgi -imagename.

  7. 700 00 00 00 (colormap)

    Colour map field

    0 means normal pixels. The other values (1 dithered, 2 screen, 3 colour map) were for special SGI cases; two of them are obsolete. The header then pads with zeros to 512 bytes.

  8. 800 00 02 30 …

    Start table

    In an RLE file, one 4-byte offset per row per channel: height × channels entries, here 6. The entry for row r of channel c is number r + c × height. These say the first compressed row starts at byte 560.

  9. 900 00 00 05 × 6

    Length table

    The compressed length of each row, in the same order. Every row here is 5 bytes. Two rows with identical data are allowed to point at the same bytes.

  10. 1002 FF 81 00 00

    A compressed row

    02: top bit clear, so repeat the next byte 2 times: FF FF. 81: top bit set, so copy the next 1 byte as is: 00. 00 ends the row. That's the red values of the bottom row: full red in yellow and in white, none in black.

  11. 1183 FF 00 00 00

    Rows by channel, bottom up

    The second row in the table is the red channel's top row: 83 copies the next 3 bytes, FF 00 00, for red, green and blue pixels. Rows come per channel, all red rows first, and within a channel from the bottom row up.

Compression

Verbatim or run-length encoded

In an RLE file, each row of each channel is compressed on its own. Two tables follow the header at byte 512: the offset of each compressed row, then the length of each, height × channels entries of 4 bytes each. Rows can be anywhere in the file and in any order, and identical rows can share data. Each compressed row is a series of packets:

Count byteMeaning
Top bit set (81 to FF)Copy the next count bytes as they are
Top bit clear (01 to 7F)Repeat the next byte count times
00End of the row

The count is the low 7 bits, 1 to 127. For 16-bit images, the count and values are 16-bit instead of bytes. Note that the meaning of the top bit is the opposite of TGA's run-length encoding and of PackBits, where a set top bit means a run: porting a decoder from one to the other is a classic source of bugs.

RLE pays off on flat areas such as graphics, masks and renders with plain backgrounds, and does little for photos or noise, where it can make the file slightly bigger. Either way it's lossless. For our tiny example, RLE made the file larger (590 bytes against 530) because of the tables.

Variants

.sgi, .rgb, .rgba, .bw: one format, several names

All of these are the same format. The extension only hints at the number of channels; the header's ZSIZE field is what counts.

ExtensionUsual contentsChannels
.bw, .intGreyscale1
.intaGreyscale with alpha2
.rgbColour3
.rgbaColour with alpha4
.sgiAny of the above1 to 4

Not every .rgb file is an SGI image: the extension is also used for raw RGB pixel dumps with no header. If the first two bytes aren't 01 DA, it isn't SGI, and you need the width and height from somewhere else to read it.

Comparison

SGI vs TGA, TIFF and PNG

SGITGATIFFPNG
CompressionNone or RLENone or RLENone, LZW, Deflate, JPEG and moreDeflate
Bits per channel8 or 16Up to 88, 16, 32-bit float and moreUp to 16
AlphaYesYesYesYes
Signature at the start01 DANone49 49 2A 00 or 4D 4D 00 2A8-byte signature
MetadataAn 80-byte nameImage ID, v2 extension areaExtensiveText, Exif, colour profiles
BrowsersNoNoOnly SafariAll

SGI and TGA are siblings from the same era: simple headers, optional RLE, bottom-up rows. SGI's advantage was 16-bit channels; TIFF and PNG now do that and much more.

How to

How to open and convert an SGI file

  • GIMP opens and saves SGI files (.sgi, .rgb, .bw), on Windows, macOS and Linux.
  • ImageMagick: magick texture.rgb texture.png, or magick input.png -compress RLE output.sgi to write an RLE file (convert in ImageMagick 6).
  • Pillow: Image.open("texture.rgb").save("texture.png"). Pillow writes SGI files too, uncompressed.
  • Netpbm: sgitopnm texture.rgb > texture.ppm, and pnmtosgi -rle or -verbatim the other way.
  • FFmpeg: ffmpeg -i frame%04d.sgi frame%04d.png converts a numbered sequence in one go.
  • Blender loads SGI files as Iris images and can render to the format.

Converting to PNG is lossless for 8 and 16-bit images, alpha included. Browsers don't display SGI, so convert before putting images on the web.

Troubleshooting

Common SGI problems

  • The image is upside down. The reader ignored the bottom-up row order. Flip it, or use one of the converters above.
  • The image is noise or a reader rejects it. The file is a raw .rgb dump without a header, not an SGI image. Check for 01 DA at the start.
  • Stripes or wrong colours in an RLE file. A hand-written decoder used TGA's or PackBits' meaning of the top bit, or read the offset tables in the wrong order (all rows of one channel come before the next channel).
  • A 16-bit image looks black or wrong. The program reads only 8-bit SGI files, or treats the 16-bit values as little-endian. Convert with ImageMagick or Pillow to 16-bit PNG.
  • An alpha channel is ignored. The program reads only the first 3 channels. Check ZSIZE: 4 means there's alpha.

An SGI file contains pixels and a short name, nothing that runs. As with other formats, crafted files have hit bugs in decoders: Pillow fixed an out-of-bounds read in its SGI RLE decoder in version 8.1.1 (CVE-2021-25293). Keep image libraries updated, and check that RLE offsets and lengths stay inside the file before trusting them.

Sample files

There are no sample SGI files on this page yet. To make one for testing, run magick input.png output.sgi with ImageMagick (add -compress RLE for run-length encoding), or pnmtosgi -rle input.ppm > output.sgi with Netpbm.

Put it online

Have an SGI file? Give it a link.

Drop an SGI image on 99helpers and it gets its own web address. Browsers can't display SGI, so anyone who opens the link downloads the file, ready for an image editor, a 3D tool or a converter.

Questions

SGI files, frequently asked

What is an SGI file?

An image in Silicon Graphics' raster format: a 512-byte header followed by greyscale, RGB or RGBA pixels at 8 or 16 bits per channel, raw or run-length encoded. It's also saved as .rgb, .rgba or .bw.

How do I open an SGI or .rgb file?

Open it in GIMP, or convert it with ImageMagick (magick image.rgb image.png) or Pillow. Browsers and most built-in photo viewers can't show it.

Is SGI lossless?

Yes. Pixels are stored raw or with run-length encoding, and both keep every value exactly.

What's the difference between .rgb, .rgba, .bw and .sgi?

Nothing in the format: they're all SGI images. The extension suggests the number of channels (3, 4 and 1); .sgi can be any of them. The header says what the file really holds.

Why does my SGI image appear upside down?

SGI stores rows from the bottom up. A reader that ignores that shows the image flipped.

Is SGI still used?

Mostly in older 3D, VFX and research pipelines and in archives. Blender and Autodesk's FCheck still read it, but PNG, TIFF and EXR have taken over for new work.

Related formats

Other file types explained

Keep going

Related

Sources

Last reviewed 27 October 2026.