png/info
img-width
(img-width [img :int] :int)
return the width of an image in pixels.
| img | image handle (ok-val from png-read) |
Image width as :int.
(println (img-width img))
Since: PN0
img-height
(img-height [img :int] :int)
return the height of an image in pixels.
| img | image handle (ok-val from png-read) |
Image height as :int.
(println (img-height img))
Since: PN0
img-channels
(img-channels [img :int] :int)
return the number of channels in an image.
| img | image handle (ok-val from png-read) |
Channel count as :int; always 4 (RGBA) for images loaded by png-read.
(println (img-channels img))
Since: PN0
img-bit-depth
(img-bit-depth [img :int] :int)
return the bit depth per channel of an image.
| img | image handle (ok-val from png-read) |
Bit depth as :int; always 8 for images loaded by png-read.
(println (img-bit-depth img))
Since: PN0
img-pixels
(img-pixels [img :int] :cstr)
return a raw pointer to the image pixel buffer as :cstr.
| img | image handle (ok-val from png-read) |
Pointer to the pixel buffer as :cstr (row-major interleaved RGBA bytes).
(let [buf (img-pixels img)] ...)
Since: PN0
pixel-r
(pixel-r [img :int x :int y :int] :int)
read the red channel of the pixel at (x, y).
| img | image handle (ok-val from png-read) | |
| x | column index (0-based) | |
| y | row index (0-based) |
Red channel value in [0, 255] as :int.
(println (pixel-r img 0 0))
Since: PN0
pixel-g
(pixel-g [img :int x :int y :int] :int)
read the green channel of the pixel at (x, y).
| img | image handle (ok-val from png-read) | |
| x | column index (0-based) | |
| y | row index (0-based) |
Green channel value in [0, 255] as :int.
(println (pixel-g img 0 0))
Since: PN0
pixel-b
(pixel-b [img :int x :int y :int] :int)
read the blue channel of the pixel at (x, y).
| img | image handle (ok-val from png-read) | |
| x | column index (0-based) | |
| y | row index (0-based) |
Blue channel value in [0, 255] as :int.
(println (pixel-b img 0 0))
Since: PN0
pixel-a
(pixel-a [img :int x :int y :int] :int)
read the alpha channel of the pixel at (x, y).
| img | image handle (ok-val from png-read) | |
| x | column index (0-based) | |
| y | row index (0-based) |
Alpha channel value in [0, 255] as :int; 255 if the image has fewer than 4 channels.
(println (pixel-a img 0 0))
Since: PN0
pixel-set!
(pixel-set! [img :int x :int y :int r :int g :int b :int a :int] :void)
write RGBA bytes to the pixel at (x, y).
| img | image handle (ok-val from png-read) | |
| x | column index (0-based) | |
| y | row index (0-based) | |
| r | red value in [0, 255] | |
| g | green value in [0, 255] | |
| b | blue value in [0, 255] | |
| a | alpha value in [0, 255] |
void
(pixel-set! img 0 0 255 0 0 255)
Since: PN0