Date: Fri, 29 Mar 2024 11:28:00 +0000 (UTC) Message-ID: <2042158771.695.1711711680725@ip-10-0-0-233.us-west-2.compute.internal> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_694_671486703.1711711680722" ------=_Part_694_671486703.1711711680722 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
Functions to read and save images. The governing philosoph= y 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 operat= ions.
The file format is automatically determined, and the returned I= mage has a precision large enough to represent the contents of th= e file. Practically, this means that images with 8 bits per channel (includ= ing color-mapped images) are read in as Fractional image= s, and all others are read in as Float images.
Most popular file formats are recognized and read in correctly. The foll= owing file formats can be read:
fileName
Name of file to be loaded (string)
subImageIndex
Index of subimage (for multi-image files)
fileNam= e =3D 'image.tif' image =3D ice.Load(fileName)
Save image to file using specified format. If a format is not specified,= an appropriate choice will be used. This function throws ice.error for fai= lure.
fileName
Name of file to save to (string).
outputFormat
Output format (int). Can be one of:
Note: It is worth mentioning that dithering is not done automatically while savin= g to a lower-precision format.
c =3D i= ce.Card(ice.constants.FLOAT, [1.0, 0.5, 0.3]) fileName =3D 'image.tif' format =3D ice.constants.FMT_TIFFFLOAT c.Save(fileName, format)
The FMT_JPEG format looks at the i= mage'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.=
c =3D i= ce.Card(ice.constants.FLOAT, [1.0, 0.5, 0.3]) fileName =3D "image.jpg" format =3D ice.constants.FMT_JPEG c.SetMetaDataItem('JPEG_QUALITY', 50) c.Save(fileName, format)