\brief Image File Structure (Private). * \ingroup file
Image color mode configuration/extra descriptors (1 bit each in the second byte). \n * See also \ref colormodeutl. * \ingroup imagerep
Image color mode color space descriptors (first byte). \n * See also \ref colormodeutl. * \ingroup imagerep
Image data type descriptors. \n * See also \ref datatypeutl. * \ingroup imagerep
File Access Error Codes * \par * In Lua use im.ErrorStr(err) to convert the error number into a string. * \ingroup file
Closes the file. \n * In Lua if this function is not called, the file is closed by the garbage collector. * * \verbatim im.FileClose(ifile: imFile) [in Lua 5] \endverbatim * \verbatim ifile:Close() [in Lua 5] \endverbatim * \ingroup file
Returns an extended attribute as an integer. \ingroup file
Returns an extended attribute as a real. \ingroup file
Returns an extended attribute as a string. \ingroup file
Returns an extended attribute. \n * Returns NULL if not found. data_type and count can be NULL. * See also \ref imDataType. * * \verbatim ifile:GetAttribute(attrib: string, [as_string: boolean]) -> data: table of numbers or string, data_type: number [in Lua 5] \endverbatim * If data_type is IM_BYTE, as_string can be used to return a string instead of a table. * \verbatim ifile:GetAttributeRaw(attrib: string) -> data: userdata, data_type, count: number [in Lua 5] \endverbatim * \ingroup file
Returns a list of the attribute names. \n * "attrib" must contain room enough for "attrib_count" names. Use "attrib=NULL" to return only the count. * * \verbatim ifile:GetAttributeList() -> data: table of strings [in Lua 5] \endverbatim * \ingroup file
Returns file information. * image_count is the number of images in a stack or * the number of frames in a video/animation or the depth of a volume data. \n * compression and image_count can be NULL. \n * These information are also available as attributes: * \verbatim FileFormat (string) \endverbatim * \verbatim FileCompression (string) \endverbatim * \verbatim FileImageCount IM_INT (1) \endverbatim * See also \ref format. * * \verbatim ifile:GetInfo() -> format: string, compression: string, image_count: number [in Lua 5] \endverbatim * \ingroup file
Returns the palette if any. \n * "palette" must be a 256 colors allocated array. \n * Returns zero in "palette_count" if there is no palette. "palette_count" is >0 and <=256. * * \verbatim ifile:GetPalette() -> palette: imPalette [in Lua 5] \endverbatim * \ingroup file
Returns an internal handle. * index=0 returns always an imBinFile* handle, * but for some formats returns NULL because they do not use imBinFile (like AVI and WMV). * index=1 return an internal structure used by the format, usually is a handle * to a third party library structure. This is file format dependent. * * \verbatim ifile:Handle() -> handle: userdata [in Lua 5] \endverbatim * \ingroup file
Creates a new file for writing using a specific format. If the file exists will be replaced. \n * It will only initialize the format driver and create the file, no data is actually written. * See also \ref imErrorCodes and \ref format. * * \verbatim im.FileNew(file_name: string, format: string) -> ifile: imFile, error: number [in Lua 5] \endverbatim * \ingroup file
Opens the file for reading. It must exists. Also reads file header. * It will try to identify the file format. * See also \ref imErrorCodes. \n * In Lua the IM file metatable name is "imFile". * When converted to a string will return "imFile(%p)" where %p is replaced by the userdata address. * If the file is already closed by im.FileClose, then it will return also the suffix "-closed". * * \verbatim im.FileOpen(file_name: string) -> ifile: imFile, error: number [in Lua 5] \endverbatim * \ingroup file
Opens the file for reading using a specific format. It must exists. Also reads file header. * See also \ref imErrorCodes and \ref format. * * \verbatim im.FileOpenAs(file_name, format: string) -> ifile: imFile, error: number [in Lua 5] \endverbatim * \ingroup file
Reads the image data with or without conversion. \n * The data can be converted to bitmap when reading. * Data type conversion to byte will always scan for min-max then scale to 0-255, * except integer values that min-max are already between 0-255. Complex to real conversions will use the magnitude. \n * Color mode flags contains packed, alpha and top-bottom information. * If flag is 0 means unpacked, no alpha and bottom up. If flag is -1 the file original flags are used. \n * Returns an error code. * See also \ref imErrorCodes, \ref imDataType, \ref imColorSpace and \ref imColorModeConfig. * * \verbatim ifile:ReadImageData(data: userdata, convert2bitmap: boolean, color_mode_flags: number) -> error: number [in Lua 5] \endverbatim * \ingroup file
Reads the image header if any and returns image information. \n * Reads also the extended image attributes, so other image attributes will be available only after calling this function. \n * Returns an error code. * index specifies the image number between 0 and image_count-1. \n * Some drivers reads only in sequence, so "index" can be ignored by the format driver. \n * Any parameters can be NULL. This function must be called at least once, check each format documentation. * See also \ref imErrorCodes, \ref imDataType, \ref imColorSpace and \ref imColorModeConfig. * * \verbatim ifile:ReadImageInfo([index: number]) -> error: number, width: number, height: number, file_color_mode: number, file_data_type: number [in Lua 5] \endverbatim * Default index is 0. * \ingroup file
Changes an extended attribute as an integer. \ingroup file
Changes an extended attribute as a real. \ingroup file
Changes an extended attribute as a string. \ingroup file
Changes an extended attribute. \n * The data will be internally duplicated. \n * If data is NULL the attribute is removed. * If data_type is BYTE then count can be -1 to indicate a NULL terminated string. * See also \ref imDataType. * * \verbatim ifile:SetAttribute(attrib: string, data_type: number, data: table of numbers or string) [in Lua 5] \endverbatim * If data_type is IM_BYTE, as_string can be used as data. * \ingroup file
Changes the write compression method. \n * If the compression is not supported will return an error code when writing. \n * Use NULL to set the default compression. You can use the imFileGetInfo to retrieve the actual compression * but only after \ref imFileWriteImageInfo. Only a few formats allow you to change the compression between frames. * * \verbatim ifile:SetInfo(compression: string) [in Lua 5] \endverbatim * \ingroup file
Changes the pallete. \n * "palette_count" is >0 and <=256. * * \verbatim ifile:SetPalette(palette: imPalette) [in Lua 5] \endverbatim * \ingroup file
Writes the image data. \n * Returns an error code. * * \verbatim ifile:WriteImageData(data: userdata) -> error: number [in Lua 5] \endverbatim * \ingroup file
Writes the image header. Writes the file header at the first time it is called. * Writes also the extended image attributes. \n * Must call imFileSetPalette and set other attributes before calling this function. \n * In some formats the color space will be converted to match file format specification. \n * Returns an error code. This function must be called at least once, check each format documentation. * See also \ref imErrorCodes, \ref imDataType, \ref imColorSpace and \ref imColorModeConfig. * * \verbatim ifile:WriteImageInfo(width: number, height: number, user_color_mode: number, user_data_type: number) -> error: number [in Lua 5] \endverbatim * \ingroup file
Checks if the format support the given image class at the given compression. \n * Returns an error code. * See also \ref format, \ref imErrorCodes, \ref imDataType, \ref imColorSpace and \ref imColorModeConfig. * * \verbatim im.FormatCanWriteImage(format: string, compression: string, color_mode: number, data_type: number) -> can_write: boolean [in Lua 5] \endverbatim * \ingroup format
Returns the format compressions. \n * Compressions are 20 chars max each, maximum of 50 compressions. You can use "char* comp[50]". \n * color_mode and data_type are optional, use -1 to ignore them. \n * If you use them they will select only the allowed compressions checked like in \ref imFormatCanWriteImage. \n * Returns an error code. * See also \ref format, \ref imErrorCodes, \ref imDataType, \ref imColorSpace and \ref imColorModeConfig. * * \verbatim im.FormatCompressions(format: string, [color_mode: number], [data_type: number]) -> error: number, comp: table of strings [in Lua 5] \endverbatim * \ingroup format
Returns the format description. \n * Format description is 50 chars max. \n * Extensions are separated like "*.tif;*.tiff;", 50 chars max. \n * Returns an error code. The parameters can be NULL, except format. * See also \ref format. * * \verbatim im.FormatInfo(format: string) -> error: number, desc: string, ext: string, can_sequence: boolean [in Lua 5] \endverbatim * \ingroup format
Returns the format information of the third party library used to support the format. \n * Format extra is 50 chars max. \n * Returns an error code. * See also \ref format. * * \verbatim im.FormatInfoExtra(format: string) -> error: number, extra: string [in Lua 5] \endverbatim * \ingroup format
Returns a list of the registered formats. \n * format_list is an array of format identifiers. * Each format identifier is 10 chars max, maximum of 50 formats. * You can use "char* format_list[50]". * * \verbatim im.FormatList() -> format_list: table of strings [in Lua 5] \endverbatim * \ingroup format
Registers all the internal formats. \n * It is automatically called internally when a format is accessed, * but can be called to force the internal formats to be registered before other formats. * Notice that additional formats when registered will be registered before the internal formats * if imFormatRegisterInternal is not called yet. \n * To control the register order is useful when two format drivers handle the same format. * The first registered format will always be used first. * \ingroup format
Remove all registered formats. Call this if you are checking memory leaks. * \ingroup format
\file \brief Main API
See Copyright Notice in im_lib.h