What exactly is the use of photographic films in cameras? How are the pictures generated?
A photographic film consists of a light sensitive emulsion of fine particles (grains) of silver salts in gelatine
spread on a clear celluloid strip or a glass plate. 

The grain size is very important to photographers, as this
affects the quality of the pictures produced. 

AgBr is mainly used as the light sensitive material. 

Some AgI is used in "fast" emulsions. The film is placed in a camera. When the photograph is exposed, light from the subject enters the camera
and is focussed by the lens to give a sharp image on the film.

The light starts a photochemical reaction by
exciting a halide ion, which loses an electron.

The electron moves in a conduction band to the surface of the
grain, where it reduces a $\ce{Ag+}$
ion to metallic silver. 




  $\ce{2AgBr + h\nu \rightarrow 2Ag + Br2}$


In modern photography only a short exposure of perhaps 1/100th of a second is used. 

In this short time, only a few atoms of silver (perhaps 10-50) are produced in each grain exposed to light. 

Parts of the film which
have been exposed to the bright parts of the subject contain a lot of grains with some silver.

Parts exposed to paler parts of the subject contains a few grains with some silver, whilst parts not exposed contain none. 

Thus the film contains a latent image of the subject. 

However, the number of silver atoms produced is so small that the image is not visible to the eye.

Next the film is placed a developer solution. This is a mild reducing agent, usually containing quinol.
Its purpose is to reduce more silver halide to $\ce{Ag}$ metal.$\ce{Ag}$ is deposited mainly where there are already some $\ce{Ag}$ atoms. Thus the developing process intensifies the latent image on the film so it becomes visible. The
correct conditions for processing must be used to obtain an image of the required blackness.







If the film was brought out into daylight at this stage, the unexposed parts of the emulsion would turn black
and thus destroy the picture. 

To prevent this happening any unchanged silver halides are removed by placing
the film in a fixer solution.

A solution of sodium thiosulphate is used as fixer. It forms a soluble complex with silver halides.


  $\ce{AgBr + 2Na2S2O3 \rightarrow Na3 [Ag(S2O3)2] + NaBr}$


After fixing, the film can safely be brought out into daylight. Parts blackened by silver represent the light parts of the original picture. This is therefore a negative.

To obtain an image with light and dark the right way round, a print must be made. 
Light is passed through the negative onto a piece of paper coated with $\ce{AgBr}$ emulsion. This is then developed and fixed in the same way
as before.

EDIT: Wikipedia writes:


  In black-and-white photographic film there is usually one layer of
  silver halide crystals. When the exposed silver halide grains are
  developed, the silver halide crystals are converted to metallic
  silver, which blocks light and appears as the black part of the film
  negative. Color film has at least three sensitive layers,
  incorporating different combinations of sensitizing dyes. Typically
  the blue-sensitive layer is on top, followed by a yellow filter layer
  to stop any remaining blue light from affecting the layers below. Next
  come a green-and-blue sensitive layer, and a red-and-blue sensitive
  layer, which record the green and red images respectively. During
  development, the exposed silver halide crystals are converted to
  metallic silver, just as with black-and-white film. But in a color
  film, the by-products of the development reaction simultaneously
  combine with chemicals known as color couplers that are included
  either in the film itself or in the developer solution to form colored
  dyes. Because the by-products are created in direct proportion to the
  amount of exposure and development, the dye clouds formed are also in
  proportion to the exposure and development. Following development, the
  silver is converted back to silver halide crystals in the bleach step.
  It is removed from the film during the process of fixing the image on
  the film with a solution of ammonium thiosulfate or sodium thiosulfate
  (hypo or fixer).Fixing leaves behind only the formed color dyes, which
  combine to make up the colored visible image. Later color films, like
  Kodacolor II, have as many as 12 emulsion layers,with upwards of 20
  different chemicals in each layer.