Working with Image Files



::Index

Image Files Support

File Formats

Color Spaces

Alpha Channels

Compression Schemes

Embedded ICC Profiles

Metadata

Reserved FITS Keywords and Extension HDU Identifiers

Image File I/O Commands

Open

Open a Copy

Revert

Save

Save As

Close

Close All

To Execute Image File I/O Commands

File Tool Bar

File Main Menu Item

Keyboard Shortcuts

Double-Click on the Main Window's Workspace

Drop a File Selection to the Main Window


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


File Formats

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:

File Format

Recognized File Extensions

Additional Recognized Extensions


FITS

.fit

.fits, .fts

TIFF

.tif

.tiff

JPEG

.jpg

.jpeg

RAW

.raw

Windows Bitmap 

.bmp

Supporting device-specific file formats has not been a design principle of PixInsight.


Color Spaces

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

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.


Compression Schemes

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.


Embedded ICC Profiles

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

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.


Reserved FITS Keywords and Extension HDU Identifiers

The following FITS header keywords are reserved for private use by PixInsight.

Keyword

Type

Values and meaning


PINSIGHT

String

PixInsight signature. Includes information about software edition and the full version number.

COLORSPC

String

Color space. Current values are "RGB" and "Grayscale". Values "CIEXYZ", "CIELAB", "CIELUV", "CIELCH", "HSV", "HSL", "LRGB" and "CMYK" are reserved for future versions of PixInsight Standard and PixInsight LE.

RESOLUTN

Real

Number of pixels per resolution unit, applicable to both axes.

RESOUNIT

String

Resolution unit. Can be "inch" or "cm".

ALPHACHN

Integer

Number of alpha channels. Present only if the image includes some alpha channel(s).

ICCPROFL

Integer

Length of the embedded ICC profile. Present only if the image has an embedded ICC profile.

IPTCINFO

Integer

Number of IPTC Photo Info data items. Present only if the image includes IPTC Photo Info data.

METADATA

String

Reserved for future versions of PixInsight Standard and PixInsight LE. Currently not used.

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:

HDU Identifier

Usage


ICCProfile

Embedded ICC Profile data. Data length in bytes is given by the ICCPROFL primary HDU keyword.

IPTCPhotoInfo

Embedded IPTC Photo Info data. The number of IPTC data items is given by the IPTCINFO primary HDU keyword.

MetaData

Embedded EXIF metadata. Structural details and length in bytes are given by the METADATA primary HDU keyword. Reserved for future versions of PixInsight Standard and PixInsight LE. Currently not used.


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.


Open

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.


Open A Copy

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.


Revert

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.


Save

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.


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.


Close

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.


Close All

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.


To Execute Image File I/O Commands:

  • File Tool Bar
    This tool bar has some tool buttons that allow quick access to most image file i/o commands, plus the New command, which has been included here for convenience.

The File tool bar is not shown by default. To make it visible, use the Window > Tool Bars > File main menu option.

  • File Main Menu Item
    On this menu, besides normal file I/O operations, you can also use the Open Recent menu item, where you can reopen the last ten files previously edited in PixInsight LE. The recent files list is updated automatically as you open files. It is also maintained in the Windows registry, so it is remembered across executions.

  • Keyboard Shortcuts:

    To execute this file i/o command:

    Press these keys:


    Open

    Ctrl-O

    Open a Copy

    Shift-Ctrl-O

    Save

    Ctrl-S

    Save As

    Shift-Ctrl-S

    Note that there are no keyboard shortcuts for the Revert and Close commands.

  • Double-Click on the Main Window's Workspace
    This works if the Enable Launch Open Dialog by Double Click option of global preferences has been enabled (it defaults to enabled). If you want to open images as copies, hold the Shift key pressed while double-clicking.
  • Drop a File Selection to the Main Window
    PixInsight's main window fully supports the standard Windows drag-and-drop mechanism for files, unless it is disabled by a corresponding option of global preferences. When drag and drop is enabled, as is by default, you can make a selection of image file(s) on the Windows Explorer, drag it to PixInsight's main window, and drop. Each file will be opened in sequence. If PixInsight is not visible on your desktop (because it's hidden by other windows or minimized), you can drag your selection over the application's icon on the Windows task bar, hold the mouse for a few seconds, and then the main window will appear, where you can drop as usual.


::Index