从1个源图像创build2个不同的图像

我试图将我的照片工作stream转换为nodejs。 从Lightroom吐出的每一个jpg中,我想要做到:1)一个200×200 px缩略图,不含水印2)高度压缩的jpg,与src相同的像素大小,但是覆盖了水印

我有创build缩略图的任务:

gm(photo.photoPath) .size(function (error, size) { // I need to know the pixel size of the photo first! if (error) { console.log(error); } else { // Succesfully loaded photo.size = size; photo.orientation = size.height > size.width ? 'portrait' : 'landscape'; var cropSize = size.height < size.width ? size.height : size.width; var left = size.height > size.width ? 0 : Math.round((size.width - size.height) / 2); .crop(cropSize, cropSize, left, 0) .resize(200, 200) .unsharp(1, 1, 1.2, 0.05) .noProfile() .quality(30) .write(photo.thumbFile, function (err) { if (!err) { console.log('Thumb aangemaakt als /tn/' + photo.cryptedName); } else { console.log('Problem saving: ' + err); } }); } }); 

所以基本上这是我想要我的工作stream程:

  src file from Lightroom | | open file with GM / \ / \ Overlay watermark resize 200x200px (transparent png) | | | | sharpen lightly | | | | | | save as /lowquality/xxxx.jpg save as /thumb/xxxx.jpg 

而且我被困在了我需要创build两个单独版本的地方,在打开之后。 请帮忙!