my $count;
foreach my $item (@names) {
$count++;
my $photo = '../photo' . $count . '.jpg';
my $image = Image::Magick->new(magick=>'JPEG');
my $x = $image->Read($item);
$x = $image->Scale(width=>'50', height=> '50');
$x and die("Error scaling: $x");
$x = $image->Write($photo);
$x and die("Error writing: $x");
print qq~
~;
}