The rate of heat conduction (or mass transfer by diffusion) from a cylindrical or a spherical particle confined between two walls is determined as a function of the position and the radius of the particle. It is shown that the appropriate Green's function can be determined using the method of images even when the resulting series is divergent with the help of Shanks transformation. Asymptotic expansions for small particle radius compared to the distance between the walls are combined with the expressions for the case in which the gap between the particle and one of the walls is small compared to the particle radius to provide formulas that are surprisingly accurate for estimating the rate of heat transfer for the entire range of parameters that include the radius and the position of the particle. Results are also presented for the thermal dipole induced by a spherical or a cylindrical particle placed between two walls with unequal temperatures and these are used to predict the effective thermal conductivity of thin composite films containing spherical or cylindrical particles.