Fix some image related problems.
Fix some image related problems.

PierreSelim/mwclient,ubibene/mwclient,mwclient/mwclient,danmichaelo/mwclient,AdamWill/mwclient,Jobava/mirror-mwclient,JeroenDeDauw/mwclient