mirror of
https://github.com/lovell/sharp.git
synced 2026-02-10 00:26:15 +01:00
Add trimOffsetLeft, trimOffsetTop to trim response #914
This commit is contained in:
@@ -102,6 +102,8 @@ class PipelineWorker : public Nan::AsyncWorker {
|
||||
// Trim
|
||||
if (baton->trimThreshold > 0.0) {
|
||||
image = sharp::Trim(image, baton->trimThreshold);
|
||||
baton->trimOffsetLeft = image.xoffset();
|
||||
baton->trimOffsetTop = image.yoffset();
|
||||
}
|
||||
|
||||
// Pre extraction
|
||||
@@ -966,6 +968,12 @@ class PipelineWorker : public Nan::AsyncWorker {
|
||||
Set(info, New("cropOffsetTop").ToLocalChecked(),
|
||||
New<v8::Int32>(static_cast<int32_t>(baton->cropOffsetTop)));
|
||||
}
|
||||
if (baton->trimThreshold > 0.0) {
|
||||
Set(info, New("trimOffsetLeft").ToLocalChecked(),
|
||||
New<v8::Int32>(static_cast<int32_t>(baton->trimOffsetLeft)));
|
||||
Set(info, New("trimOffsetTop").ToLocalChecked(),
|
||||
New<v8::Int32>(static_cast<int32_t>(baton->trimOffsetTop)));
|
||||
}
|
||||
|
||||
if (baton->bufferOutLength > 0) {
|
||||
// Pass ownership of output data to Buffer instance
|
||||
|
||||
Reference in New Issue
Block a user