code: def _get_default_jp2_boxes(self):
          
          # Try to create a reasonable default.
          boxes = [JPEG2000SignatureBox(),
                   FileTypeBox(),
                   JP2HeaderBox(),
                   ContiguousCodestreamBox()]
          height = self.codestream.segment[1].ysiz
          width = self.codestream.segment[1].xsiz
          num_components = len(self.codestream.segment[1].xrsiz)
          if num_components < 3:
              colorspace = core.GREYSCALE
          else:
              if len(self.box) == 0:
                  # Best guess is SRGB
                  colorspace = core.SRGB
              else:
                  # Take whatever the first jp2 header / color specification
                  # says.
                  jp2hs = [box for box in self.box if box.box_id == 'jp2h']
                  colorspace = jp2hs[0].box[1].colorspace
  
          boxes[2].box = [ImageHeaderBox(height=height, width=width,
                                         num_components=num_components),
                          ColourSpecificationBox(colorspace=colorspace)]
  
          return boxes
docs: Create a default set of JP2 boxes.