Re the intermittent reporting of sizes: numerous "standards" (and wanna'-be-standards) call for <img ...> tags to include ... width="nn"... (where nn is a value in pixels) and height (similarly) arguments.

But, as with most things webbish, many programs and/or people ignore those standards, posting html like this:

<img src="/graphics/foo.jpg">

Your introductory line, "...parsing an image's size from a URL (not local path)" implies something very different than what jhourcle (above) discusses. That node may reflect your intent more precisely, but if I take your quoted remark litterally, I don't think it can be done because there's no info about the size(s) of any contained image(s) in a URL itself.

However, getting sizes from properly formatted <img...> tags at a URL is readily do-able if the code at the address in question actually includes the requisite info.

The only ready alternative (that I see but Nota Bene: jhourcle 's above) for sites using non-compliant image tags is to feed your program with full_paths_to_images (by name) and pipe the images to a graphics package or program such as ImageMagick or the gimp. (For that, you may want to search here re Tk + image or gtk + image, where you may find help -- pay special attention to anything Zentara wrote).

You may wish to start with Corion's notes here or -- if you need background on images especially note Merlyn's and thpfft's replies to the referenced node.

FOOTNOTE, UPDATE With considerable chagrin, I note that even as I toiled over this largely wasted observation, Brother jhourcle correctly ( inferred||intuited||leapt to the correct conclusion ); namely, that your question referred to the module Image::Size. IMO, it would have been nice to mention that explicitly in the OP.


In reply to Re: determining image size by a URL by ww
in thread determining image size by a URL by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.