if all you will ever want is the image size for the two leading web graphics formats (jpeg and gif), then implement the code yourself to get this info from the image file header. here's a reference page for graphic file formats.
the hardest line to type correctly is: stty erase ^H