Prev | Next

Programming 'it'

Input and Output

Functions to read and save images. The governing philosophy is to retain all the precision of the file format during loading, and to choose a format capable of representing in-memory images during save operations.

With(fileName, subImageIndex = 0)
fileName: Name of file to be loaded (String)
subImageIndex: Index of subimage (for multi-image files)

The file format is automatically determined, and the returned Image has a precision large enough to represent the contents of the file. Practically, this means that images with 8 bits per channel (including color-mapped images) are read in as Fractional images, and all others are read in as Float images.

Most popular file formats are recognized and read in correctly. The following file formats can be read:

fileName := "image.tif"
image := IceImage With(fileName)
Number Save(fileName, outputFormat)
fileName: Name of file to save to (String).
outputFormat: Output format (Number). One of IceOutputType enumerations:

Save image to file using specified format. Default always saves the image out in the TIFF format with appropriate precision. This function returns an integer: 0 for success, -1 for failure.

Note: It is worth mentioning that dithering is notdone automatically while saving to a lower-precision format.

fileName := "image.tif"
format := IceOutputType TiffFloat
result := image Save(fileName, format)

The Jpeg format looks at the image's meta-data dictionary to determine the "quality" factor of the output image. The "quality" of a JPEG image is a number between 1 and 100.

fileName := "image.jpg"
format := IceOutputType Jpeg
image SetMetaDataItem("JPEG_QUALITY", 50)
result := image Save(fileName, format)


Prev | Next



Pixar Animation Studios
Copyright© Pixar. All rights reserved.
Pixar® and RenderMan® are registered trademarks of Pixar.
All other trademarks are the properties of their respective holders.