A good free of charge alternative to Photoshop will involve using at least a few different programs. There is no single free of charge program that will allow you to do everything that Photoshop can do in a practical way. I use the following programs:
DCRaw for converting RAW files to the format you want. E.g. you may want to run your own demosaicing algorithms, you then need to use DCRaw to covert your RAW file to a TIFF file that contains only the raw sensor data.
ImageMagick is a useful command line for photo editing tool. If you need to work with a large number of pictures e.g. computing the average of many aligned noisy pictures, a command line tool is more useful than a GUI.
ImageJ is a low level powerful photo editing tool. It can handle all image formats from 8 bit to 32 bit images. It allows you to perform arbitrary mathematical computations involving any arbitrary set of images using the macro language that is easy to use.
Hugin is a panorama stitcher, it has executables like align_image_stack and enfuse that you can use separately as command line programs to align image stacks, to create HDR pictures or to perform focus stacking. The Hugin program is also useful to perform remappings of images, e.g. to make the horizon in an image appear straight.
GIMP is a high level photo editing tool, comparable to Photoshop, but it falls short on some points as mentioned in the other answers given here (e.g. it can only handle 8 bit images). I mostly use GIMP when I'm done with doing the more advanced photo editing stuff.
In addition to these photo editing programs, you want to have mathematical software allowing you to do computations relevant to photo editing. Mathematics is a neglected area of photo editing, you need to realize that hidden in the gray value of noisy pictures there is a lot of relevant information to be uncovered. This requires doing some math. While you can in principle do all the computations you need within ImageJ, it is often not so practical to do so. Useful programs are:
J. This is a powerful low level mathematical tool, it allows you to handle arrays and do computations involving statistics with ease.
Maxima This is high level computer algebra system. I don't use it because I have the non-free of charge Mathematica program. But this is a a useful supplement to the lower level J program.