def frombuffer(mode, size, data, decoder_name='raw', *args):
 _check_size(size)
 if ((len(args) == 1) and isinstance(args[0], tuple)):
  args = args[0]
 if (decoder_name == 'raw'):
  if (args == ()):
   warnings.warn("the frombuffer defaults may change in a future release; for portability, change the call to read:\n  frombuffer(mode, size, data, 'raw', mode, 0, 1)", RuntimeWarning, stacklevel=2)
   args = (mode, 0, (-1))
  if (args[0] in _MAPMODES):
   im = new(mode, (1, 1))
   im = im._new(core.map_buffer(data, size, decoder_name, None, 0, args))
   im.readonly = 1
   return im
 return frombytes(mode, size, data, decoder_name, args)

def frombuffer ( mode , size , data , decoder_name = 'raw' , * args ) : _check_size ( size ) if ( ( len ( args ) == 1 ) and isinstance ( args [ 0 ] , tuple ) ) : args = args [ 0 ] if ( decoder_name == 'raw' ) : if ( args == ( ) ) : warnings . warn ( "the frombuffer defaults may change in a future release; for portability, change the call to read:\n  frombuffer(mode, size, data, 'raw', mode, 0, 1)" , RuntimeWarning , stacklevel = 2 ) args = ( mode , 0 , ( - 1 ) ) if ( args [ 0 ] in _MAPMODES ) : im = new ( mode , ( 1 , 1 ) ) im = im . _new ( core . map_buffer ( data , size , decoder_name , None , 0 , args ) ) im . readonly = 1 return im return frombytes ( mode , size , data , decoder_name , args )
creates an image memory referencing pixel data in a byte buffer .