RMagick: img.extract_info contains no data

Discussion in 'Ruby' started by Guido Holz, Feb 19, 2008.

  1. Guido Holz

    Guido Holz Guest

    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
    --
    Posted via http://www.ruby-forum.com/.
     
    Guido Holz, Feb 19, 2008
    #1
    1. Advertising

  2. Guido Holz

    Alex Podaras Guest

    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

    On Feb 19, 2008, at 11:52 AM, Guido Holz wrote:

    > 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
    > --
    > Posted via http://www.ruby-forum.com/.
    >
     
    Alex Podaras, Feb 19, 2008
    #2
    1. Advertising

  3. Guido Holz

    Guido Holz Guest

    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 ;-)
    --
    Posted via http://www.ruby-forum.com/.
     
    Guido Holz, Feb 19, 2008
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. news.austin.rr.com

    how to download img from html img tag

    news.austin.rr.com, Apr 27, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    538
    Steve C. Orr [MVP, MCSD]
    Apr 27, 2005
  2. Philipp Lenssen

    Problem: <img></img>

    Philipp Lenssen, Jun 27, 2005, in forum: XML
    Replies:
    15
    Views:
    805
    David Håsäther
    Jul 3, 2005
  3. Jopek
    Replies:
    7
    Views:
    428
    dorayme
    Apr 26, 2009
  4. Pito Salas
    Replies:
    1
    Views:
    159
    Tim Hunter
    Apr 24, 2009
  5. Replies:
    7
    Views:
    205
    Tad McClellan
    Jun 22, 2006
Loading...

Share This Page