Skip to content

extend: use default value of zero for missing properties #2578

@themre

Description

@themre

Hi,
I'm trying to use extend function, but having issue with it. For a simple image I get this error:
Expected integer or object for extend but received [object Object] of type object.

I'm using latest version on Windows, node v12, npm v6.

My code is the following:

const img = await sharp(path);
    const resized = await img
      .resize(200, 200)
      .extend({
        top: 20,
        bottom: 20,
      })

Below is also a sample image. Any idea what might be wrong? Thanks!

sample

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions