gimpexport — Export an image before it is saved.


enum                GimpExportCapabilities;
enum                GimpExportReturn;
GimpExportReturn    gimp_export_image                   (gint32 *image_ID,
                                                         gint32 *drawable_ID,
                                                         const gchar *format_name,
                                                         GimpExportCapabilities capabilities);
GtkWidget *         gimp_export_dialog_new              (const gchar *format_name,
                                                         const gchar *role,
                                                         const gchar *help_id);
GtkWidget *         gimp_export_dialog_get_content_area (GtkWidget *dialog);


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.


enum GimpExportCapabilities

typedef enum {
  GIMP_EXPORT_CAN_HANDLE_RGB                 = 1 << 0,
  GIMP_EXPORT_CAN_HANDLE_GRAY                = 1 << 1,
  GIMP_EXPORT_CAN_HANDLE_INDEXED             = 1 << 2,
  GIMP_EXPORT_CAN_HANDLE_BITMAP              = 1 << 3,
  GIMP_EXPORT_CAN_HANDLE_ALPHA               = 1 << 4,
  GIMP_EXPORT_CAN_HANDLE_LAYERS              = 1 << 5,
  GIMP_EXPORT_NEEDS_ALPHA                    = 1 << 8
} GimpExportCapabilities;










enum GimpExportReturn

typedef enum {
} GimpExportReturn;




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.

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.

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 GIMP 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.

dialog :

A dialog created with gimp_export_dialog_new()

Returns :

The GtkVBox to fill with export options.

Since GIMP 2.8