Is there a simple way to get image dimensions in Ruby?

前端 未结 8 945
隐瞒了意图╮
隐瞒了意图╮ 2020-12-14 06:57

I\'m looking for an easy way to get width and height dimensions for image files in Ruby without having to use ImageMagick or ImageScience (running Snow Leapard).

8条回答
  •  独厮守ぢ
    2020-12-14 07:13

    For PNGs I got this modified version of ChristopeD's method to work.

    File.binread(path, 64)[0x10..0x18].unpack('NN')
    

提交回复
热议问题