Not sure if it is really good code but i have been working on it in perl. You need Image::Magick for it to work...
here it is:
compression:
Code:
#!/usr/bin/perl
use Image::Magick;
#Ask for number of images to compress
sub first
{
print "type the number of images to compress\n";
print "2, 3, 4\n";
$number=<>;
chomp $number;
if ($number eq 2)
{
&two;
} elsif ($number eq 3) {
&three;
} elsif ($number eq 4) {
&four;
} else {
print "your numb#!/usr/bin/perl
use Image::Magick;
#Ask for number of images to compress
sub first
{
print "type the number of images to compress\n";
print "2, 3, 4\n";
$number=<>;
chomp $number;
if ($number eq 2)
{
&two;
} elsif ($number eq 3) {
&three;
} elsif ($number eq 4) {
&four;
} else {
print "your number did not match any of the above numbers, try again\n\n";
reset (&first);
&first;
}
}
#If desired number is two
sub two
{
print "input two images to compress\n";
print "1)";
$photo1=<>;
print "2)";
$photo2=<>;
chomp ($photo1, $photo2);
$image1=Image::Magick->new;
$image1->Read ("$photo1", "$photo2");
$image1->Write ('x2.gif');
undef $image1;
undef $photo1;
undef $photo2;
undef $number;
&first;
}
#If desired number is three
sub three
{
print "input three images to compress\n";
print "1)";
$photo3=<>;
print "2)";
$photo4=<>;
print "3)";
$photo5=<>;
chomp ($photo3, $photo4, $photo5);
$image2=Image::Magick->new;
$image2->Read ("$photo3", "$photo4", "$photo5");
$image2->Write ('x3.gif');
undef $image2;
undef $photo3;
undef $photo4;
undef $photo5;
undef $number;
&first;
}
#If desired number is four
sub four
{
print "input four images to compress\n";
print "1)";
$photo6=<>;
print "2)";
$photo7=<>;
print "3)";
$photo8=<>;
print "4)";
$photo9=<>;
chomp ($photo6, $photo7, $photo8, $photo9);
$image3=Image::Magick->new;
$image3->Read ("$photo6", "$photo7", "$photo8", "$photo9");
$image3->Write ('x4.gif');
undef $image3;
undef $photo6;
undef $photo7;
undef $photo8;
undef $photo9;
undef $number;
&first;
}
&first;er did not match any of the above numbers, try again\n\n";
reset (&first);
&first;
}
}
#If desired number is two
sub two
{
print "input two images to compress\n";
print "1)";
$photo1=<>;
print "2)";
$photo2=<>;
chomp ($photo1, $photo2);
$image1=Image::Magick->new;
$image1->Read ("$photo1", "$photo2");
$image1->Write ('x2.gif');
undef $image1;
undef $photo1;
undef $photo2;
undef $number;
&first;
}
#If desired number is three
sub three
{
print "input three images to compress\n";
print "1)";
$photo3=<>;
print "2)";
$photo4=<>;
print "3)";
$photo5=<>;
chomp ($photo3, $photo4, $photo5);
$image2=Image::Magick->new;
$image2->Read ("$photo3", "$photo4", "$photo5");
$image2->Write ('x3.gif');
undef $image2;
undef $photo3;
undef $photo4;
undef $photo5;
undef $number;
&first;
}
#If desired number is four
sub four
{
print "input four images to compress\n";
print "1)";
$photo6=<>;
print "2)";
$photo7=<>;
print "3)";
$photo8=<>;
print "4)";
$photo9=<>;
chomp ($photo6, $photo7, $photo8, $photo9);
$image3=Image::Magick->new;
$image3->Read ("$photo6", "$photo7", "$photo8", "$photo9");
$image3->Write ('x4.gif');
undef $image3;
undef $photo6;
undef $photo7;
undef $photo8;
undef $photo9;
undef $number;
&first;
}
&first;
Decompression:
#!/usr/bin/perl
use Image::Magick;
print "enter gif to decompress\n";
$in=<>;
chomp $in;
$image= Image::Magick->new;
$image->Read ("$in");
$image->Write ('x.png');
undef $image;
That is all
A friend and i use it to send messages to each other...LOL Childish......