A suitable image is obtained of a subject in which the difference in luminance between a bright area and a dark area is very large. The dark area is properly exposed and first image data is obtained. The bright area is properly exposed, and second image data is obtained. The first image data pertaining to the bright area is replaced with the second image data, thereby obtaining composite image data. This is accomplished using an array of photodiodes comprising two sets of photodiodes, one set of the photodiodes comprising filters, and the respective sets of photodiodes output signals to respectively different transfer paths for signal processing.