NASA, ESA, J.-Y. Li (PSI), C.M. Lisse (JHU/APL), and the Hubble Heritage Team (STScI/AURA)
Hubble images of Comet Siding Spring and Mars are combined to show their close encounter on Oct. 19, 2014. At their closest, the distance between the comet and Mars was about a third of the distance between the Moon and Earth, or about 87,000 miles. Although the passage was a "near miss" in solar system terms, one can see from this image that the size of the comet's cloudy coma was not big enough to have a strong effect on the Red Planet.
Astronomers made a composite image, using separate Hubble observations of the comet and of Mars, for two main reasons. First, it is a challenge to image bright and faint objects at the same time. Mars is about 10,000 times brighter than Comet Siding Spring. To get a clear image of both Mars and the comet, a separate image must be taken of each object.
Second, the comet and Mars are moving across the sky in different directions. Astronomers can only program Hubble to follow one object's motion at a time, and other objects with different motions will be blurred. By using a composite image, Hubble can illustrate the encounter and show each object clearly.