In order to achieve visually plausible image compositing results,this paper proposed an algorithm which integrated image matting and compositing into a unified process.By considering the attributes of the new background image for compositing,the new algorithm could extract the matte with more targeted information.Experimental results and analysis show that the algorithm can effectively reduce the artifacts in the compositing result when the original image and the new background share similar colors and can also achieve good composing result when the colors of the original image and the new background are extremely different.