Flatten image repeatedly merges the layers down onto the background layer. This function is useful when saving to formats which don't support layers such as JPEG.