neversaint has asked for the wisdom of the Perl Monks concerning the following question:

Dear Masters,

Is there any module that allow you to detect the size (width and length) of a figure?
This information is used for estimating figure resize, for attachment in HTML file.

---
neversaint and everlastingly indebted.......
  • Comment on CPAN Module for Detecting Dimension of a PNG/GIF/JPEG File

Replies are listed 'Best First'.
Re: CPAN Module for Detecting Dimension of a PNG/GIF/JPEG File
by erroneousBollock (Curate) on Sep 20, 2007 at 07:39 UTC
Re: CPAN Module for Detecting Dimension of a PNG/GIF/JPEG File
by Tux (Canon) on Sep 20, 2007 at 09:22 UTC

    Apart from those two, you could also try Image::ExifTool or (much too heave for just getting the size) Image::Magick


    Enjoy, Have FUN! H.Merijn
      Image::Magick can be used to do the actual image resizing, in one go, so it might not be too much overkill after all.

      Note that you can resize an image to a maximum size for both width and height, so there's no need to calculate the final dimensions, based on the aspect ratio, yourself.

Re: CPAN Module for Detecting Dimension of a PNG/GIF/JPEG File
by grinder (Bishop) on Sep 20, 2007 at 12:13 UTC

    And once you have resized your images, you can determine the size of the HTML page (that is, in bytes) with HTTP::Size, which will give you an idea of how long it will take to transfer.

    Less important these days when even at home most people have 8Mb/sec download rates (at least in this corner of the planet). On the other hand, if absolute numbers of visitors increases, slimmer pages may mean the difference between hitting your monthly cap, or not, if your hoster is that ways inclined.

    • another intruder with the mooring in the heart of the Perl