module

CrImage::Format::PNG

Provides methods to read from and write to PNG. Requires libspng to function.

image = File.open("image.png") { |file| CrImage::RGBAImage.from_png(file) }
File.open("other_image.png") { |file| image.to_png(file) }

Alternatively, you can use the convenience methods in the Open and Save modules to acheive the same thing:

image = CrImage::RGBAImage.open("image.png")
image.save("other_image.png")

Instance methods

to_png(io : IO) : Nil

Output the image as PNG to io

Source