code: def setup_encoder(codec, cparams, image):
      
      ARGTYPES = [CODEC_TYPE,
                  ctypes.POINTER(CompressionParametersType),
                  ctypes.POINTER(ImageType)]
      OPENJP2.opj_setup_encoder.argtypes = ARGTYPES
      OPENJP2.opj_setup_encoder.restype = check_error
      OPENJP2.opj_setup_encoder(codec, ctypes.byref(cparams), image)
docs: Wraps openjp2 library function opj_setup_encoder.
  
      Setup the encoder parameters using the current image and using user
      parameters.
  
      Parameters
      ----------
      codec : CODEC_TYPE
          codec initialized by create_compress function
      cparams : CompressionParametersType
          compression parameters
      image : ImageType
          input-filled image
  
      Raises
      ------
      RuntimeError
          If the OpenJPEG library routine opj_setup_encoder fails.