# SPIDER-PIL Spider 2D image

Extensions: None

This is a copy from the Pillow docs.

PIL reads and writes SPIDER image files of 32-bit floating point data (“F;32F”).

PIL also reads SPIDER stack files containing sequences of SPIDER images. The `seek()` and `tell()` methods are supported, and random access is allowed.

The `write()` method sets the following attributes:

format
  Set to `SPIDER`
istack
  Set to 1 if the file is an image stack, else 0.
nimages
  Set to the number of images in the stack.

A convenience method, `convert2byte()`, is provided for converting floating point data to byte data (mode `L`):

    im = Image.open('image001.spi').convert2byte()

## Writing files in SPIDER format

The extension of SPIDER files may be any 3 alphanumeric characters. Therefore the output format must be specified explicitly:

    im.save('newimage.spi', format='SPIDER')

For more information about the SPIDER image processing package, see the SPIDER homepage at Wadsworth Center.