Added testing if image

Therefore when going through files, this will not raise exceptions
anymore.