We create a model for recovering the intrinsic, absorption-corrected surface brightness distribution of a galaxy and apply the model to the M31. We construct a galactic model as a superposition of axially symmetric stellar components and a dust disc to analyse the intrinsic absorption efects. Dust column density is assumed to be proportional to the far-infrared flux of the galaxy. Along each line of sight, the observed far-infrared spectral energy distribution is approximated with modified black body functions considering dust components with different temperatures, allowing to determine the temperatures and relative column densities of the dust components. We apply the model to the nearby galaxy M31 using the Spitzer Space Telescope far-infrared observations for mapping dust distribution and temperature. A warm and a cold dust component are distinguished. The temperature of the warm dust in M31 varies between 56 and 60 K and is highest in the spiral arms; the temperature of the cold component is mostly 15-19 K and rises up to about 25 K at the centre of the galaxy. The intensity-weighted mean temperature of the dust decreases from T ~32 K at the centre to T ~20 K at R ~7 kpc and outwards. We also calculate the intrinsic UBVRIL surface brightness distributions and the spatial luminosity distribution. The intrinsic dust extinction in the V-colour rises from 0.25 mag at the centre to 0.4-0.5 mag at R = 6-13 kpc and decreases smoothly thereafter. The calculated total extinction-corrected luminosity of M31 is L_B = (3.64 pm 0.15) 10^10L_sun, corresponding to an absolute luminosity M_B = (-20.89 pm 0.04) mag. Of the total B-luminosity, 20% (0.24 mag) is obscured from us by the dust inside M31. The intrinsic shape of the bulge is slightly prolate in our best-fit model.