Move out the checking of scope on an image file so that the fix also applies on Windows.