Use HEAD request and check content-length rather than checking image at all.