Add tilecache before smartcrop to avoid over-computation

This commit is contained in:
Lovell Fuller
2017-11-17 19:53:50 +00:00
parent ba521fccb4
commit 1fec132dee
4 changed files with 7 additions and 22 deletions

View File

@@ -466,6 +466,9 @@ class PipelineWorker : public Nan::AsyncWorker {
image = image.extract_area(left, top, width, height);
} else {
// Attention-based or Entropy-based crop
image = image.tilecache(VImage::option()
->set("access", baton->accessMethod)
->set("threaded", TRUE));
image = image.smartcrop(baton->width, baton->height, VImage::option()
->set("interesting", baton->crop == 16 ? VIPS_INTERESTING_ENTROPY : VIPS_INTERESTING_ATTENTION));
baton->hasCropOffset = true;