png/writer
src/png/writer.tur
defn
png-write
(png-write [path :cstr img :int] :ptr<void>)
write an image handle to a PNG file on disk.
Parameters
| path | destination filesystem path for the PNG file | |
| img | image handle (ok-val from png-read in png/reader) |
Returns
(ok 0) on success; (err 0) on failure.
Example
(let [r (png-write "/tmp/out.png" img)]
(if (ok? r) (println "written") (println "write failed")))
Since: PN0
defn
png-write-raw
(png-write-raw [path :cstr pixels :cstr width :int height :int channels :int bit-depth :int] :ptr<void>)
write raw pixel data to a PNG file on disk.
Parameters
| path | destination filesystem path for the PNG file | |
| pixels | pointer to pixel data as :cstr (row-major interleaved bytes) | |
| width | image width in pixels | |
| height | image height in pixels | |
| channels | number of channels: 1=GRAY, 2=GRAY_ALPHA, 3=RGB, 4=RGBA | |
| bit-depth | bit depth per channel (typically 8) |
Returns
(ok 0) on success; (err 0) on failure.
Example
(let [r (png-write-raw "/tmp/out.png" buf 256 256 4 8)]
(if (ok? r) (println "written") (println "write failed")))
Since: PN0
Internal definitions
__ok-- create an ok result wrapping integer value v.__err-- create an err result wrapping integer error value e.