Chapter 6. Getting images out of GIMP
| Part II. How do I Become a GIMP Wizard? |

## Chapter 6. Getting images out of GIMP

## 1. Files

Revision History
Revision $Revision: 2551 $ | 2007-10-06 | ude

The GIMP is capable of reading and writing a large variety of graphics file formats. With the exception of GIMP's native XCF file type, file handling is done by Plugins. Thus, it is relatively easy to extend GIMP to new file types when the need arises.

Not all file types are equally good for all purposes. This part of the documentation should help you understand the advantages and disadvantages of each type.

### 1.1. Saving Images

When you are finished working with an image, you will want to save the results. (In fact, it is often a good idea to save at intermediate stages too: GIMP is a pretty robust program, but we have heard rumors, possibly apocryphal, that it may have been known on rare and mysterious occasions to crash.) Most of the file formats that GIMP can open, can also be used for saving. There is one file format that is special, though: XCF is GIMP's native format, and is useful because it stores everything about an image (well, almost everything; it does not store “undo” information). Thus, the XCF format is especially suitable for saving intermediate results, and for saving images to be re-opened later in GIMP. XCF files are not readable by most other programs that display images, so once you have finished, you will probably also want to save the image in a more widely used format, such as JPEG, PNG, TIFF, etc.

### 1.2. Saving Files

There are several commands for saving images. A list, and information on how to use them, can be found in the section covering the File Menu.

GIMP allows you to save the images you create in a wide variety of formats. It is important to realize that the only format capable of saving all of the information in an image, including layers, transparency, etc., is GIMP's native XCF format. Every other format preserves some image properties and loses others. When you save an image, GIMP tries to let you know about this, but basically it is up to you to understand the capabilities of the format you choose.

Figure 6.1. Example of an Export dialog

As stated above, there is no file format, with the exception of GIMP's native XCF format, that is capable of storing all the data in a GIMP image. When you ask to save an image in a format that will not completely represent it, GIMP notifies you of this, tells you what kind of information will be lost, and asks you whether you would like to “export” the image in a form that the file type can handle. Exporting an image does not modify the image itself, so you do not lose anything by doing this. See Export file.

| Note
When you close an image (possibly by quitting GIMP), you are warned if the image is "dirty"; that is, if it has been changed without subsequently being saved. Saving an image in any file format will cause the image to be considered "not dirty", even if the file format does not represent all of the information from the image.

#### 1.2.1. Saving as GIF

Figure 6.2. The GIF Save dialog

| Warning
Please note, that the GIF file format is incapable of storing some rather basic image informations like print resolution. If you care for these properties, you should consider a different file format like PNG.

GIF Options
  Interlace

    When this option is checked, the image will be displayed progressively on the Web page. It was interesting when computers and modems were slow, as it allowed to stop loading an image of no interest.

  GIF comment

    Beware of do not insert characters outside the ASCII range, because of the GIF format supports 7-bits ASCII texts only, that GIMP can't provide. If you insert inadvertently a non-ASCII char, the option will be automatically disabled.

Animated GIF Options
  Loop forever

    When this option is checked the animation will start playing again repeatedly until you stop it.

  Delay between frames if unspecified

    You can set the delay, in millisecondes, between frames if it has not been set before. In this case, you can modify every delay in the Layer Dialog.

  Frame disposal when unspecified

    If this has not been set before, you can set how frames will be superimposed. You can select among three options :

    - I don't care : you can use this option if all your layers are opaque. Layers will overwrite what is beneath.

    - Cumulative Layers (combine) : previous frames will not be deleted when a new one is displayed.

    - One frame per layer (replace) : previous frames will be deleted before displaying a new frame.

#### 1.2.2. Saving as JPEG

JPEG files usually have an extension .jpg, .JPG, or .jpeg. It is a very widely used format, because it compresses images very efficiently, while minimizing the loss of image quality. No other format comes close to achieving the same level of compression. It does not, however, support transparency or multiple layers. For this reason, saving images as JPEG often requires them to be exported from GIMP.

Figure 6.3. The JPEG Save dialog

The JPEG algorithm is quite complex, and involves a bewildering number of options, whose meaning is beyond the scope of this documentation. Unless you are a JPEG expert, the Quality parameter is probably the only one you will need to adjust.

| Caution
After you save an image as a JPEG file, the image is no longer considered “dirty” by GIMP, so unless you make further changes to it, you will not receive any warning if you close it. Because JPEG is lossy and does not support transparency or multiple layers, some of the information in the image might then be lost. If you want to save all of the information in an image, use GIMP's native XCF format.

Quality

  When you save a file in JPEG format, a dialog is displayed that allows you to set the Quality level, which ranges from 0 to 100. Values above 95 are generally not useful, though. The default quality of 85 usually produces excellent results, but in many cases it is possible to set the quality substantially lower without noticeably degrading the image. You can test the effect of different quality settings by checking Show Preview in image window in the JPEG dialog.

  | Note
  Please note, that the numbers for the JPEG quality level have a different meaning. Saving with a level of 80 in GIMP is not necessarily comparable with saving with a level of 80 in an different application.

Preview in image window

  Checking this option causes each change in quality (or any other JPEG parameter) to be shown in the image display. (This does not alter the image, though: it reverts back to its original state when the JPEG dialog is closed.)

Advanced settings

  Some information about the advanced settings:

  Optimize

    If you enable this option, the optimization of entropy encoding parameters will be used.

  Progressive

    With this option enabled the chunks of the image will be inserted in a certain order in the file. This is done with the intent to give a progressive refinement of the image appearance during a slow connection web download, similar and with the same purpose of the corresponding option present in the GIF format too. The downside of enabling this option is, that you get slightly larger files.

  Save EXIF data

    JPEG files from many digital cameras contain extra information, called EXIF data, which specifies camera settings and other information concerning the circumstances under which the image was created. GIMP's ability to handle EXIF data depends on whether the “libexif” library is available on your system; it is not automatically packaged with GIMP. If GIMP was built with libexif support, then EXIF data is preserved if you open a JPEG file, work with the resulting image, and then save it as JPEG. The EXIF data is not altered in any way when you do this (which means that some of its fields are no longer valid). If GIMP was not built with EXIF support, this does not prevent files with EXIF data from being opened, but it does mean that the EXIF data will not be present when the resulting image is later saved.

  Save Preview

    This option lets you save a thumbnail with the image.

  Save XMP data

    If you enable this option, the meta data of the image will be saved as XMP-structure within the file.

  Use quality settings from original image

    If a particular quality setting (or “quantization table” ) was attached to the image when it was loaded, then this option allows you to use them instead of the standard ones.

    If you have only made a few changes to the image, then re-using the same quality setting will give you almost the same quality and file size as the original image. This will minimize the losses caused by the quantization step, compared to what would happen if you used different quality setting.

    If the quality setting found in the original file are not better than your default quality settings, then the option “Use quality settings from original image” will be available but not enabled. This ensures that you always get at least the minimum quality specified in your defaults. If you did not make major changes to the image and you want to save it using the same quality as the original, then you can do it by enabling this option.

  Smoothing

    Compression can create artefacts. By using this option, you can smooth the image when saving, reducing them. But your image becomes somewhat blurred.

  Restart markers

    The image file can include some markers which allow to segment it. If loading this image in a Web page is broken off, loading can resume from the following marker.

  Subsampling

    Human eye is not sensitive in the same way all over color spectrum. Compression can use this to consider as identical slightly different colors. Three methods are available :

    - 1x1,1x1,1x1 (best quality) : preserves borders and contrasting colors, but compression is less.

    - 2x1,1x1,1x1 (4:2:2)

    - 1x2,1x1,1x1

    - 2x2,1x1,1x1 (smallest file) : important compression; suits images with weak borders but tends to denature colors.

  DCT Method

    DCT is “discrete cosine transform”, and it is the first step in the JPEG algorithm going from the spatial to the frequency domain. The choices are “float”, “integer” (the default), and “fast integer”.

    - float : The float method is very slightly more accurate than the integer method, but is much slower unless your machine has very fast floating-point hardware. Also note that the results of the floating-point method may vary slightly across machines, while the integer methods should give the same results everywhere.

    - integer (the default): This method is faster than “float”, but not as accurate.

    - fast integer : The fast integer method is much less accurate than the other two.

  Image comments

    In this text box, you can enter a comment which will be saved with the image.

#### 1.2.3. Saving as PNG

Figure 6.4. The “Save as PNG” dialog

Interlacing

  When this option is checked, the image is progressively displayed on a Web page. So, slow computer users can stop downloading if they are not interested.

Save background color

  If your image has many transparency levels, the Internet browsers which recognize only two levels, will use the background color of your Toolbox instead. But Internet Explorer up to version 6 did not use these informations.

Save gamma

  Informations about your monitor will be saved, so that the image will be displayed in the same way on other computers, provided that the display program supports these informations, what is rarely the case.

Save layer offset

  No interest. Images with layers are flattened before saving to PNG and layer offset is taken in account.

Save Resolution

  Save the image resolution, in dpi (dot per inch).

Save creation time

  That will be the date of last saving.

Save comment

  You can read this comment in the Image Properties.

Save color values from transparent pixels

  With this option is checked, the color values are saved even if the pixels are completely transparent.

Compression level

  Since compression is not lossy, the only reason to use a compression level less than 9 would be a too long time to compress file on a slow computer. Nothing to fear from decompression: it is as quick whatever the compression level.

Save defaults

  If you click on this button, your settings will be saved and can be used by other savings by clicking on the Load defaults.

| Note
Since PNG format supports indexed images, you have better reduce the number of colors before saving if you want to have the lightest file for the Web. See Section 9.6, “ Indexed mode ”. Computers work on 8 bits blocks named “Byte”. A byte allows 256 colors. Reducing the number of colors below 256 is not useful: a byte will be used anyway and the file size will not be less. More, this “PNG8” format, like GIF, uses only one bit for transparency; only two transparency levels are possible, transparent or opaque. If you want PNG transparency to be fully displayed by Internet Explorer, you can use the AlphaImageLoader DirectX filter in the code of your Web page. See Microsoft Knowledge Base [MSKB-294714]. Please note, that this should not be necessary for InternetExplorer 7 and above.

#### 1.2.4. Saving as TIFF

Figure 6.5. The TIFF Save dialog

Compression

  This option give you the opportunity to choose the compression method that is appropriate for your image:

  - None : fast method, but resulting in a big file.

  - LZW : The image will be compressed using the “Lempel-Ziv-Welch” algorithm, a lossless compression technique. This is an old method, still efficient and fast. More informations at [WKPD-LZW].

  - Pack Bits : is a fast, simple compression scheme for run-length encoding of data. Apple introduced the PackBits format with the release of MacPaint on the Macintosh computer. A PackBits data stream consists of packets of one byte of header followed by data. (Source: [WKPD-PACKBITS])

  - Deflate: It is a lossless data compression algorithm that uses a combination of the LZ77 algorithm and Huffman coding. It is also used in Zip, Gzip and PNG file formats. Source: Wikipedia.

  - JPEG: this is a very good compression algorithm but lossy.

  - CCITT Group 3 fax; CCITT Group 4 fax

    | Note
    These options can only be selected, if the image is in indexed mode and reduced to two colors.

Save color values from transparent pixels

  With this option the color values are saved even if the pixels are completely transparent.

Comment

  In this text box, you can enter a comment which will be associated with the image.

3.7. Image Browser |  | 2. Preparing your Images for the Web