in reply to getc skips ahead
You should consider using Image::Size. It has lots of the rough edges knocked off by testing and use. It will keep working when you find you have some other image format to deal with.
After Compline,Zaxo