module

CrImage::Format::JPEG

Provides methods to read from and write to jpeg. Requires libturbojpeg to function.

image = File.open("image.jpg") { |file| CrImage::RGBAImage.from_jpeg(file) }
File.open("other_image.jpg") { |file| image.to_jpeg(file) }

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

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

Instance methods

to_jpeg(io : IO, quality : Int32 = 100) : Nil

Output the image as JPEG to io

Source