Ensure correct channel info for raw, greyscale output #1425

This commit is contained in:
Lovell Fuller 2018-11-19 20:00:30 +00:00
parent 1e9093d781
commit 6f9699f605
3 changed files with 5 additions and 0 deletions

View File

@ -10,6 +10,9 @@ Requires libvips v8.7.0.
[#1422](https://github.com/lovell/sharp/pull/1422)
[@SethWen](https://github.com/SethWen)
* Ensure `channel` metadata is correct for raw, greyscale output.
[#1425](https://github.com/lovell/sharp/issues/1425)
* Add support for the "mitchell" kernel for image reductions.
[#1438](https://github.com/lovell/sharp/pull/1438)
[@Daiz](https://github.com/Daiz)

View File

@ -771,6 +771,7 @@ class PipelineWorker : public Nan::AsyncWorker {
if (baton->greyscale || image.interpretation() == VIPS_INTERPRETATION_B_W) {
// Extract first band for greyscale image
image = image[0];
baton->channels = 1;
}
if (image.format() != VIPS_FORMAT_UCHAR) {
// Cast pixels to uint8 (unsigned char)

View File

@ -1388,6 +1388,7 @@ describe('Input/output', function () {
assert.strictEqual('raw', info.format);
assert.strictEqual(32, info.width);
assert.strictEqual(24, info.height);
assert.strictEqual(1, info.channels);
done();
});
});