---
name: "export"
section: "3x"
platform: "linux"
package: "libafterimage-dev"
version: "2.2.12-18"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/export/3x"
---

# export(3x)

functionality for writing images into files libAfterImage/export.h

## NAME

**export** - functionality for writing images into files libAfterImage/export.h

## NAMEexport

\- Image output into different file formats.

## SEE ALSO

Structures :\
          ASXpmExportParams\
          ASPngExportParams\
          ASJpegExportParams\
          ASGifExportParams\
          ASImageExportParams

Functions :\
         ASImage2file()

Other libAfterImage modules :\
          ascmap.h asfont.h asimage.h asvisual.h blender.h export.h\
          import.h transform.h ximage.h

## AUTHOR

Sasha Vasko \<sasha at aftercode dot net\> libAfterImage/ExportFlags

## NAMEEXPORT\_GRAYSCALE

\- save image as grayscale. EXPORT\_ALPHA - save alpha channel if format permits EXPORT\_APPEND - if format allows multiple images - image will be appended

## FUNCTION

Some common flags that could be used while writing images into different file formats.

## SOURCE

\#define EXPORT\_GRAYSCALE            (0x01\<\<0) #define EXPORT\_ALPHA                (0x01\<\<1) #define EXPORT\_APPEND               (0x01\<\<3)  /\* adds subimage  \*/ #define EXPORT\_ANIMATION\_REPEATS    (0x01\<\<4)  /\* number of loops to repeat GIF animation \*/ /\*\*\*\*\*/

libAfterImage/ASPngExportParams

## NAMEASPngExportParams

\- parameters for export into PNG file.

## SOURCE

typedef struct {\
     ASImageFileTypes type;\
     ASFlagType flags ;\
     int compression ; }ASPngExportParams ;

libAfterImage/ASJpegExportParams

## NAMEASJpegExportParams

\- parameters for export into JPEG file.

## SOURCE

typedef struct {\
     ASImageFileTypes type;\
     ASFlagType flags ;\
     int quality ; }ASJpegExportParams ;

libAfterImage/ASGifExportParams

## NAMEASGifExportParams

\- parameters for export into GIF file.

## SOURCE

typedef struct {\
     ASImageFileTypes type;\
     ASFlagType flags ;\
     int dither ;\
     int opaque\_threshold ;\
     unsigned short animate\_delay ;\
     unsigned short animate\_repeats ; }ASGifExportParams ;

libAfterImage/ASTiffExportParams

## NAMEASTiffExportParams

\- parameters for export into TIFF file.

## SOURCE

typedef struct {\
     ASImageFileTypes type;\
     ASFlagType flags ;\
     CARD32 rows\_per\_strip ;

/\* these are suitable compressions : \*/ #define TIFF\_COMPRESSION\_NONE       1 #define TIFF\_COMPRESSION\_OJPEG      6   /\* !6.0 JPEG \*/ #define TIFF\_COMPRESSION\_JPEG       7 #define TIFF\_COMPRESSION\_PACKBITS   32773   /\* Macintosh RLE \*/ #define TIFF\_COMPRESSION\_DEFLATE    32946   /\* Deflate compression \*/\
     /\* you should be able to use other values from tiff.h as well \*/\
     CARD32 compression\_type ;\
     int jpeg\_quality ;

    int opaque\_threshold ; }ASTiffExportParams ;

libAfterImage/ASImageExportParams

## NAMEASImageExportParams

\- union of structures holding parameters for export into different file formats.

## DESCRIPTION

Treatment of this union depends on what type of export was requested.

## SEE ALSO

ASImageFileTypes

## SOURCE

typedef union ASImageExportParams {\
     ASImageFileTypes   type;\
     ASXpmExportParams  xpm;\
     ASPngExportParams  png;\
     ASJpegExportParams jpeg;\
     ASGifExportParams  gif;\
     ASTiffExportParams tiff; }ASImageExportParams;

libAfterImage/export/ASImage2file()

## NAMEASImage2file()

## SYNOPSIS

Bool ASImage2file( ASImage \*im, const char \*dir, const char \*file,\
               ASImageFileTypes type, ASImageExportParams \*params );

## INPUTS

- im

  \- Image to write out.

- dir

  \- directory name to write file into (optional, could be NULL)

- file

  \- file name with or without directory name.

- type

  \- output file format. ( see ASImageFileTypes )

- params

  \- pointer to ASImageExportParams union's member for the above type, with additional export parameters, such as quality, compression, etc. If NULL then all defaults will be used.

## RETURN VALUE

True on success. False - failure.

## DESCRIPTION

ASImage2file will construct filename out of dir and file components and then will call specific filter to write out file in requested format.

## NOTES

Some formats support compression, others support lossy compression, yet others allows you to limit number of colors and colordepth. Each specific filter will try to interpret those parameters in its own way.

## EXAMPLE

asmerge.c: ASMerge.3
