im.im_image

\file \brief Image Manipulation

See Copyright Notice in im_lib.h

Members

Aliases

imImage
alias imImage = _imImage
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

Functions

imFileImageLoad
imImage* imFileImageLoad(const(char)* file_name, int index, int* error)

Loads an image from file. Open, loads and closes the file. \n * index specifies the image number between 0 and image_count-1. \n * Returns NULL if failed. * Attributes from the file will be stored at the image. * See also \ref imErrorCodes. * * \verbatim im.FileImageLoad(file_name: string, [index: number]) -> image: imImage, error: number [in Lua 5] \endverbatim * Default index is 0. * \ingroup imgfile

imFileImageLoadBitmap
imImage* imFileImageLoadBitmap(const(char)* file_name, int index, int* error)

Loads an image from file, but forces the image to be a bitmap. Open, loads and closes the file. \n * index specifies the image number between 0 and image_count-1. \n * Returns NULL if failed. * Attributes from the file will be stored at the image. * See also \ref imErrorCodes. * * \verbatim im.FileImageLoadBitmap(file_name: string, [index: number]) -> image: imImage, error: number [in Lua 5] \endverbatim * Default index is 0. * \ingroup imgfile

imFileImageLoadRegion
imImage* imFileImageLoadRegion(const(char)* file_name, int index, int bitmap, int* error, int xmin, int xmax, int ymin, int ymax, int width, int height)

Loads an image region from file. Open, loads and closes the file. \n * index specifies the image number between 0 and image_count-1. \n * Returns NULL if failed. * Attributes from the file will be stored at the image. * See also \ref imErrorCodes. \n * For now, it works only for the ECW file format. * * \verbatim im.FileImageLoadRegion(file_name: string, index, bitmap, xmin, xmax, ymin, ymax, width, height: number, ) -> image: imImage, error: number [in Lua 5] \endverbatim * Default index is 0. * \ingroup imgfile

imFileImageSave
int imFileImageSave(const(char)* file_name, const(char)* format, const(imImage)* image)

Saves the image to file. Open, saves and closes the file. \n * Returns error code. \n * Attributes from the image will be stored at the file. * * \verbatim im.FileImageSave(file_name: string, format: string, image: imImage) -> error: number [in Lua 5] \endverbatim * \verbatim image:Save(file_name: string, format: string) -> error: number [in Lua 5] \endverbatim * \ingroup imgfile

imFileLoadBitmap
imImage* imFileLoadBitmap(imFile* ifile, int index, int* error)

Loads an image from an already open file, but forces the image to be a bitmap.\n * The returned imagem will be always a Bitmap image, with color_space RGB, MAP, GRAY or BINARY, and data_type IM_BYTE. \n * index specifies the image number between 0 and image_count-1. \n * Returns NULL if failed. * Attributes from the file will be stored at the image. * See also \ref imErrorCodes. * * \verbatim ifile:LoadBitmap([index: number]) -> image: imImage, error: number [in Lua 5] \endverbatim * Default index is 0. * \ingroup imgfile

imFileLoadBitmapFrame
void imFileLoadBitmapFrame(imFile* ifile, int index, imImage* image, int* error)

Loads an image from an already open file, but forces the image to be a bitmap.\n * This function assumes that the image in the file has the same parameters as the given image. \n * The imagem must be a Bitmap image, with color_space RGB, MAP, GRAY or BINARY, and data_type IM_BYTE. \n * index specifies the image number between 0 and image_count-1. \n * Returns NULL if failed. * Attributes from the file will be stored at the image. * See also \ref imErrorCodes. * * \verbatim ifile:LoadBitmapFrame(index: number, image: imImage) -> error: number [in Lua 5] \endverbatim * Default index is 0. * \ingroup imgfile

imFileLoadImage
imImage* imFileLoadImage(imFile* ifile, int index, int* error)

Loads an image from an already open file. Returns NULL if failed. \n * This will call \ref imFileReadImageInfo and \ref imFileReadImageData. \n * index specifies the image number between 0 and image_count-1. \n * The returned image will be of the same color_space and data_type of the image in the file. \n * Attributes from the file will be stored at the image. * See also \ref imErrorCodes. * * \verbatim ifile:LoadImage([index: number]) -> image: imImage, error: number [in Lua 5] \endverbatim * Default index is 0. * \ingroup imgfile

imFileLoadImageFrame
void imFileLoadImageFrame(imFile* ifile, int index, imImage* image, int* error)

Loads an image from an already open file. Returns NULL if failed. \n * This function assumes that the image in the file has the same parameters as the given image. \n * This will call \ref imFileReadImageInfo and \ref imFileReadImageData. \n * index specifies the image number between 0 and image_count-1. \n * The returned image will be of the same color_space and data_type of the image in the file. \n * Attributes from the file will be stored at the image. * See also \ref imErrorCodes. * * \verbatim ifile:LoadImageFrame(index: number, image: imImage) -> error: number [in Lua 5] \endverbatim * Default index is 0. * \ingroup imgfile

imFileLoadImageRegion
imImage* imFileLoadImageRegion(imFile* ifile, int index, int bitmap, int* error, int xmin, int xmax, int ymin, int ymax, int width, int height)

Loads an image region from an already open file. Returns NULL if failed. \n * This will call \ref imFileReadImageInfo and \ref imFileReadImageData. \n * index specifies the image number between 0 and image_count-1. \n * The returned image will be of the same color_space and data_type of the image in the file, * or will be a Bitmap image. \n * Attributes from the file will be stored at the image. * See also \ref imErrorCodes. \n * For now, it works only for the ECW file format. * * \verbatim ifile:LoadRegion(index, bitmap, xmin, xmax, ymin, ymax, width, height: number) -> image: imImage, error: number [in Lua 5] \endverbatim * Default index is 0. * \ingroup imgfile

imFileSaveImage
int imFileSaveImage(imFile* ifile, const(imImage)* image)

Saves the image to an already open file. \n * This will call \ref imFileWriteImageInfo and \ref imFileWriteImageData. \n * Attributes from the image will be stored at the file. * Returns error code. * * \verbatim ifile:SaveImage(image: imImage) -> error: number [in Lua 5] \endverbatim * \ingroup imgfile

imImageAddAlpha
void imImageAddAlpha(imImage* image)

Adds an alpha channel plane and sets its value to 0 (transparent). * * \verbatim image:AddAlpha() [in Lua 5] \endverbatim * \ingroup imgclass

imImageClear
void imImageClear(imImage* image)

Sets all image data to zero. But if color space is YCBCR, LAB or LUV, and data type is BYTE or USHORT, then * data is initialized with 128 or 32768 accordingly. Alpha is initialized as transparent (0). * * \verbatim image:Clear() [in Lua 5] \endverbatim * \ingroup imgclass

imImageClone
imImage* imImageClone(const(imImage)* image)

Creates a clone of the image. i.e. same attributes but ignore contents. * * \verbatim image:Clone() -> new_image: imImage [in Lua 5] \endverbatim * \ingroup imgclass

imImageCopy
void imImageCopy(const(imImage)* src_image, imImage* dst_image)

Copy image data and attributes from one image to another. \n * Images must have the same size and type. * * \verbatim image:Copy(dst_image: imImage) [in Lua 5] \endverbatim * \ingroup imgclass

imImageCopyAttributes
void imImageCopyAttributes(const(imImage)* src_image, imImage* dst_image)

Copies the image attributes from src to dst. * Includes the pallete if defined in both images. * * \verbatim image:CopyAttributes(dst_image: imImage) [in Lua 5] \endverbatim * \ingroup imgclass

imImageCopyData
void imImageCopyData(const(imImage)* src_image, imImage* dst_image)

Copy image data only fom one image to another. \n * Images must have the same size and type. * * \verbatim image:CopyData(dst_image: imImage) [in Lua 5] \endverbatim * \ingroup imgclass

imImageCopyPlane
void imImageCopyPlane(const(imImage)* src_image, int src_plane, imImage* dst_image, int dst_plane)

Copy one image plane fom one image to another. \n * Images must have the same size and type. * * \verbatim image:CopyPlane(src_plane: number, dst_image: imImage, dst_plane: number) [in Lua 5] \endverbatim * \ingroup imgclass

imImageCreate
imImage* imImageCreate(int width, int height, int color_space, int data_type)

Creates a new image. * See also \ref imDataType and \ref imColorSpace. Image data is cleared as \ref imImageClear. \n * In Lua the IM image metatable name is "imImage". * When converted to a string will return "imImage(%p) [width=%d,height=%d,color_space=%s,data_type=%s,depth=%d]" where %p is replaced by the userdata address, * and other values are replaced by the respective attributes. * If the image is already destroyed by im.ImageDestroy, then it will return also the suffix "-destroyed". * * \verbatim im.ImageCreate(width: number, height: number, color_space: number, data_type: number) -> image: imImage [in Lua 5] \endverbatim * \ingroup imgclass

imImageCreateBased
imImage* imImageCreateBased(const(imImage)* image, int width, int height, int color_space, int data_type)

Creates a new image based on an existing one. \n * If the addicional parameters are -1, the given image parameters are used. \n * The image atributes always are copied. HasAlpha is copied. * See also \ref imDataType and \ref imColorSpace. * * \verbatim im.ImageCreateBased(image: imImage, [width: number], [height: number], [color_space: number], [data_type: number]) -> image: imImage [in Lua 5] \endverbatim * The addicional parameters in Lua can be nil, * and they can also be functions with the based image as a parameter to return the respective value. * \ingroup imgclass

imImageDestroy
void imImageDestroy(imImage* image)

Destroys the image and frees the memory used. * image data is destroyed only if its data[0] is not NULL. \n * In Lua if this function is not called, the image is destroyed by the garbage collector. * * \verbatim im.ImageDestroy(image: imImage) [in Lua 5] \endverbatim * \verbatim image:Destroy() [in Lua 5] \endverbatim * \ingroup imgclass

imImageDuplicate
imImage* imImageDuplicate(const(imImage)* image)

Creates a copy of the image. * * \verbatim image:Duplicate() -> new_image: imImage [in Lua 5] \endverbatim * \ingroup imgclass

imImageGetAttribInteger
int imImageGetAttribInteger(const(imImage)* image, const(char)* attrib, int index)

Returns an extended attribute as an integer. * \verbatim image:GetAttribInteger(attrib: string, [index: number]) -> value: number [in Lua 5] \endverbatim \ingroup imgclass

imImageGetAttribReal
double imImageGetAttribReal(const(imImage)* image, const(char)* attrib, int index)

Returns an extended attribute as a real. * \verbatim image:GetAttribReal(attrib: string, [index: number]) -> value: number [in Lua 5] \endverbatim \ingroup imgclass

imImageGetAttribString
const(char)* imImageGetAttribString(const(imImage)* image, const(char)* attrib)

Returns an extended attribute as a string. * \verbatim image:GetAttribString(attrib: string) -> value: string [in Lua 5] \endverbatim \ingroup imgclass

imImageGetAttribute
const(void)* imImageGetAttribute(const(imImage)* image, const(char)* attrib, int* data_type, int* count)

Returns an extended attribute. \n * Returns NULL if not found. * See also \ref imDataType. * * \verbatim image: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. * \ingroup imgclass

imImageGetAttributeList
void imImageGetAttributeList(const(imImage)* image, char** attrib, int* attrib_count)

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 image:GetAttributeList() -> data: table of strings [in Lua 5] \endverbatim * \ingroup imgclass

imImageInit
imImage* imImageInit(int width, int height, int color_mode, int data_type, void* data_buffer, c_long* palette, int palette_count)

Initializes the image structure but does not allocates image data. * See also \ref imDataType and \ref imColorSpace. * The only addtional flag thar color_mode can has here is IM_ALPHA. * To release the image structure without releasing the buffer, * set "data[0]" to NULL before calling imImageDestroy. * \ingroup imgclass

imImageIsBitmap
int imImageIsBitmap(const(imImage)* image)

Indicates that the image can be viewed in common graphic devices. * Data type must be IM_BYTE. Color mode can be IM_RGB, IM_MAP, IM_GRAY or IM_BINARY. * * \verbatim image:IsBitmap() -> is_bitmap: boolean [in Lua 5] \endverbatim * \ingroup imgclass

imImageMakeBinary
void imImageMakeBinary(imImage* image)

Changes a gray BYTE data (0,255) into a binary data (0,1), done in-place. * Color space is not changed. Data type must be IM_BYTE. * * \verbatim image:MakeBinary() [in Lua 5] \endverbatim * \ingroup imgclass

imImageMakeGray
void imImageMakeGray(imImage* image)

Changes a binary data (0,1) into a gray BYTE data (0,255), done in-place. * Color space is not changed. Data type must be IM_BYTE. * * \verbatim image:MakeGray() [in Lua 5] \endverbatim * \ingroup imgclass

imImageMatch
int imImageMatch(const(imImage)* image1, const(imImage)* image2)

Returns 1 if the images match in width, height, data type and color space. Returns 0 otherwise. * * \verbatim image:Match(image2: imImage) -> match: boolean [in Lua 5] \endverbatim * \ingroup imgclass

imImageMatchColor
int imImageMatchColor(const(imImage)* image1, const(imImage)* image2)

Returns 1 if the images match color mode and data type. Returns 0 otherwise. * * \verbatim image:MatchColor(image2: imImage) -> match: boolean [in Lua 5] \endverbatim * \ingroup imgclass

imImageMatchColorSpace
int imImageMatchColorSpace(const(imImage)* image1, const(imImage)* image2)

Returns 1 if the images match width, height and color space. Returns 0 otherwise. * * \verbatim image:MatchColorSpace(image2: imImage) -> match: boolean [in Lua 5] \endverbatim * \ingroup imgclass

imImageMatchDataType
int imImageMatchDataType(const(imImage)* image1, const(imImage)* image2)

Returns 1 if the images match width, height and data type. Returns 0 otherwise. * * \verbatim image:MatchDataType(image2: imImage) -> match: boolean [in Lua 5] \endverbatim * \ingroup imgclass

imImageMatchSize
int imImageMatchSize(const(imImage)* image1, const(imImage)* image2)

Returns 1 if the images match width and height. Returns 0 otherwise. * * \verbatim image:MatchSize(image2: imImage) -> match: boolean [in Lua 5] \endverbatim * \ingroup imgclass

imImageMergeAttributes
void imImageMergeAttributes(const(imImage)* src_image, imImage* dst_image)

Merges the image attributes from src to dst. \n * Attributes that exist in dst are not replaced. * Doens NOT include the pallete. * * \verbatim image:MergeAttributes(dst_image: imImage) [in Lua 5] \endverbatim * \ingroup imgclass

imImageRemoveAlpha
void imImageRemoveAlpha(imImage* image)

Removes the alpha channel plane if any. * * \verbatim image:RemoveAlpha() [in Lua 5] \endverbatim * \ingroup imgclass

imImageReshape
void imImageReshape(imImage* image, int width, int height)

Changes the buffer size. Reallocate internal buffers if the new size is larger than the original. * * \verbatim image:Reshape(width: number, height: number) [in Lua 5] \endverbatim * \ingroup imgclass

imImageSetAlpha
void imImageSetAlpha(imImage* image, float alpha)

Sets the alpha channel plane to a constant. * * \verbatim image:SetAlpha(alpha: number) [in Lua 5] \endverbatim * \ingroup imgclass

imImageSetAttribInteger
void imImageSetAttribInteger(const(imImage)* image, const(char)* attrib, int data_type, int value)

Changes an extended attribute as an integer. * \verbatim image:SetAttribInteger(attrib: string, data_type: number, value: number) [in Lua 5] \endverbatim \ingroup imgclass

imImageSetAttribReal
void imImageSetAttribReal(const(imImage)* image, const(char)* attrib, int data_type, double value)

Changes an extended attribute as a real. * \verbatim image:SetAttribReal(attrib: string, data_type: number, value: number) [in Lua 5] \endverbatim \ingroup imgclass

imImageSetAttribString
void imImageSetAttribString(const(imImage)* image, const(char)* attrib, const(char)* value)

Changes an extended attribute as a string. * \verbatim image:SetAttribString(attrib: string, value: string) [in Lua 5] \endverbatim \ingroup imgclass

imImageSetAttribute
void imImageSetAttribute(const(imImage)* image, const(char)* attrib, int data_type, int count, const(void)* data)

Changes an extended attribute. \n * The data will be internally duplicated. \n * If data is NULL and count==0 the attribute is removed. \n * If count is -1 and data_type is IM_BYTE then data is zero terminated. * See also \ref imDataType. * * \verbatim image:SetAttribute(attrib: string, data_type: number, data: table of numbers or string) [in Lua 5] \endverbatim * If data_type is IM_BYTE, a string can be used as data. * \ingroup imgclass

imImageSetBinary
void imImageSetBinary(imImage* image)

Changes the image color space to binary * by just changing color_space and the palette. * Image must be MAP or GRAY/BYTE. * * \verbatim image:SetBinary() [in Lua 5] \endverbatim * \ingroup imgclass

imImageSetGray
void imImageSetGray(imImage* image)

Changes the image color space to gray * by just changing color_space and the palette. * Image must be BINARY or MAP. Palette is changed only if image was BINARY. * * \verbatim image:SetGray() [in Lua 5] \endverbatim * \ingroup imgclass

imImageSetMap
void imImageSetMap(imImage* image)

Changes the image color space to map * by just changing color_space. \n * Image must be BINARY or GRAY/BYTE. * * \verbatim image:SetMap() [in Lua 5] \endverbatim * \ingroup imgclass

imImageSetPalette
void imImageSetPalette(imImage* image, c_long* palette, int palette_count)

Changes the image palette. * This will destroy the existing palette and replace it with the given palette pointer. * Only the pointer is stored, so the palette should be a new palette and it can not be a static array. * * \verbatim image:SetPalette(palette: imPalette) [in Lua 5] \endverbatim * \ingroup imgclass

imcdCanvasPutImage
void imcdCanvasPutImage(cdCanvas* _canvas, imImage* _image, int _x, int _y, int _w, int _h, int _xmin, int _xmax, int _ymin, int _ymax)

Utility macro to draw the image in a CD library canvas. * Works only for data_type IM_BYTE, and color spaces: IM_RGB, IM_MAP, IMGRAY and IM_BINARY. * \ingroup imgclass

Structs

_imImage
struct _imImage

\brief Image Representation Structure * * \par * An image representation than supports all the color spaces, * but planes are always unpacked and the orientation is always bottom up. * \ingroup imgclass

Meta