set background before encode