export(3x)
π export(3x) β the "get this image OUT of memory and onto disk" page
okay so bestie, welcome to export(3x), straight out of the AfterStep X11 window manager docs. this whole page is about writing images into files, and it lives in libAfterImage/export.h. lowkey it's the entire "how do I make a .png happen" situation, fr fr. π
π NAME
exportβ functionality for writing images into fileslibAfterImage/export.h
π NAMEexport
- Image output into different file formats. β¨ (yes, the heading in the source really does look like that, no cap)
π SEE ALSO
Structures :
ASXpmExportParamsASPngExportParamsASJpegExportParamsASGifExportParamsASImageExportParams
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
π libAfterImage/ExportFlags
NAMEEXPORT_GRAYSCALE
so these are the common flags you can use while writing images into different file formats. here's the breakdown:
EXPORT_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. (that's it, that's the whole vibe check on this one π)
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 beNULL)fileβ file name with or without directory name.typeβ output file format. ( seeASImageFileTypes)paramsβ pointer toASImageExportParamsunion's member for the abovetype, with additional export parameters, such as quality, compression, etc. IfNULLthen 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. π (translation: every filter does its own little thing, so don't come for them)
EXAMPLE
asmerge.c: ASMerge.3
and that's a wrap, bestie π«Ά this page is brought to you by the 3rd Berkeley Distribution, AfterStep v.2.2.12 edition β that's the source and the version stamped on the footer of this manual. go write some files, slay, periodt. π
π¦ where this page comes from
- ubuntu resolute: libafterimage-dev 2.2.12-19 Β· GPL-2.0-or-later
- ubuntu stonking: libafterimage-dev 2.2.12-19 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms