A mechanism is presented to achieve adaptive scene contrast enhancement—a common problem in TV and IR imagery applications—by controlling camera gain and pedestal in an automatic fashion. The goal of adaptivity, in a precise meaning, is "content windowing" where image signals are selectively extracted and contrast enhanced, probably with respect to both dynamic-range compression and expansion. We adopt the image-analysis strategy, distinct from classical electronic methods (e.g., automatic gain control circuitry), such that the overall behavior of frame pixels (e.g., image histogram) is optimized for feedback control of camera gain and pedestal in a live video process. The video formation process is linearly modeled so that we can derive an automatic control fashion to meet the proposed image-quality criterion, which is naturally simple and flexible for practical use in a variety of applications. Experiments show that our method adapts well in dynamic environments and can be easily hardware implemented.