P-N junction diodes with excellent rectifying characteristics were prepared by segregating the Ge nanocrystals of Si1−xGex thin films deposited by co-sputtering. The current-voltage characteristics in darkness and under illumination were studied. The correlation between the p-n junction performance and the microstructure of the films is discussed, and the rectifying property became stronger as the fraction of Ge in the Si1−xGex films increased. The optical bandgap can be tuned by controlling the grain size in Ge and SiGe nanocrystals. The graded structure of the Si1−xGex photodiode is proposed to widen the light absorption region. The concept can be used to design high-efficiency photodiodes.