code: def write(self, fptr):
          
          fptr.write(struct.pack('>I4s', 22, b'ihdr'))
  
          # signedness and bps are stored together in a single byte
          bit_depth_signedness = 0x80 if self.signed else 0x00
          bit_depth_signedness |= self.bits_per_component - 1
          read_buffer = struct.pack('>IIHBBBB',
                                    self.height,
                                    self.width,
                                    self.num_components,
                                    bit_depth_signedness,
                                    self.compression,
                                    1 if self.colorspace_unknown else 0,
                                    1 if self.ip_provided else 0)
          fptr.write(read_buffer)
docs: Write an Image Header box to file.