Simple C++ code to retrieve image dimensions from JPEG, GIF, or PNG files