Revert "Change scope of image function"

This reverts commit 9d3adbe1aff7e146dcf2ea1d16d0b82baa54f46d.
Revert "Revert "Change scope of image function""

This reverts commit 5fee1ebcd53cfb4eba4aa2283997e4a7331bad2f.