(index ("read-image" 0) ("load-image" 0) ("read-image-info" 1309) ("load-image-info" 1309))
(def (sig (procedure " (read-image #!key channels)" (id read-image)) (procedure " (load-image u8vector #!key channels)" (id load-image))) (p "Decodes an image into raw pixel data. " (tt "read-image") " reads the image from from " (tt "(current-input-port)") " while " (tt "load-image") " gets this from the provided u8vector. The image type is detected by content, and may be: JPEG, PNG, TGA, BMP, PSD, GIF, HDR, PIC, PNM as explained in the heading comments of " (tt "stb_image.h") ".") (p "Both procedures return 4 values:") (ol (li "raw pixel data (as u8vector)") (li "width") (li "height") (li "number of channels")) (p "You can force the number of channels with the " (tt "channels") " keyword. If " (tt "channels") " is " (tt "#f") " or not given, the number of channels in the original image will be used.") (p "The size of the pixel data blob is always " (tt "(* width height channels)") " bytes. The first pixel is the top-left-most in the image. Each pixel is " (tt "channel") " number of bytes long. The number of channels define the pixel color, interleaved as follows:") (ol (li "grey") (li "grey, alpha") (li "red, green, blue") (li "red, green, blue, alpha")) (p (tt "read-image") " may read beyond the image data, so the data in " (tt "current-input-port") " should contain only one image."))
(def (sig (procedure " (read-image-info)" (id read-image-info)) (procedure " (load-image-info blob)" (id load-image-info))) (p "Like " (tt "read-image") " and " (tt "load-image") ", but does not load pixel data and should be faster. Returns three values:") (ol (li "width") (li "height") (li "number of channels")) (p "Note that on 32-bit systems, blobs cannot be larger than 16M. This limits image sizes as pixel data is stored as blobs."))
