We present mid-infrared (IR) images of HD 161796 (IRAS 17436+5003), taken with the OSCIR imager on the Gemini North Telescope, that resolve for the first time the thermal emission structure of the dust shell around this post-asymptotic giant branch (AGB) star. As well as a basic axisymmetric structure, the observations show deviations from axisymmetry in the dust density and a twist in the symmetry axis. Modelling of the mid-IR images and of the spectral energy distribution from ultraviolet to submillimetre wavelengths reproduces all of the axisymmetric features with an equator-to-pole density contrast of 6: 1 and an inclination of the symmetry axis of 10° to the plane of the sky. We find that a model incorporating small (0.01μm) grains and a steep (∝a−6) power-law size distribution can successfully account for the thermal emission and for the observed degrees of near-IR polarization. Assuming a distance of 1.2 kpc to HD 161796, the stellar luminosity is 3.4 × 103 L⊙ and the mass of the shell is ∼0.7 M⊙ . This is consistent with a star of initial mass between 1 and 2 M⊙ that has undergone an intensive (2.2 × 10−4 M⊙ yr−1) phase of mass loss lasting about 3000 yr at the end of the AGB. A current stellar mass of 0.56 M⊙ , as indicated by the luminosity, suggests that HD 161796 is a few hundred years into its post-AGB evolution and will take about 5000 yr to evolve from its present temperature of 7500 K to become the central star of an extended elliptical planetary nebula.