The following python code worked for me for white background. Thanks to Steven P. DEFAULT_SIZE_WHITE_CHANNEL = (640, 48