hotcurry
09-24-2003, 01:41 AM
Hi there, im a perl newbie and i needed some help on how to convert a gif image into hexadecimal(hex)...i need a method that takes an image as a parameter and returns its hex value... I found this script on the web but it doesnt seem to be of much use...please advise
sub convert2gif{
my($myimage);
open(FL,"$imagesdir/picmsgs/$myimage.gif") ;
binmode(FL);
read(FL,$data,(-s "$imagesdir/picmsgs/$myimage.gif"));
$data=unpack("H*",$data);
open(FO,">output.txt");
print(FO $data);
close(FO);
close(FL);
return;
}
sub convert2gif{
my($myimage);
open(FL,"$imagesdir/picmsgs/$myimage.gif") ;
binmode(FL);
read(FL,$data,(-s "$imagesdir/picmsgs/$myimage.gif"));
$data=unpack("H*",$data);
open(FO,">output.txt");
print(FO $data);
close(FO);
close(FL);
return;
}