While this is likely a dead end issue, and knowing and being well informed that the LZW compression is proprietary and owned by a large corporationg that will sue individuals and people, is there a script or method that I can provide a web based solution for converting .gifs to .pngs ONLINE?
I would like to make that an offering and I have done a fair amount of research and so far have found NOTHING to offer this in the form of a script (PHP or yuk ... perl).
Thank you for your help and advice.
I found this script:
function readgif($imgfn) {
global $imgw,$imgh;
$imgfd = fopen ($imgfn, "r");
$imgheader=fread ($imgfd, 6);
if ($imgheader != "GIF87a" && $imgheader != "GIF89a") {
fclose($imgfd);
// die("$imgfn is not a GIF file");
return "0";
}
// Examine the Logical Screen Descriptor
// my($lsw, $lsh, $pf, $bg, $par) = unpack("vvCCC", read_n_bytes(7));
$imgheader = unpack("vnul/veen/Ctwee/Cdrie/Cvier", fread ($imgfd, 7));
$pf = $imgheader["twee"];
// Is it followed by a Global Color table?
if ($pf & 128) {
// Skip the Global Color Table
$GCTsize = $pf & 7;
fread ($imgfd, 3 * (2 << $GCTsize));
}
// Go through the markers in the header. Stop when height and width are
// determined or when end of header is reached
while (1) {
// Get the next marker
$c = fread ($imgfd, 1);
if ($c == chr(33)) {
// This is an Extension.
// Read the label.
$c = fread ($imgfd, 1);
// Read the remainder of this Extension Block and while we're at it,
// read all possible Data Sub-blocks as well.
while ($blksize = ord(fread ($imgfd, 1))) {
fread ($imgfd, $blksize);
}
} elseif ($c == chr(44)) {
// This is the most holy of all... The Image Descriptor.
$nheader=unpack("vnul/veen/vtwee/vdrie/Cvier", fread ($imgfd, 9));
$imgw=ushort($nheader["twee"]);
$imgh=ushort($nheader["drie"]);
fclose($imgfd);
return "width=$imgw height=$imgh";
} else {
fclose($imgfd);
return "nothing";
}
}
}
But with this I can determine the dimensions of the image. I don't believe it will offer much assistance.