Here's the original image:
To apply wavelets to estimate the gradients first remove the nebulosity that we want to keep and fill it in with black:
Decompose this image using wavelets (Filters->Enhance->Wavellet-decompose...) and select scale 7. Deselecting everything except the error we get:
This is already a pretty good gradient but the edge is a bit sharp. Apply a Gaussian blur of 100 pixels:
Now subtract it from the original (and save it as a "new layer from visible"):
That was pretty easye with a good result! Next, to reduce the stars, we decompose this image with wavelets. This time we select the error and scales 6 and 7:
Subtract this from the layer that we created them from (the gradient free M31) and save this as a "new layer from visible":
This will be the basis for our star mask that we create using Colors->Threshold. Adjust the slider enough to exclude speckles at the center:
Using Select->Grow grow it by 2 pixels. Deselect the mask and select the gradient-free M31 zoom in to see the selection:
Reduce the stars by Filters->Distorts->Value propagate... and select the option to make it darker:
Let's shrink the selection by Select->Shrink... by 2 pixels and do the Value propagate again. Zooming out the result is:
There is some speckling in the lower right that we must despeckle. Since despeckling has side effects on the nebulosity we deselect this first; free-select around the nebulosity select its complement then apply Filters->Ennhance->Despeckle... with the sliders set appropriately by looking at the results in the preview window:
This is quite a difference from the original. When zooming in you can see some minor artifacts but over all it's not too bad. I'm sure there are ways to tweak this but I find it pretty interesting for a first wavelet experience.