Skip to content

Instantly share code, notes, and snippets.

@ajokela
Forked from mchung/imgscalr.rb
Created October 7, 2011 19:40
Show Gist options
  • Save ajokela/1271185 to your computer and use it in GitHub Desktop.
Save ajokela/1271185 to your computer and use it in GitHub Desktop.
imgscalr in jruby
require "imgscalr-lib" # https://github.com/thebuzzmedia/imgscalr
require "jruby"
java_import "javax.imageio.ImageIO"
ImageIO.write(
com.thebuzzmedia.imgscalr.Scalr.resize(
ImageIO.read(java.io.File.new("iss.jpg")),
250),
"jpg",
java.io.File.new("iss_new.jpg"))
#file = java::io::File.new("iss.jpg")
#imgio = ImageIO.read(java.io.File.new("iss.jpg"))
#io = Scalr.resize(imgio, 150)
#f = java.io.File.new("foo.jpg")
#ImageIO.write(io, "jpg", f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment