You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Imago is an image manipulation library for Common Lisp. It supports images in
png, portable bitmap (.pnm), Truevision TGA (.tga), jpeg, TIFF and HEIC
formats. You can read an image with imago:read-image and write an image with
imago:write-image, a correct image format will be automatically determined
from the image extension.
Dependencies
Some file formats require additional dependencies. Support for these formats are
split into separate systems:
You can also read and write images of these formats with imago:read-image and
imago:write-image once a suitable system is loaded. JPEG files can be read and
written without imago/jpeg-turbo, but the latter option is much more reliable.
Creating an image
To create an image look at the documentation for image classes (like
imago:rgb-image or imago:grayscale-image). You need to make an instance of
one of those classes by passing :w, :h and optionally :initial-color
keyword arguments to make-instance. Alternatively, you can use
make-XXX-image and make-XXX-image-from-pixels functions:
;; Create 100x100 px black grayscale image
(imago:make-grayscale-image 100 100)
;; Create 400x100 px red RGB image
(imago:make-rgb-image 400 100 (imago:make-color 255 0 0))
;; Create 400x100 px half-transparent red RGB image
(imago:make-rgb-image 400 100 (imago:make-color 255 0 0 127))
;; Create an image from an array of pixels
(imago:make-rgb-image-from-pixels
(make-array '(100 100)
:element-type 'imago:rgb-pixel
:initial-element (imago:make-color 0 255 255)))