Astrophotography is a specialized type of photography for recording photos of astronomical objects, celestial events, and large areas of the night sky. The first photograph of an astronomical object (the Moon) was taken in 1840, but it was not until the late 19th century that advances in technology allowed for detailed stellar photography. Besides being able to record the details of extended objects such as the Moon, Sun, and planets, astrophotography has the ability to image objects invisible to the human eye such as dim stars, nebulae, and galaxies. This is done by long time exposure since both film and digital cameras can accumulate and sum light photons over these long periods of time.
Photography revolutionized the field of professional astronomical research, with long time exposures recording hundreds of thousands of new stars and nebulae that were invisible to the human eye, leading to specialized and ever larger optical telescopes that were essentially big cameras designed to record light using photographic plates. Astrophotography had an early role in sky surveys and star classification but over time it has given way to more sophisticated equipment and techniques designed for specific fields of scientific research, with image sensors becoming just one of many forms of sensor.
Astrophotography is a large subdiscipline in amateur astronomy usually seeking aesthetically pleasing images rather than scientific data.  Amateurs use a wide range of special equipment and techniques.
With a few exceptions, astronomical photography employs long exposures since both film and digital imaging devices can accumulate and light photons over long periods of time. The amount of light hitting the film or detector is also increased by increasing the diameter of the primary optics (the objective) being used. Urban areas produce light pollution so equipment and observatories doing astronomical imaging are often located in remote locations to allow long exposures without the film or detectors being swamped with stray light.
Since the Earth is constantly rotating, telescopes and equipment are rotated in the opposite direction to follow the apparent motion of the stars overhead (called diurnal motion). This is accomplished by using either equatorial or computer-controlled altazimuth telescope mounts to keep celestial objects centered while the earth rotates. All telescope mount systems suffer from induced tracking error due to imperfect motor drives and mechanical sag of the telescope. Tracking errors are corrected by keeping a selected aiming point, usually a bright guide star, centered during the entire exposure. Sometimes (as in the case of comets) the object to be imaged is moving, so the telescope has to be kept constantly centered on that object. This guiding is done through a second co-mounted telescope called a "guide scope" or via some type of "off-axis guider", a device with a prism or optical beam splitter that allows the observer to view the same image in the telescope that is taking the picture. Guiding was formerly done manually throughout the exposure with an observer standing at (or riding inside) the telescope making corrections to keep a cross hair on the guide star. Since the advent of computer-controlled systems this is accomplished by an automated systems in professional and even amateur equipment.
Astronomical photography is one of the earliest types of scientific photography and almost from its inception it diversified into subdisciplines that each have a specific goal including star cartography, astrometry, stellar classification, photometry, spectroscopy, polarimetry, and the discovery of astronomical objects such as asteroids, meteors, comets, variable stars, novae, and even unknown planets. These all require specialized equipment such as telescopes designed for precise imaging, for wide field of view (such as Schmidt cameras), or for work at specific wavelengths of light. Astronomical CCD cameras may use cryogenic cooling to reduce thermal noise and to allow the detector to record images in other spectra such as in infrared astronomy. Specialized filters are also used to record images in specific wavelengths.
The development of astrophotography as a scientific tool was pioneered in the mid-19th century for the most part by experimenters and amateur astronomers, or so-called "gentleman scientists" (although, as in other scientific fields, these were not always men). Because of the very long exposures needed to capture relatively faint astronomical objects, many technological problems had to be overcome. These included making telescopes rigid enough so they wouldn’t sag out of focus during the exposure, building clock drives that could rotate the telescope mount at a constant rate, and developing ways to accurately keep a telescope aimed at a fixed point over a long period of time. Early photographic processes also had limitations. The daguerreotype process was far too slow to record anything but the brightest objects, and the wet plate collodion process limited exposures to the time the plate could stay wet.
The first-known attempt at astronomical photography was by Louis Jacques Mandé Daguerre, inventor of the daguerreotype process which bears his name, who attempted in 1839 to photograph the Moon. Tracking errors in guiding the telescope during the long exposure meant the photograph came out as an indistinct fuzzy spot. John William Draper, New York University Professor of Chemistry, physician and scientific experimenter managed to make the first successful photograph of the moon a year later on March 23, 1840, taking a 20-minute-long daguerreotype image using a 5-inch (13 cm) reflecting telescope.
The Sun may have been first photographed in an 1845 daguerreotype by the French physicists Léon Foucault and Hippolyte Fizeau. A failed attempt to obtain a photograph of a Total Eclipse of the Sun was made by the Italian physicist, Gian Alessandro Majocchi during an eclipse of the Sun that took place in his home city of Milan, on July 8, 1842. He later gave an account of his attempt and the Daguerreotype photographs he obtained, in which he wrote
The Sun's solar corona was first successfully imaged during the Solar eclipse of July 28, 1851. Dr. August Ludwig Busch, the Director of the Königsberg Observatory gave instructions for a local daguerreotypist named Johann Julius Friedrich Berkowski to image the eclipse. Busch himself was not present at Königsberg (now Kaliningrad, Russia), but preferred to observe the eclipse from nearby Rixhoft. The telescope used by Berkowski was attached to 6 1⁄2-inch (17 cm) Königsberg heliometer and had an aperture of only 2.4 in (6.1 cm), and a focal length of 32 in (81 cm). Commencing immediately after the beginning of totality, Berkowski exposed a daguerreotype plate for 84 seconds in the focus of the telescope, and on development an image of the corona was obtained. He also exposed a second plate for about 40 to 45 seconds but was spoiled when the sun broke out from behind the moon. More detailed photographic studies of the Sun were made by the British astronomer Warren De la Rue starting in 1861.
The first photograph of a star was a daguerreotype of the star Vega by astronomer William Cranch Bond and daguerreotype photographer and experimenter John Adams Whipple, on July 16 and 17, 1850 with Harvard College Observatory's 15 inch Great refractor. In 1863 the English chemist William Allen Miller and English amateur astronomer Sir William Huggins used the wet collodion plate process to obtain the first ever photographic spectrogram of a star, Sirius and Capella. In 1872 American physician Henry Draper, the son of John William Draper, recorded the first spectrogram of a star (Vega) to show absorption lines.
Astronomical photography did not become a serious research tool until the late 19th century, with the introduction of dry plate photography. It was first used by Sir William Huggins and his wife Margaret Lindsay Huggins, in 1876, in their work to record the spectra of astronomical objects. In 1880 Henry Draper used the new dry plate process with photographically corrected 11 in (28 cm) refracting telescope made by Alvan Clark to make a 51-minute exposure of the Orion Nebula, the first photograph of a nebula ever made. A breakthrough in astronomical photography came in 1883, when amateur astronomer Andrew Ainslie Common used the dry plate process to record several images of the same nebula in exposures up to 60 minutes with a 36 in (91 cm) reflecting telescope that he constructed in the backyard of his home in Ealing, outside London. These images for the first time showed stars too faint to be seen by the human eye. 
The first all-sky photographic astrometry project, Astrographic Catalogue and Carte du Ciel, was started in 1887. It was conducted by 20 observatories all using special photographic telescopes with a uniform design called normal astrographs, all with an aperture of around 13 in (330 mm) and a focal length of 11 ft (3.4 m), designed to create images with a uniform scale on the photographic plate of approximately 60 arcsecs/mm while covering a 2° × 2° field of view. The attempt was to accurately map the sky down to the 14th magnitude but it was never completed.
The beginning of the 20th century saw the worldwide construction of refracting telescopes and sophisticated large reflecting telescopes specifically designed for photographic imaging. Towards the middle of the century, giant telescopes such as the 200 in (5.1 m) Hale Telescope and the 48 in (120 cm) Samuel Oschin telescope at Palomar Observatory were pushing the limits of film photography.
Some progress was made in the field of photographic emulsions and in the techniques of forming gas hypersensitization, cryogenic cooling, and light amplification, but starting in the 1970s after the invention of the CCD, photographic plates have given way to electronic imaging in professional observatories. CCD's are far more light sensitive, do not drop off in sensitivity to light over long exposures the way film does ("reciprocity failure"), have the ability to record in a much wider spectral range, and simplify storage of information. Telescopes now use many configurations of CCD sensors including linear arrays and large mosaics of CCD elements equivalent to 100 million pixels, designed to cover the focal plane of telescopes that formerly used 10–14-inch (25–36 cm) photographic plates.
The late 20th century saw advances in astronomical imaging take place in the form of new hardware, with the construction of giant multi-mirror and segmented mirror telescopes. It would also see the introduction of space based telescopes, such as the Hubble Space Telescope. Operating outside the atmosphere’s turbulence, scattered ambient light and the vagaries of weather allows the Hubble Space Telescope, with a mirror diameter of 2.4 metres (94 in), to record stars down to the 30th magnitude, some 100 times dimmer than what the 5-meter Mount Palomar Hale telescope could record in 1949.
Astrophotography is a popular hobby among photographers and amateur astronomers. Images of the night sky can be obtained with the most basic film and digital cameras. For simple star trails, no equipment may be necessary other than common tripods. There is a wide range of commercial equipment geared toward basic and advanced astrophotography. Amateur astronomers and amateur telescope makers also use homemade equipment and modified devices.
Images are recorded on many types of media and imaging devices including single-lens reflex cameras, 35 mm film, digital single-lens reflex cameras, simple amateur-level and professional-level commercially manufactured astronomical CCD cameras, video cameras, and even off-the-shelf webcams adapted for long-exposure imaging.
Conventional over-the-counter film has long been used for astrophotography. Film exposures range from 10 minutes to over an hour. Commercially available color film stock is subject to reciprocal failure over long exposures, in which sensitivity to light of different wavelengths appears to drop off as the exposure time increases, leading to color shift in the image. This is compensated for by using the same technique used in professional astronomy of taking photographs at different wavelengths that are then combined to create a correct color image. Since film is much slower than digital sensors, tiny errors in tracking can be corrected without much noticeable effect on the final image. Film astrophotography is becoming less popular due to the low cost of digital photography.
Since the late 1990s amateurs have been following the professional observatories in the switch from film to digital CCDs for astronomical imaging. CCDs are more sensitive than film, allowing much shorter exposure times, and have a linear response to light. Images can be captured in many short exposures to create a synthetic long exposure. Digital cameras also have minimal or no moving parts and the ability to be operated remotely via an infrared remote or computer tethering, limiting vibration. Simple digital devices such as webcams can be modified to allow access to the focal plane and even (after the cutting of a few wires), for long exposure photography. Digital video cameras are also used. There are many techniques and pieces of commercially manufactured equipment for attaching digital single lens reflex(DSLR) cameras and even basic point and shoot cameras to telescopes. Consumer level digital cameras suffer from image noise over long exposures, so there are many techniques for cooling the camera, including cryogenic cooling. Astronomical equipment companies also now offer a wide range of purpose-built astronomical CCD cameras complete with hardware and processing software. Many commercially available DSLR cameras have the ability to take long time exposures combined with sequential (time-lapse) images allowing the photographer to create a motion picture of the night sky.
Both digital camera images and scanned film images are usually adjusted in image processing software to improve the image in some way. Images can be brightened and manipulated in a computer to adjust color and increase the contrast. More sophisticated techniques involve capturing multiple images (sometimes thousands) to composit together in an additive process to sharpen images to overcome poor atmospheric seeing, negating tracking issues, bringing out faint objects with a poor signal-to-noise ratio, and filtering out light pollution. Digital camera images may also need further processing to reduce the image noise from long exposures, including subtracting a “dark frame” and a processing called image stacking or "Shift-and-add". There are several commercial, freeware and free software packages available specifically for astronomical photographic image manipulation.
Astrophotographic hardware among non-professional astronomers varies widely, since the photographers themselves range from general photographers shooting some form of aesthetically pleasing images to very serious amateur astronomers collecting data for scientific research. As a hobby, astrophotography has many challenges that have to be overcome that differ from conventional photography and from what is normally encountered in professional astronomy.
Since most people live in urban areas, equipment needs to be portable so that it can be taken far away from the lights of major cities or towns to avoid urban light pollution. Urban astrophotographers use special light-pollution or narrow-band filters and advanced computer processing techniques to remove ambient urban light from the background of their images. They may also stick to imaging bright targets like the moon and planets. Another method used by amateurs to avoid light pollution is to set up, or rent time, on a remotely operated telescope at a dark sky location. Other challenges include setup and alignment of portable telescopes for accurate tracking, working within the limitations in “off the shelf” equipment, the endurance of monitoring equipment, and sometimes manually tracking astronomical objects over long exposures in a wide range of weather conditions.
Some camera manufacturers modify their products to be used as astrophotography cameras, such as Canon's EOS 60Da, based on the EOS 60D but with a modified infrared filter and a low-noise sensor with heightened hydrogen-alpha sensitivity for improved capture of red hydrogen emission nebulae.
There are also some cameras specifically designed for amateur astrophotography, such as the Tiny1 of the Singapore-based startup TinyMOS.
With very low light capability, a few specific models of webcams are very popular to shoot the night sky for astronomers and astrophotographers. Mostly, these are manual focus cameras and containing old CCD panels instead of comparatively newer CMOS panels. The lenses of the cameras are removed and then these are attached to telescopes to record images, video or both. In newer techniques, videos of very faint objects are taken for a couple of seconds and then all the frames of the video are 'stacked' together to obtain a still image of respectable contrast. The Philips PCVC 740K and SPC 900 are among the few webcams liked by astrophotographers.
The most basic types of astronomical photographs are made with standard cameras and photographic lenses mounted in a fixed position or on a tripod. Foreground objects or landscapes are sometimes composed in the shot. Objects imaged are constellations, interesting planetary configurations, meteors, and bright comets. Exposure times must be short (under a minute) to avoid having the stars point image become an elongated line due to the Earth's rotation. Camera lens focal lengths are usually short, as longer lenses will show image trailing in a matter of seconds. Allowing the stars to intentionally become elongated lines in exposures lasting several minutes or even hours, called “Star trails”, is an artistic technique sometimes used.
To achieve longer exposures without objects being blurred, some form of tracking mount is usually employed to compensate for the Earth's rotation, including commercial equatorial mounts and homemade equatorial devices such as barn door trackers and equatorial platforms.
Piggyback astronomical photography is a method where a camera/lens is mounted on an equatorially mounted astronomical telescope. The telescope is used as a guide scope to keep the field of view centered during the exposure. This allows the camera to use a longer exposure and/or a longer focal length lens or even be attached to some form of photographic telescope co-axial with the main telescope.
In this type of photography the telescope itself is used as the "lens" collecting light for the film or CCD of the camera. Although this allows for the magnification and light gathering power of the telescope to be used, it is one of the most difficult astrophotography methods. This is because of the difficulties in centering and focusing sometimes very dim objects in the narrow field of view, contending with magnified vibration and tracking errors, and the added expense of equipment (such as sufficiently sturdy telescope mounts, camera mounts, camera couplers, off axis guiders, guide scopes, illuminated cross-hairs, or auto-guiders mounted on primary telescope or the guide-scope.) There are several different ways cameras (with removable lenses) are attached to amateur astronomical telescopes including:
When the camera lens is not removed (or cannot be removed) a common method used is afocal photography, also called afocal projection. In this method both the camera lens and the telescope eyepiece are attached. When both are focused at infinity the light path between them is parallel (afocal), allowing the camera to basically photograph anything the observer can see. This method works well for capturing images of the moon and brighter planets, as well as narrow field images of stars and nebulae. Afocal photography was common with early 20th century consumer level cameras, since many models had non-removable lenses. It has grown in popularity with the introduction of point and shoot digital cameras since most models also have non-removable lenses.
With the development of fast Internet in the last part of the 20th century along with advances in computer-controlled telescope mounts and CCD cameras 'Remote Telescope' astronomy is now a viable means for amateur astronomers not aligned with major telescope facilities to partake in research and deep sky imaging. This enables the imager to control a telescope a large distance away in a dark location. The observers can image through the telescopes using CCD cameras. Imaging can be done regardless of the location of the user or the telescopes they wish to use. The digital data collected by the telescope is then transmitted and displayed to the user by means of the Internet. An example of a digital remote telescope operation for public use via the Internet is The Bareket Observatory.