use strict;
use warnings;
use Image::Magick;
use Imager;
use LWP::Simple;

my $data = get('http://www.yahoo.co.jp/favicon.ico');

use_image_magick( $data );
#use_imager( $data );

exit;

sub use_image_magick {
  my $data = shift;
  my $im = Image::Magick->new;
  $im->set( Magick => 'ico');
  $im->BlobToImage($data);
 # $im->Resize(width=>16, height=>16);
  $im->Write('png:favicon.png');
  undef $im;
}

sub use_imager {
  my $data = shift;
  my $im = Imager->new; 
  $im->read( data => $data, type => 'ico' );
  $im = $im->scale(  xpixels => 16, ypixels => 16, type => 'min' );
  $im->write( file => 'favicon.png' );
  undef $im;
}



__END__
