-
-
Save greenbigfrog/5f616f7a94862e4679ea39f076743da0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "gobject" | |
require_gobject "Vips" | |
def new_from_file(path : String) : Vips::Image | |
img = Vips::Image.new_from_file_rw(path) | |
end | |
def write_to_file(img : Vips::Image, filename : String) | |
LibVips.vips_image_write_to_file(img, filename) | |
end | |
lib LibVips | |
# https://libvips.github.io/libvips/API/current/VipsImage.html#vips-image-write-to-file | |
fun vips_image_write_to_file(image : LibVips::Image*, name : LibC::Char*) | |
end | |
puts "Reading image" | |
img = new_from_file("/home/frog/dhash-cr/test.jpg") | |
pp img | |
puts "Read img with width #{img.width} and height #{img.height}" | |
write_to_file(img, "out.jpg") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment