src/managers/image-generator.js
/**
   * Main class method. Generates image based on provided template.
   * @param   {string}                   picUrl         the URL of the picture to make image from
   * @param   {Object}                   params         the addtional parameters to consider during the procedure
   * @param   {Object}                   templateConfig the template defined as a JSON
   * @returns {Promise<DepreciatedJimp>}                          the result image
   */
Main class method. Generates image based on provided template.
@param   {string}                   picUrl         the URL of the picture to make image from
@param   {Object}                   params         the addtional parameters to consider during the procedure
@param   {Object}                   templateConfig the template defined as a JSON
@returns {Promise}                          the result image
Main class method . Generates image based on provided template . @param { string } picUrl the URL of the picture to make image from @param { Object } params the addtional parameters to consider during the procedure @param { Object } templateConfig the template defined as a JSON @returns { Promise } the result image
async generateImage(picUrl, params, templateConfig) {
    const baseImg = await Jimp.read(picUrl);
    await this.prepareBaseImage(baseImg, params, templateConfig);
    await this.addFonts(templateConfig);
    if (templateConfig.items) {
      await this.composeImage(baseImg, templateConfig.items, params);
    }
    return baseImg;
  }
async generateImage ( picUrl , params , templateConfig ) { const baseImg = await Jimp . read ( picUrl ) ; await this . prepareBaseImage ( baseImg , params , templateConfig ) ; await this . addFonts ( templateConfig ) ; if ( templateConfig . items ) { await this . composeImage ( baseImg , templateConfig . items , params ) ; } return baseImg ; }
Main class method.
Main class method .