pip install -i https://pypi.anaconda.org/jjhelmus/simple imagesize
It parses image files' header and return image size.
This is a pure Python library.