Skip to content

Resizing png 16-bit colorspace stopped working after 0.29.1 update #2934

@gforge

Description

@gforge

After updating to 0.29.1 from 0.29.0 my tests start failing when parsing buffers after resize

What are the steps to reproduce?
I have a resize function that uses sharp and where the data is sent over a buffer where sharp fails to reconstruct the 16-bit data

To reproduce using sharps own unit tests:

  it("16-bit PNG after resize should retain 16-bit space", async function () {
    const img = sharp(fixtures.inputPngWithTransparency16bit);
    const orgSpace = (await img.metadata()).space;

    const space = await new Promise((resolve, reject) => {
      img
        .resize(32, 16, { fit: "contain" })
        .toBuffer(async function (err, data, info) {
          if (err) throw err;

          resolve((await sharp(data).metadata()).space);
        });
    });
    assert.equal(space, orgSpace);
  });

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions