-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Description
Hi!
There is a strange behavior when resizing JPEG to PNG in embed mode.
sharp('input.jpg')
.resize(2000, 1000)
.background({ r: 0, g: 0, b: 0, a: 0 })
.embed()
.toFormat(sharp.format.png)
.toFile('output1.png', function (err, info) {
console.log(err || info);
});I am expecting to have the input image resized to maximum width or height, keeping aspect ratio, and above a transparent background.
But I am getting a full transparent image!
The same does not happens when input image is a PNG, with the same code:
sharp('input.png')
.resize(2000, 1000)
.background({ r: 0, g: 0, b: 0, a: 0 })
.embed()
.toFormat(sharp.format.png)
.toFile('output2.png', function (err, info) {
console.log(err || info);
});This is really strange to me, am I making a mistake?
A add a git repo to test it:
https://github.com/diegocsandrim/sharp-test
Reactions are currently unavailable



