use 5.020; use warnings; use Image::Epeg qw(:constants); use LWP::Simple; # Copyright notice for the image: # By Randal Schwartz from Portland, OR, USA - Flickr, CC BY-SA 2.0, # https://commons.wikimedia.org/w/index.php?curid=2938351 my $image = get("https://upload.wikimedia.org/wikipedia/commons/b/b3/Larry_Wall_YAPC_2007.jpg"); die "Failed to load the image" unless defined $image; my $epeg = Image::Epeg->new(\$image); $epeg->resize(150,150,MAINTAIN_ASPECT_RATIO); $epeg->write_file("thumbnail.jpg");