RMagick: img.extract_info contains no data

Hi guys…

i tried to find out the height and width of an img:

img = Image.read(absolut_path_to_a_nice_picture).first
puts img.inspect
puts img.extract_info

gets:

nice_picture.jpg JPEG 3504x2336 3504x2336+0+0 DirectClass 8-bit 2727kb
width=0, height=0, x=0, y=0

anybody knows, how I can get the sizes of an image?!?

thanks Guido

Hello Guido,

Try this:

img = Image.read(absolute_path_to_a_nice_picture).first

puts 'Width: ', img.columns
puts 'Height: ', img.rows

Hope this helps

Regards,
Alex

Alex Podaras wrote:

Hello Guido,

Try this:

img = Image.read(absolute_path_to_a_nice_picture).first

puts 'Width: ', img.columns
puts 'Height: ', img.rows

Hope this helps

Regards,
Alex

thats rocks! thanx :wink: