mirror of
https://github.com/lovell/sharp.git
synced 2025-07-10 19:10:14 +02:00
Correct shrink calc, regression introduced in e398b47 #831
This commit is contained in:
parent
c879df3b31
commit
9e39a7fa95
@ -4,6 +4,12 @@
|
|||||||
|
|
||||||
Requires libvips v8.5.5.
|
Requires libvips v8.5.5.
|
||||||
|
|
||||||
|
#### v0.18.1 - TBD
|
||||||
|
|
||||||
|
* Remove regression from #781 that could cause incorrect shrink calculation.
|
||||||
|
[#831](https://github.com/lovell/sharp/issues/831)
|
||||||
|
[@suprMax](https://github.com/suprMax)
|
||||||
|
|
||||||
#### v0.18.0 - 30<sup>th</sup> May 2017
|
#### v0.18.0 - 30<sup>th</sup> May 2017
|
||||||
|
|
||||||
* Remove the previously-deprecated output format "option" functions:
|
* Remove the previously-deprecated output format "option" functions:
|
||||||
|
@ -288,7 +288,7 @@ class PipelineWorker : public Nan::AsyncWorker {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Help ensure a final kernel-based reduction to prevent shrink aliasing
|
// Help ensure a final kernel-based reduction to prevent shrink aliasing
|
||||||
if ((xshrink > 1 || yshrink > 1) && (xresidual == 1.0 || yresidual == 1.0)) {
|
if (xshrink > 1 && yshrink > 1 && (xresidual == 1.0 || yresidual == 1.0)) {
|
||||||
xshrink = xshrink / 2;
|
xshrink = xshrink / 2;
|
||||||
yshrink = yshrink / 2;
|
yshrink = yshrink / 2;
|
||||||
xresidual = xresidual / 2.0;
|
xresidual = xresidual / 2.0;
|
||||||
|
@ -412,4 +412,15 @@ describe('Resize dimensions', function () {
|
|||||||
sharp().resize(32, 24, { centreSampling: 1 });
|
sharp().resize(32, 24, { centreSampling: 1 });
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('Dimensions that result in differing shrinks on each axis', function () {
|
||||||
|
return sharp(fixtures.inputJpg)
|
||||||
|
.resize(645, 399)
|
||||||
|
.toBuffer()
|
||||||
|
.then(function (data) {
|
||||||
|
return sharp(data)
|
||||||
|
.resize(150, 100)
|
||||||
|
.toBuffer();
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user