Photometric observations of planetary transits may show localized bumps, called transit anomalies, due to the possible crossing of photospheric starspots. The aim of this work is to analyze the transit anomalies and derive the temperature profile inside the transit belt along the transit direction. We develop the algorithm TOSC, a tomographic inverse-approach tool which, by means of simple algebra, reconstructs the flux distribution along the transit belt. We test TOSC against some simulated scenarios. We find that TOSC provides robust results for light curves with photometric accuracies better than 1~mmag, returning the spot-photosphere temperature contrast with an accuracy better than 100~K. TOSC is also robust against the presence of unocculted spots, provided that the apparent planetary radius given by the fit of the transit light curve is used in place of the true radius. The analysis of real data with TOSC returns results consistent with previous studies.