Improve displaying transparent images in popups (see #5684)