Update JPG dimension checking for Python3.