def create_theme_images(theme, placement, hash_):
 color = random.choice(ImageColor.colormap.keys())
 image = Image.new('RGB', (3000, 200), color)
 tmp_path = os.path.join(settings.TMP_PATH, 'persona_{placement}'.format(placement=placement))
 if (not os.path.exists(tmp_path)):
  os.makedirs(tmp_path)
 tmp_loc = os.path.join(tmp_path, hash_)
 image.save(tmp_loc, 'jpeg')
 media_path = os.path.join(user_media_path('addons'), str(theme.id))
 if (not os.path.exists(media_path)):
  os.makedirs(media_path)
 media_loc = os.path.join(media_path, hash_)
 image.save(media_loc, 'jpeg')

def create_theme_images ( theme , placement , hash_ ) : color = random . choice ( ImageColor . colormap . keys ( ) ) image = Image . new ( 'RGB' , ( 3000 , 200 ) , color ) tmp_path = os . path . join ( settings . TMP_PATH , 'persona_{placement}' . format ( placement = placement ) ) if ( not os . path . exists ( tmp_path ) ) : os . makedirs ( tmp_path ) tmp_loc = os . path . join ( tmp_path , hash_ ) image . save ( tmp_loc , 'jpeg' ) media_path = os . path . join ( user_media_path ( 'addons' ) , str ( theme . id ) ) if ( not os . path . exists ( media_path ) ) : os . makedirs ( media_path ) media_loc = os . path . join ( media_path , hash_ ) image . save ( media_loc , 'jpeg' )
generates 2 images .