Creating and applying an artificial flat-field image.
This article assumes some basic knowledge of Photoshop GUI, tools and layer functionality.
Index:
Introduction to flats
Steps in Photoshop
1) Make a duplicate layer of the original light image
2) Apply a Median filter to this copy
3) Remove any left over nebulousity and star images from this image
4) Blur the image
5) Subtract the artificial flat field from the light
Remarks
Always process your images in uncompressed 16 BIT format, either FIT or TIFF !
Introduction to flats
A flat field image ("flat" from now on) is used to remove both vignetting (uneven illumination) and dust specks from an image.
A flat is created by taking an image of an evenly illuminated surface, the exposure length should be chosen as such that the histogram of the resulting image is approximately halfway the brightness range. This is rather easy with a DSLR set to "Aperture Priority" (A or Av) mode, and let the camera decide what the correct exposure time is.

This flat records all uneven illumination in the optical train and any possible dust specks on the image detector. This flat can be mathematically subtracted from a normal (light) image removing these undesired effects.
Should there be no possibility to acquire "real" flat images, an artificial flat can be created from the original light image as well.
This short turorial describes one (of the many) ways to create an artificial flat using Photoshop.
Steps in Photoshop
Open the image to which an artificial flat needs to be applied.
Above is a good example of an image of M78 to which no flats have been applied.
As you can see, it has loads of vignetting and could benefit from some serious processing in order to get rid of all these unwanted effects.
1) The first step is to create a duplicate layer to a new image.
In order to do this, go to the "Layer" menu and select "Duplicate Layer".
In the "Duplicate Layer" popup window, set the "Destination Document" to "New" and name it artifial flat (or any other name).
2) Apply a Median filter to this copy.
The Median filter can be applied by using the "Filter", "Noise", "Median Filter" option.
For regular (full) size DSLR TIFF images use a Median filter with a radius of about 50 pixels on this new copy.
The optimum setting may vary for your image. The goal is to remove any stars from the image and most of the nebula (the more the better). You can experiment with using a different radius as long as you manage to remove the stars and nebula (or galaxy) from the image.
This is however not always possible using only the Median filter, which takes us to step 3.
3) Remove any leftover nebula and/or stars from the image
After the filter has been applied, make sure that any left over nebulousity and/or stars are removed from this image by using either the "Clone Stamp Tool" or the "Healing Brush".
The image above is a composite of 2 images, showing just the Median filter applied at far left, and the corrected image using the clone and/or healing brush tool on the right side.
The areas marked with arrows in the far left portion of the image still show some leftover nebula in the center and some of "Barnard's Loop" at lower left. Both need to be removed from this flat otherwise this information will be subtracted too from the original light image.
4) Apply a Gaussian Blur
Go to the menu "Filter", "Blur", "Gaussian Blur" and apply a blur with a radius of about 30 pixels (could be less, try experimenting with different sizes) to blur the image.
Using a Gaussian blur radius which is too large will introduce black borders around your image so be conservative with the blur setting.
Our artificial flat is now finished and is ready to be applied to the original light image.
5) Subtract the artificial flat field from the light
Make sure you select the light image first.
Now go to the "Image" menu and select "Apply image".

Change the "Source" to "Artificial Flat.tif" (or whatever name you have given the flat)
Change the "Blending" to "Subtract".
Change the "Offset" to about 40. (experiment with this setting for best results)
Make sure however that the final image is not too dark (use the preview).
Now press OK to perform the subtraction of the flat from your light image.
You may need to reset the white balance after applying the flat by selecting "Image", "Adjustments", "Levels".
Before you do this, pick a bright star in your image and zoom in (maximum zoom level) on the star. (you can't do this once the levels window is opened).

Keep the channel on "RGB" and choose the color picker tool for the white level (shown above) and click in the center of the star to reset the white level to the new value.
Save the image with the artifical flat applied under a different name.
Compare the image at the top of this tutorial to the one below.

Remarks
Using a real flat image is of course preferred over using artificial flats as better results can be achieved with real flats. However if you do not have the possibility to make (good) flats, an artificial flat will improve vignetting in your original image as well.
Any dark spots in the light image caused by dust specks on the CCD/CMOS cannot (at least not easily) be removed by using an artificial flat.
However, an artificial flat will also remove any uneven illumination caused by local light pollution as this is also in your light image from which the artificial flat is created. Using real flats will not compensate for this kind of uneven illumination.
The results of applying artificial flats may vary depending on the object in the light image. Removing any left over nebulousity and creating a good artificial flat image can prove to be quite difficult for some objects.
