javascriptruby-on-railsimgkit

imgkit get height of image


what I'd like to do is very simple. I have a code which uses a imgkit library to load some webpage image and then stores it. It looks like that:

kit = IMGKit.new(site, :quality => 5, :width => 1024)
img = kit.to_img(:png)
file = kit.to_file("#{Rails.root}/public/images/#{s2}.png")

I need to know the image height after loading in order to stretch canvas element behind it. Is there a way I can get the height ? Or if not, how could I achieve this without knowing the image height before loading, javascript ?


Solution

  • Ok, I've figured it out. Mini_magick gem was a fine way how to do this.