src/managers/image-generator.js
/**
   * Composes the resuot image from the base image using the template rules.
   * @private
   * @param   {DepreciatedJimp} baseImg        the base image
   * @param   {Array}           itemConfigList the image template defined as a JSON
   * @param   {Object}          params         the parameters to be applied for the base image
   * @returns {Promise}                        nothing
   */
Composes the resuot image from the base image using the template rules.
Composes the resuot image from the base image using the template rules .
async composeImage(baseImg, itemConfigList, params) {
    for (const itemConfig of itemConfigList) {
      switch (itemConfig.type) {
        case 'image': {
          await this.processImageTemplate(itemConfig, params, baseImg);
          break;
        }
        case 'text': {
          await this.processTextTemplate(itemConfig, baseImg, params);
          break;
        }
        default:
          throw new Error(`Failed to apply a template. Unknown item type ${itemConfig.type}`);
      }
    }
  }
async composeImage ( baseImg , itemConfigList , params ) { for ( const itemConfig of itemConfigList ) { switch ( itemConfig . type ) { case 'image' : { await this . processImageTemplate ( itemConfig , params , baseImg ) ; break ; } case 'text' : { await this . processTextTemplate ( itemConfig , baseImg , params ) ; break ; } default : throw new Error ( ` ${ itemConfig . type } ` ) ; } } }
Composes the resuot image from the base image using the template rules.
Composes the resuot image from the base image using the template rules .