Better image format check