Will be useful for simplifying the code paths involved with showing new images in the image viewer UI. (cherry picked from commit 28f63cee)