Sha256: 53612fe624075351ac5d024a1802a071822895dd4009b66ab9e429e9a089e0d9
Contents?: true
Size: 710 Bytes
Versions: 12
Compression:
Stored size: 710 Bytes
Contents
#!/usr/bin/ruby require "vips" require "down/http" # byte_source = File.open ARGV[0], "rb" # eg. https://images.unsplash.com/photo-1491933382434-500287f9b54b byte_source = Down::Http.open(ARGV[0]) source = Vips::SourceCustom.new source.on_read do |length| puts "reading #{length} bytes ..." byte_source.read length end source.on_seek do |offset, whence| puts "seeking to #{offset}, #{whence}" byte_source.seek(offset, whence) end byte_target = File.open ARGV[1], "wb" target = Vips::TargetCustom.new target.on_write { |chunk| byte_target.write(chunk) } target.on_finish { byte_target.close } image = Vips::Image.new_from_source source, "", access: :sequential image.write_to_target target, ".jpg"
Version data entries
12 entries across 12 versions & 3 rubygems