Working with Image Files |
|
Reserved FITS Keywords and Extension HDU Identifiers To Execute Image File I/O Commands |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Image files are the primary source of data in PixInsight. In this document we'll learn how image files can be opened and saved, what image file formats are supported, and some special features of PixInsight's file I/O system. Image Files Support You can read and write image files in some standard formats that are widely used in the astrophotographic community. Supported formats in PixInsight LE 1.0 include FITS (Flexible Image Transport System), TIFF (Tagged Image File Format, 6.0 Specification), JPEG (Joint Photographic Experts Group), and user-defined RAW images. In addition, most Windows BMP (bitmap) files can be read but not written. PixInsight assigns file formats to image files according to existing file extensions. In PixInsight LE 1.0, recognized file extensions are exclusively the following ones:
Supporting device-specific file formats has not been a design principle of PixInsight. PixInsight can read and write grayscale and RGB color images in all of the formats supported. Image files in other color spaces, such as CMYK and CIE L*a*b*, for example, are not supported by PixInsight LE version 1.0. Alpha channels are extra channels other than those strictly required to hold nominal pixel data. RGB color images require three channels for red, green, and blue. Grayscale images require a single channel for gray. Additional channels, i.e. a fourth channel in a RGB image or a second channel in a grayscale image, are considered as alpha channels. Alpha channels are commonly used to store transparency masks in many image and video editing applications. PixInsight LE 1.0 can read and write alpha channels in FITS, TIFF and RAW image files to preserve existing information, but it will not let you do anything else with them. Along with the lossy compression scheme implemented by the JPEG specification, nondestructive compression is only implemented for the TIFF format. Two compression algorithms have been implemented for TIFF in PixInsight: the LZW algorithm and the ZIP algorithm. The ZIP algorithm is by far more efficient, faster, and much better implemented through the ZLIB library by Jean-loup Gailly and Mark Adler. LZW has been the subject of severe patent policies by Unisys and its use is strongly discouraged. Despite the fact that most European and U.S. LZW patents have expired at the date of release of PixInsight LE, we cannot guarantee the availability of LZW compression in PixInsight Standard. FITS compression is currently not supported in PixInsight. This is because we feel there is still no standard, well defined method for FITS data compression. There are, however, some proposed compression schemes for FITS that we are considering before making a final decision. International Color Consortium (ICC) profiles embedded in FITS, TIFF and JPEG image files are fully supported by the color management system included in PixInsight LE, which in fact is exactly the same that has been implemented in PixInsight Standard. Metadata in conformance to the well-known Information Interchange Model (IIM) of the International Press Telecommunications Council (IPTC) is supported. PixInsight supports IPTC IIM version 4.1 metadata in FITS, TIFF and JPEG files. See the related page on the IPTC website for more information on the IPTC IIM. We are aware that supporting EXIF metadata is a must for PixInsight. Currently, EXIF metadata is not supported by any version of PixInsight.
The following FITS header keywords are reserved for private use by PixInsight.
The above keywords are used in the primary HDU (Header-Data Unit) of FITS files generated by PixInsight. In addition, the following FITS extension HDU identifiers are also reserved by PixInsight:
Image File I/O Commands Image file input/output commands have not been implemented as abstract processes in PixInsight. This means that, unless otherwise is said, a file I/O command will only apply to the current active image window. The active image window is placed at the top of the stack of image windows held in the main window's client area, and of course has a highlighted title bar. The Open command shows the Open Image dialog box, which is just a standard Windows Open File dialog box, as usual in most Windows applications. Multiple selections are accepted on the Open Image dialog, so a set of image files, including files of different formats, can be opened with a single Open command. For each image file opened, a new image window is created. The image window will hold the pixel data besides all the control information found and recognized in the original file, such as metadata, resolution and resolution unit, FITS header keywords, ICC profiles, etc. In PixInsight you can open the same image file in multiple windows. When you try to open an image file that has already been loaded, a message box is shown which asks for confirmation to do so. Each window works in a completely independent way, despite the fact that other windows can have the same file loaded. This adds up for flexibility, but also means that there is some potential risk to erroneously overwrite image files if they are opened more than once. Open the same image file in multiple windows at your own risk. This command is identical to the Open command, but the Save command will be forever disabled for any image window opened as a copy, even if the image has been modified. The only way to save an image that was opened as a copy is to use the Save As command, or to duplicate it as a new window and then save it. This is a security strategy designed to protect your data from yourself. All of us have had the sad experience of pressing Ctrl-S wrongly, replacing this way a good, perhaps unique image with garbage due to some casual trial-error play. When an image has been modified, the Revert command reloads the original image file from disk and discards current changes. A warning message is always shown to ask for confirmation. The Revert command can be quite less innocuous than one might expect. For practical purposes, reverting an image window is the same than closing it and open the same file again. Dependencies are completely lost in this process, which can yield to unexpected results, especially if the image was being used as a mask or if some preview objects were holding something important in their processing histories after Revert, all that information will be lost. When an image whose origin is a disk file has been modified and it was not opened as a copy, this command just writes all the image data to the same file, replacing original data, which is lost. However, if the Backup Files option of global preferences has been selected, the original file is kept, but renamed by appending a '~' character (decimal ASCII code 126) to its file extension. This backup system is very secure, but be aware that it can be a pretty fast way to get your hard disk full. If the image we apply the Save command to has been newly created, that is, if it has not been loaded from a disk file, Save is equivalent to Save As. When an image has been modified in any way, despite the fact that it has been loaded from a disk file or newly created, this command shows the Save Image dialog box. This dialog is just a standard Windows Save File dialog box, as usual in most Windows applications. Simply select a desired file format, the location where you want to save, and click OK. Or click Cancel if you changed your mind. This command closes an image window. If the image has been modified, a warning message box is shown with a well visible red background, which asks for confirmation before actually closing the window. Once closed, all the memory space used to maintain the image data is released and its contents cannot be retrieved. The Close command cannot be undone. When an image window is closed, its existing dependencies are completely destroyed. Dependencies may include mask references (if the image was being used as a mask for another image, or if the image was being masked), selected views in processing windows, cached histogram and statistics objects, undo/redo swap files, previews, processing histories, and a myriad of quite complex information structures. This command does the same thing than Close, but all the existing image windows are closed sequentially. Warning messages and confirmations are shown and asked for each window, as appropriate.
|