Messy work in progress for saving profiles from images