def _unpack_asf_image(data):
 (type, size) = struct.unpack_from('<bi', data)
 pos = 5
 mime = ''
 while (data[pos:(pos + 2)] != '\x00\x00'):
  mime += data[pos:(pos + 2)]
  pos += 2
 pos += 2
 description = ''
 while (data[pos:(pos + 2)] != '\x00\x00'):
  description += data[pos:(pos + 2)]
  pos += 2
 pos += 2
 image_data = data[pos:(pos + size)]
 return (mime.decode('utf-16-le'), image_data, type, description.decode('utf-16-le'))

def _unpack_asf_image ( data ) : ( type , size ) = struct . unpack_from ( '<bi' , data ) pos = 5 mime = '' while ( data [ pos : ( pos + 2 ) ] != '\x00\x00' ) : mime += data [ pos : ( pos + 2 ) ] pos += 2 pos += 2 description = '' while ( data [ pos : ( pos + 2 ) ] != '\x00\x00' ) : description += data [ pos : ( pos + 2 ) ] pos += 2 pos += 2 image_data = data [ pos : ( pos + size ) ] return ( mime . decode ( 'utf-16-le' ) , image_data , type , description . decode ( 'utf-16-le' ) )
unpack image data from a wm/picture tag .