in reply to Re^2: How to save different format of images from webpages
in thread How to save different format of images from webpages

Either the url tells you, or the headers tell you, or nothing tells you and you have to guess

LWP::MediaTypes, File::MMagic

$ ls -loanh *.gif -rw-rw-rw- 1 0 53 2010-09-17 23:39 working.gif $ perl -MWWW::Mechanize -le" $ua = WWW::Mechanize->new; $ua->get('file +:working.gif'); die $ua->ct; " image/gif at -e line 1. $ perl -MWWW::Mechanize -MLWP::MediaTypes=media_suffix -le" $ua = WWW: +:Mechanize->new; $ua->get('file:working.gif'); die media_suffix( $ua- +>ct ); " gif at -e line 1.