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,.sgiand.bwfiles, 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: 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
01 DAMagic number
474 as a big-endian 16-bit number. Every SGI image starts with these two bytes, whatever its extension.
- 2
01 01Storage 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
00 03Dimension
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
00 03 00 02 00 03Width, 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
00 00 00 00 00 00 00 FFPixel range
The smallest and largest pixel values in the image: 0 and 255, so 255 is full brightness.
- 6
39 39 68 65 6C 70 65 72 73 00Image name
Up to 79 characters of text and a zero byte, in an 80-byte field. Here
99helpers, set withpnmtosgi -imagename. - 7
00 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
00 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
00 00 00 05 × 6Length 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
02 FF 81 00 00A 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.00ends the row. That's the red values of the bottom row: full red in yellow and in white, none in black. - 11
83 FF 00 00 00Rows by channel, bottom up
The second row in the table is the red channel's top row:
83copies 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.
Under the hood
The 512-byte header
| Offset | Size | Field | Meaning |
|---|---|---|---|
| 0 | 2 | MAGIC | 474 (01 DA) |
| 2 | 1 | STORAGE | 0 verbatim, 1 RLE |
| 3 | 1 | BPC | Bytes per channel: 1 or 2 |
| 4 | 2 | DIMENSION | 1 one row, 2 one channel, 3 several channels |
| 6 | 2 | XSIZE | Width in pixels |
| 8 | 2 | YSIZE | Height in pixels |
| 10 | 2 | ZSIZE | Number of channels |
| 12 | 4 | PIXMIN | Lowest pixel value |
| 16 | 4 | PIXMAX | Highest pixel value |
| 20 | 4 | DUMMY | Unused, 0 |
| 24 | 80 | IMAGENAME | Name, up to 79 characters |
| 104 | 4 | COLORMAP | 0 normal; 1 dithered and 2 screen (obsolete); 3 a colour map |
| 108 | 404 | DUMMY | Unused, 0 |
Everything is big-endian. In a verbatim file, the pixels start at byte 512: all rows of the first channel, bottom row first, then all rows of the second channel, and so on. There is no row padding, so a verbatim file is exactly 512 + width × height × channels × bytes per channel. Our 3 × 2 example saved verbatim is 530 bytes.
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 byte | Meaning |
|---|---|
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 |
00 | End 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.
| Extension | Usual contents | Channels |
|---|---|---|
.bw, .int | Greyscale | 1 |
.inta | Greyscale with alpha | 2 |
.rgb | Colour | 3 |
.rgba | Colour with alpha | 4 |
.sgi | Any of the above | 1 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
| SGI | TGA | TIFF | PNG | |
|---|---|---|---|---|
| Compression | None or RLE | None or RLE | None, LZW, Deflate, JPEG and more | Deflate |
| Bits per channel | 8 or 16 | Up to 8 | 8, 16, 32-bit float and more | Up to 16 |
| Alpha | Yes | Yes | Yes | Yes |
| Signature at the start | 01 DA | None | 49 49 2A 00 or 4D 4D 00 2A | 8-byte signature |
| Metadata | An 80-byte name | Image ID, v2 extension area | Extensive | Text, Exif, colour profiles |
| Browsers | No | No | Only Safari | All |
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, ormagick input.png -compress RLE output.sgito write an RLE file (convertin ImageMagick 6). - Pillow:
Image.open("texture.rgb").save("texture.png"). Pillow writes SGI files too, uncompressed. - Netpbm:
sgitopnm texture.rgb > texture.ppm, andpnmtosgi -rleor-verbatimthe other way. - FFmpeg:
ffmpeg -i frame%04d.sgi frame%04d.pngconverts 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
.rgbdump without a header, not an SGI image. Check for01 DAat 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
- Paul Haeberli: The SGI Image File Format, version 1.00
- Wikipedia: Silicon Graphics Image
- The National Archives (PRONOM): Silicon Graphics Image, x-fmt/140
- comp.sys.sgi, May 1991: the .rgb format and SGI's image library
- Blender manual: Supported Graphics Formats
- Autodesk Maya help: FCheck supported file formats
Last reviewed 27 October 2026.