LibPNG bindings for reading and writing png files in Julia.
TODO - Windows build is broken!
Pkg.clone("https://github.com/FugroRoames/LibPNG.jl.git")
using LibPNG
using ColorTypes
# Write RGB image
pixels = rand(RGB, 10, 10)
writeimage("pixels.png", pixels)
pixels_in = readimage("pixels.png")
# Convert to nchannel × height × width matrix
using ImageCore
pixels_matrix = channelview(pixels_in)
writeimage("pixels_channel.png", pixels_matrix)
The supported png image types are RGB
, RGBA
, Gray
and GrayA
as defined in ColorTypes.jl
.
The expected memory structure for images are nchannel × height × width.