
mhx
Enthusiast
/ Moderator
Oct 14, 2001, 11:38 AM
Post #2 of 3
(993 views)
|
You need to binmode standard output, too. I had the same problem just yesterday as an ftp download corrupted a bzipped archive. Fortunately I had Perl to s/\r\n/\n/g the file, and when I used exactly that on your corrupted gif, it looked pretty good. For efficiency reasons, you might prefer the following script that reads/prints the whole file as one big block:
#!/perl/bin -w open GIF, 'images/nato.gif' or die "nato.gif: $!\n"; binmode GIF; binmode STDOUT; undef $/; print "Content-type:image/gif\n\n", <GIF>; close GIF; Hope this helps. -- Marcus
s$$ab21b8d15c3d97bd6317286d$;$"=547269736;split'i',join$,,map{chr(($*+= ($">>=1)&1?-hex:hex)+0140)}/./g;$"=chr$";s;.;\u$&;for@_[0,2];print"@_,"
|