def write(self, image, options, thumbnail):
if options['<STR_LIT>'] == '<STR_LIT>' and options.get(<EOL>'<STR_LIT>', settings.THUMBNAIL_PROGRESSIVE):<EOL><INDENT>image['<STR_LIT>']['<STR_LIT>'] = '<STR_LIT>'<EOL><DEDENT>image['<STR_LIT>']['<STR_LIT>'] = options['<STR_LIT>']<EOL>args = settings.THUMBNAIL_CONVERT.split('<STR_LIT:U+0020>')<EOL>args.append(image['<STR_LIT:source>'] + '<STR_LIT>')<EOL>for k in image['<STR_LIT>']:<EOL><INDENT>v = image['<STR_LIT>'][k]<EOL>args.append('<STR_LIT>' % k)<EOL>if v is not None:<EOL><INDENT>args.append('<STR_LIT:%s>' % v)<EOL><DEDENT><DEDENT>flatten = "<STR_LIT>"<EOL>if '<STR_LIT>' in options:<EOL><INDENT>flatten = options['<STR_LIT>']<EOL><DEDENT>if settings.THUMBNAIL_FLATTEN and not flatten == "<STR_LIT>":<EOL><INDENT>args.append('<STR_LIT>')<EOL><DEDENT>suffix = '<STR_LIT>' % EXTENSIONS[options['<STR_LIT>']]<EOL>with NamedTemporaryFile(suffix=suffix, mode='<STR_LIT:rb>') as fp:<EOL><INDENT>args.append(fp.name)<EOL>args = map(smart_str, args)<EOL>p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)<EOL>returncode = p.wait()<EOL>out, err = p.communicate()<EOL>if returncode:<EOL><INDENT>raise EngineError(<EOL>"<STR_LIT>"<EOL>% (args, err)<EOL>)<EOL><DEDENT>elif err:<EOL><INDENT>logger.error("<STR_LIT>", err)<EOL><DEDENT>thumbnail.write(fp.read())<EOL><DEDENT>
Writes the thumbnail image