@@ -38,7 +38,7 @@ class Signature(IntEnum):
3838
3939@dataclass (slots = True )
4040class BitmapFileHeader :
41- """Implements the struct for the """
41+ """Implements the struct for the Bitmap file header """
4242
4343 HEADER_LENGTH : ClassVar [int ] = 14
4444
@@ -53,7 +53,7 @@ def from_bytes(cls, data: bytes) -> 'BitmapFileHeader':
5353 if len (data ) < cls .HEADER_LENGTH :
5454 raise InvalidFormatException (f"Header too short, received: { len (data )} instead of { cls .HEADER_LENGTH } " )
5555
56- return cls (* struct .unpack ('HIHHI' , data ))
56+ return cls (* struct .unpack ('> HIHHI' , data ))
5757
5858 def __post_init__ (self ) -> None :
5959 if self .signature not in set (e .value for e in Signature ):
@@ -68,11 +68,11 @@ def __post_init__(self) -> None:
6868
6969@dataclass (slots = True )
7070class BMP :
71- pass
71+ header : BitmapFileHeader
7272
7373
7474@final
75- class BMPReader (IFormatReader ): # pylint: disable=too-few-public-methods
75+ class BMPReader (IFormatReader ):
7676 """Class that deserializes BMP format to Image"""
7777
7878 @override
@@ -108,12 +108,12 @@ def read_format(self, file: BinaryIO) -> Image:
108108
109109
110110@final
111- class BMPWriter (IFormatWriter ): # pylint: disable=too-few-public-methods
111+ class BMPWriter (IFormatWriter ):
112112 """Class that serializes Image to BMP format"""
113113
114+ @override
114115 def write_format (self , file : BinaryIO , input_image : Image ) -> None :
115116 input_arr = input_image .data
116- input_arr = np .flip (np .flip (input_arr [:, :, ::- 1 ], axis = 1 ), axis = 0 )
117117
118118 image_height , image_width , num_colors = input_arr .shape
119119 bits_per_pixel = num_colors * 8
0 commit comments