Real-time control is the trend for photoresist processing in the advanced lithography. In this paper we develop an in-situ ellipsometer integrated with a programmable thermal heating system, which could perform real-time monitoring and control for critical dimension (CD) latent image through the entire post-exposure bake (PEB) process. The inline ellipsometry measurements are fitted into an electromagnetic wave model built on the rigorous coupled-wave analysis (RCWA) theory for CD latent image characterization. Thereafter a real-time control scheme is proposed by applying the programmable thermal bake-plate. The experimental outcome demonstrates a significant improvement on the final CD result comparing to the conventional baking method.