save image data on z-index change