All commercially available electronic area-detector cameras and diffractometers need to be calibrated. The single most important calibration is that of the distortions in the imaging geometry of the detector. The author has written three generations of computer code to do this for a television detector, which are described here. The first has been widely released, and is used on every ENRAF-NONIUS FAST system, which is a commercially available area-sensitive X-ray diffractometer. All of them rely on the use of bivariate power-series expansions of the detectorplane positions of the diffraction-spots. They arc capable of very high accuracy of determination, and the later versions can also accommodate short-term variations caused by fluctuations in thermal or magnetic conditions, even during dynamic operation of the machine. The third version also allows interpolation between calibrations to allow the detectors to be used in non-calibrated positions, and at non-calibrated gain settings. Fitting distortions is a general problem, and some of the techniques used may be applicable to other unstable or distorting imaging systems. A reconstruction of the conjugate-gradient algorithm of least-squares optimization applicable to real-time tracking procedures is presented here. The use of an amorphous fluorescent-scatterer to illuminate the entire area of the detector relatively uniformly with intense X-rays is also described.