gimpexport: GIMP Library Reference Manual

## gimpexport gimpexport — Export an image before it is saved. |

## Functions

GimpExportReturn | gimp_export_image ()
GtkWidget * | gimp_export_dialog_new ()
GtkWidget * | gimp_export_dialog_get_content_area ()

## Types and Values

enum | GimpExportCapabilities
enum | GimpExportReturn

## Description

This function should be called by all save_plugins unless they are able to save all image formats GIMP knows about. It takes care of asking the user if she wishes to export the image to a format the save_plugin can handle. It then performs the necessary conversions (e.g. Flatten) on a copy of the image so that the image can be saved without changing the original image.

The capabilities of the save_plugin are specified by combining GimpExportCapabilities using a bitwise OR.

Make sure you have initialized GTK+ before you call this function as it will most probably have to open a dialog.

## Functions

### gimp_export_image ()

    GimpExportReturn
    gimp_export_image (gint32 *image_ID,
                       gint32 *drawable_ID,
                       const gchar *format_name,
                       GimpExportCapabilities capabilities);

Takes an image and a drawable to be saved together with a description of the capabilities of the image_format. If the type of image doesn't match the capabilities of the format a dialog is opened that informs the user that the image has to be exported and offers to do the necessary conversions.

If the user chooses to export the image, a copy is created. This copy is then converted, the image_ID and drawable_ID are changed to point to the new image and the procedure returns GIMP_EXPORT_EXPORT. The save_plugin has to take care of deleting the created image using `gimp_image_delete()` when it has saved it.

If the user chooses to Ignore the export problem, the image_ID and drawable_ID is not altered, GIMP_EXPORT_IGNORE is returned and the save_plugin should try to save the original image. If the user chooses Cancel, GIMP_EXPORT_CANCEL is returned and the save_plugin should quit itself with status `GIMP_PDB_CANCEL`.

If `format_name` is NULL, no dialogs will be shown and this function will behave as if the user clicked on the 'Export' button, if a dialog would have been shown.

#### Parameters

image_ID | Pointer to the image_ID. |
drawable_ID | Pointer to the drawable_ID. |
format_name | The (short) name of the image_format (e.g. JPEG or GIF). |
capabilities | What can the image_format do? |

#### Returns

An enum of GimpExportReturn describing the user_action.

### gimp_export_dialog_new ()

    GtkWidget *
    gimp_export_dialog_new (const gchar *format_name,
                            const gchar *role,
                            const gchar *help_id);

Creates a new export dialog. All file plug-ins should use this dialog to get a consistent look on the export dialogs. Use `gimp_export_dialog_get_content_area()` to get a GtkVBox to be filled with export options. The export dialog is a wrapped GimpDialog.

The dialog response when the user clicks on the Export button is `GTK_RESPONSE_OK`, and when the Cancel button is clicked it is `GTK_RESPONSE_CANCEL`.

#### Parameters

format_name | The short name of the image_format (e.g. JPEG or PNG). |
role | The dialog's `role` which will be set with `gtk_window_set_role()`. |
help_id | The GIMP help id. |

#### Returns

The new export dialog.

Since: 2.8

### gimp_export_dialog_get_content_area ()

    GtkWidget *
    gimp_export_dialog_get_content_area (GtkWidget *dialog);

Returns the GtkVBox of the passed export dialog to be filled with export options.

#### Parameters

dialog | A dialog created with `gimp_export_dialog_new()` |

#### Returns

The GtkVBox to fill with export options.

Since: 2.8

## Types and Values

### enum GimpExportCapabilities

The types of images and layers an export procedure can handle

#### Members

GIMP_EXPORT_CAN_HANDLE_RGB | Handles RGB images |
GIMP_EXPORT_CAN_HANDLE_GRAY | Handles grayscale images |
GIMP_EXPORT_CAN_HANDLE_INDEXED | Handles indexed images |
GIMP_EXPORT_CAN_HANDLE_BITMAP | Handles two-color indexed images |
GIMP_EXPORT_CAN_HANDLE_ALPHA | Handles alpha channels |
GIMP_EXPORT_CAN_HANDLE_LAYERS | Hanldes layers |
GIMP_EXPORT_CAN_HANDLE_LAYERS_AS_ANIMATION | Handles aminations of layers |
GIMP_EXPORT_CAN_HANDLE_LAYER_MASKS | Handles layer masks |
GIMP_EXPORT_NEEDS_ALPHA | Needs alpha channels |

### enum GimpExportReturn

Possible return values of `gimp_export_image()`.

#### Members

GIMP_EXPORT_CANCEL | The export was cancelled |
GIMP_EXPORT_IGNORE | The image is unmodified but export shall continue anyway |
GIMP_EXPORT_EXPORT | The chosen transforms were applied to the image |