How to use the pureimage.encodeJPEGToStream function in pureimage

To help you get started, we’ve selected a few pureimage examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dtysky / paradise / createNewEffect / index.js View on Github external
const output = renderTemplate(chunk.toString());
        done(null, output);
      });
    }
  };

  try {
    await copy(templatesPath, dirPath, options)
      .on(copy.events.COPY_FILE_START, copyOperation => {
        console.log(`Generate ${copyOperation.dest}...`);
      });
  } catch (error) {
    showError(`Generate failed: ${error}\nPlease clean current directory and retry !`);
  }

  PImage.encodeJPEGToStream(
    createCover(name),
    fs.createWriteStream(path.resolve(dirPath, 'cover.jpg'))
  );
}
github triplecanopy / b-ber / packages / b-ber-tasks / src / cover / index.js View on Github external
ctx.fillText('Creator:', this.marginLeft, this.getPosY())
                ctx.fillText(this.metadata.creator, this.marginLeft, this.getPosY())
                ctx.fillText('', this.marginLeft, this.getPosY())

                ctx.fillText('Date Modified:', this.marginLeft, this.getPosY())
                ctx.fillText(this.metadata['date-modified'], this.marginLeft, this.getPosY())
                ctx.fillText('', this.marginLeft, this.getPosY())

                ctx.fillText('Identifier:', this.marginLeft, this.getPosY())
                ctx.fillText(this.metadata.identifier, this.marginLeft, this.getPosY())
                ctx.fillText('', this.marginLeft, this.getPosY())

                ctx.fillText('b-ber version', this.marginLeft, this.getPosY())
                ctx.fillText(state.version, this.marginLeft, this.getPosY())

                return PureImage.encodeJPEGToStream(img, fs.createWriteStream(this.coverImagePath))
                    .then(() => {
                        log.info('cover generated image [%s]', this.coverImagePath)
                        resolve()
                    })
                    .catch(log.error)
            })
        })

pureimage

Pure JS image drawing API based on Canvas. Export to PNG, JPG, and streams.

MIT
Latest version published 6 months ago

Package Health Score

69 / 100
Full package analysis

Similar packages