def generate_addon_preview(addon):
 color = random.choice(ImageColor.colormap.keys())
 im = Image.new('RGB', (320, 480), color)
 p = Preview.objects.create(addon=addon, caption='Screenshot 1', position=1)
 f = tempfile.NamedTemporaryFile()
 im.save(f, 'png')
 resize_preview(f.name, p)

def generate_addon_preview ( addon ) : color = random . choice ( ImageColor . colormap . keys ( ) ) im = Image . new ( 'RGB' , ( 320 , 480 ) , color ) p = Preview . objects . create ( addon = addon , caption = 'Screenshot 1' , position = 1 ) f = tempfile . NamedTemporaryFile ( ) im . save ( f , 'png' ) resize_preview ( f . name , p )
generate a screenshot for the given addon .