Refactor save obstruct image code.