in reply to crc-16
To you, the contents of a .gif file may look like garbage. But that is just because it was not intented to be read by a person (its in binary). Don't let the fact that you can't understand it (it looks like garbage to you) lead you believe that it isn't good, usable data.
BTW, if you're processing a binary file on Windows, be sure to binmode it.