7.3.1. Reading/Writing Image Files to/from IDX
(lsh/libimage/image-io.lsh)


Functions to read/write image files into/from an IDX. Image files can be in any format that ImageMagick's convert command can handle. The type of the input image is determined automatically.

7.3.1.0. (image-read-rgb f)
(lsh/libimage/image-io.lsh)


read an image file (in any format), and return an rgbimage with the image in it (IDX3 of ubytes with last dimension=3). Accepted format are whatever ImageMagick's convert command can convert to PPM. The type of the input image is determined automatically. In case it is not, the the type can be prepended to the filename with a colon. Command line options prepended to the argument are passed to convert.

Example:

(setq img (image-read-rgb "myimage.png"))
(setq img (image-read-rgb "TIFF:myimage.dunno"))
(setq img (image-read-rgb "-geometry 50x50% myimage.jpg"))


7.3.1.1. (image-read-rgba f)
(lsh/libimage/image-io.lsh)


read an image file (in any format), and return an rgbaimage with the image in it (IDX3 of ubytes with last dimension=4). The alpha channel is filled if the image being read has one. An alpha value of 0 means opaque and 255 means fully transparent (this is backward to many conventions in other places in the Lush library). Accepted format are whatever ImageMagick's convert command can convert to PPM. The type of the input image is determined automatically. In case it is not, the the type can be prepended to the filename with a colon Command line options prepended to the argument are passed to convert.

Example:

(setq img (image-read-rgba "-geometry 50x50% myimage.png"))
(setq img (image-read-rgba "-geometry 50x50% PNG:myimage"))


7.3.1.2. (image-read-ubim f)
(lsh/libimage/image-io.lsh)


read an image file (in any format), and return a ubimage with the image in it (IDX2 of ubytes) Accepted format are whatever ImageMagick's convert command can convert to PPM. Conversion to gryscale is performed by Lush, since convert doesn't convert to PGM.

7.3.1.3. (image-write-rgb f im)
(lsh/libimage/image-io.lsh)


Writes an image stored in an IDX3 of ubytes into an image file (in any format). The type of the output image file is determined by a string prepended to the filename with a colon. Command line options prepended to the argument are passed to the convert command

Example:

 (image-write-rgb "TIFF:myimage.tiff" m))


7.3.1.4. (image-write-ubim f im)
(lsh/libimage/image-io.lsh)


Writes an image stored in an IDX2 of ubytes into an grayscale image file (in any format). The type of the output image file is determined by a string prepended to the filename with a colon. Command line options prepended to the argument are passed to the convert command

Example:

 (image-write-ubim "myimage.png"))