To improve the overall performance of image fusion, this paper proposes a Bacterial Foraging Algorithm (BFA) based method. First, this method selects several objective standards to construct an index representing the overall performance of fused images. Second, after the source images were decomposed by Contourlet transform, we obtain the coefficients of low-frequency and high-frequency in Contourlet domain. Then, the swarm intelligence of BFA is introduced to determine the proportions of high-frequency coefficients, i.e. the optimal weights. Finally, we use the high-frequency coefficients fused by the optimal weights and the average of low-frequency coefficients to reconstruct the optimal fused image. Experimental results show that the method not only can provide with good visual effects, but also is superior to eight widely-used methods.