#NEWLINE# def read( fp ) : #NEWLINE# #INDENT# '\n    Reads PSD file header.\n    ' #NEWLINE# logger . debug ( 'reading header..' ) #NEWLINE# signature = fp . read ( 4 ) #NEWLINE# if ( signature != b'8BPS' ) : #NEWLINE# #INDENT# raise Error ( 'This is not a PSD file' ) #NEWLINE# #UNINDENT# version = read_fmt ( 'H' , fp ) [ 0 ] #NEWLINE# if ( version != 1 ) : #NEWLINE# #INDENT# raise Error ( ( 'Unsupported PSD version (%s)' % version ) ) #NEWLINE# #UNINDENT# header = PsdHeader ( * read_fmt ( '6x HIIHH' , fp ) ) #NEWLINE# if ( not ColorMode . is_known ( header . color_mode ) ) : #NEWLINE# #INDENT# warnings . warn ( ( 'Unknown color mode: %s' % header . color_mode ) ) #NEWLINE# #UNINDENT# logger . debug ( header ) #NEWLINE# return header