0
我使用Graphics Magick調整圖像大小,然後使用循環在該圖像上執行多個裁剪。第二次作物命令運行時,它失敗:Command failed: gm convert: geometry does not contain image (unable to crop image).
節點GraphicsMagick:`幾何不包含圖像(無法裁剪圖像)`
這裏是我的循環代碼:
var resizedImage = gm(pathToTemporaryImage).resize(maxSize, maxSize);
resizedImage.size(function(error, size) {
for (var x = 0; x < size.width; x += kGridSize) {
for (var y = 0; y < size.height; y += kGridSize) {
// Calculate the grid element width and height
var width = Math.min(kGridSize, size.width - x);
var height = Math.min(kGridSize, size.height - y);
resizedImage.page(0, 0, '+0+0')
.crop(width, height, x, y)
.quality(Math.min(frameTick.quality, 100))
.write(pathToImage + '-' + x + '-' + y + '.jpg', callback(x, y));
}
}
}