====== WriteImage ====== WriteImage writes the image it receives to a file, in one of six formats. The file name must end in the format's extension. ^ Format ^ Extension ^ Data it can hold ^ Best for ^ | TIFF | ''.tif'' | 8- or 16-bit integers, or 32- or 64-bit floating point | archiving | | ENVI | ''.hdr'' | 8- or 16-bit integers, or 32- or 64-bit floating point | computations | | JPEG | ''.jpg'' | 8-bit monochrome or color (1 or 3 bands) | display only | | PNG | ''.png'' | 8-bit monochrome or color | | | BMP | ''.bmp'' | 8-bit monochrome or color | | | Text | ''.txt'' | a simple text format unique to Hoku | | To write an image for display in other programs, first convert it to 8-bit with [[basic_level:enhancement:pack|Pack]]. WriteImage passes the image on unchanged, so you can connect another module after it. Each output file name can be used only once in a job. ===== JPEG ===== JPEG files use lossy compression. The "quality" parameter goes from 0.0 (lowest quality, smallest file) to 1.0 (highest quality, largest file). The default is 0.75. {{ :basic_level:hoku_basic_writeimage_jpg.png?nolink&400 |WriteImage with the JPEG format}} ===== TIFF ===== TIFF files are written uncompressed by default. Two lossless compression options are available, LZW and Deflate. Both can be combined with **Differencing** (the "predictor") for more compression. Deflate with Differencing gives the best compression. LZW is provided for compatibility, but is not recommended. {{ :basic_level:hoku_basic_writeimage_tiff.png?nolink&400 |WriteImage with the TIFF format and Deflate compression}} ===== ENVI ===== An ENVI file is a header file (''.hdr'') plus a data file. The "interleave" parameter sets how the data is written: * **BSQ** (band sequential, the default) is best when you want to look at one band at a time. * **BIP** (band interleaved by pixel) lets you look at all bands at once, as in a spectrum. * **BIL** (band interleaved by line) is a compromise in access speed. {{ :basic_level:hoku_basic_writeimage_envi.png?nolink&400 |WriteImage with the ENVI format}} For writing a multispectral image, see [[basic_level:writeimage:multispectral_image_in_envi|Multispectral Image in ENVI]].