frames.map(async frame => { const image = new Jimp(frame.bitmap.width, frame.bitmap.height); const bImage = new BitmapImage(frame); image.bitmap = bImage.bitmap; image.resize(128, AUTO); return new GifFrame(bImage); });
async function loadImage (path) { let img = await Jimp.read(path) img.resize(400, 300) const p = [] img.scan(0, 0, img.bitmap.width, img.bitmap.height, function (x, y, idx) { p.push(this.bitmap.data[idx + 0]) p.push(this.bitmap.data[idx + 1]) p.push(this.bitmap.data[idx + 2]) }) return tf.tensor3d(p, [400, 300, 3]).reshape([1, 400, 300, 3]).sub(MEANS) }
dataURIPromises.push( jimp .read(facesDataList[i].image_url) .then((image) => // resize the image to be thumbnail size image.resize(45, 45).getBase64Async(jimp.MIME_PNG) ) // promise.all rejects if one of the promises in the array gets rejected, // without considering whether or not the other promises have resolved. // This is to make sure Promise.all continues evluating all promises inspite some rejections. .catch(() => undefined) );
return console.error(err); imgThumb.resize(globalConfig.thumbnail.height, globalConfig.thumbnail.width) .quality(globalConfig.thumbnail.quality) .write(basePath + req.file.originalname);
Jimp.read(uploadPath, function (err, imgThumb) { if (!err) { imgThumb.resize(configLogo.height, configLogo.width)
frames.map(async frame => { const image = new Jimp(frame.bitmap.width, frame.bitmap.height); const bImage = new BitmapImage(frame); image.bitmap = bImage.bitmap; image.resize(result.type === "unicode" ? 72 : 128, AUTO); return new GifFrame(bImage); });
return console.error(err); imgThumb.resize(globalConfig.thumbnail.height, globalConfig.thumbnail.width) .quality(globalConfig.thumbnail.quality) .write(basePath + req.file.originalname);