With the development of aerospace technology, obtaining high-quality and high-precision imaging in the space environment puts forward higher requirements for the automatic exposure system of the terrain camera.The traditional automatic exposure algorithm will have obvious defects such as image quality degradation under complex lighting conditions, especially in the environment of backlight and uneven lighting distribution. Based on the automatic exposure system of FPGA, a fast automatic exposure algorithm based on variable step size is proposed.Firstly, the integration time is initially adjusted with a variable step size by using the weight mean value, and then the integration time is further adjusted with a fixed step size according to the gray histogram. The experimental results show that it can be accurately exposed under normal lighting and special lighting such as backlight, and the exposure time and image information entropy are improved compared with the traditional exposure algorithm.This method is suitable for special lighting conditions and can meet the imaging requirements of terrain cameras.