mirror of
https://github.com/lovell/sharp.git
synced 2025-07-09 10:30:15 +02:00
Fix y-axis calc when overlaying at fixed point #566
This commit is contained in:
parent
86039a3f2b
commit
28ce33feb3
@ -10,6 +10,10 @@ Requires libvips v8.3.3
|
||||
[#561](https://github.com/lovell/sharp/issues/561)
|
||||
[@abagshaw](https://github.com/abagshaw)
|
||||
|
||||
* Correct calculation of y-axis placement when overlaying image at a fixed point.
|
||||
[#566](https://github.com/lovell/sharp/issues/566)
|
||||
[@Nateowami](https://github.com/Nateowami)
|
||||
|
||||
#### v0.16.0 - 18<sup>th</sup> August 2016
|
||||
|
||||
* Add pre-compiled libvips for OS X, ARMv7 and ARMv8.
|
||||
|
@ -391,7 +391,7 @@ namespace sharp {
|
||||
|
||||
if(y >= 0 && y < (inHeight - outHeight)) {
|
||||
top = y;
|
||||
} else if(x >= (inHeight - outHeight)) {
|
||||
} else if(y >= (inHeight - outHeight)) {
|
||||
top = inHeight - outHeight;
|
||||
}
|
||||
|
||||
|
BIN
test/fixtures/expected/overlay-bottom-edges-meet.jpg
vendored
Normal file
BIN
test/fixtures/expected/overlay-bottom-edges-meet.jpg
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.8 KiB |
@ -437,7 +437,27 @@ describe('Overlays', function() {
|
||||
assert.strictEqual(3, info.channels);
|
||||
fixtures.assertSimilar(expected, data, done);
|
||||
});
|
||||
});
|
||||
|
||||
it('Overlay 100x100 with 50x50 so bottom edges meet', function(done) {
|
||||
sharp(fixtures.inputJpg)
|
||||
.resize(50, 50)
|
||||
.toBuffer(function(err, overlay) {
|
||||
if (err) throw err;
|
||||
sharp(fixtures.inputJpgWithLandscapeExif1)
|
||||
.resize(100, 100)
|
||||
.overlayWith(overlay, {
|
||||
top: 50,
|
||||
left: 40
|
||||
})
|
||||
.toBuffer(function(err, data, info) {
|
||||
if (err) throw err;
|
||||
assert.strictEqual('jpeg', info.format);
|
||||
assert.strictEqual(100, info.width);
|
||||
assert.strictEqual(100, info.height);
|
||||
fixtures.assertSimilar(fixtures.expected('overlay-bottom-edges-meet.jpg'), data, done);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user