gimpexport

Name

gimpexport -- Export an image before it is saved.

Synopsis



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

Description

This function should be called by all save_plugins unless they are able to save all image formats the 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.

Details

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_ALPHA               = 1 << 3,
  GIMP_EXPORT_CAN_HANDLE_LAYERS              = 1 << 4,
  GIMP_EXPORT_CAN_HANDLE_LAYERS_AS_ANIMATION = 1 << 5,
  GIMP_EXPORT_NEEDS_ALPHA                    = 1 << 6
} GimpExportCapabilities;


enum GimpExportReturnType

typedef enum
{
  GIMP_EXPORT_CANCEL,
  GIMP_EXPORT_IGNORE,
  GIMP_EXPORT_EXPORT
} GimpExportReturnType;


gimp_export_image ()

GimpExportReturnType 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 STATUS_CANCEL.

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 GimpExportReturnType describing the user_action.