Sharp: TypeError: image.resize(...).crop and withoutEnlargement() fails

Created on 2 Jul 2019  路  2Comments  路  Source: lovell/sharp

What is the output of running npx envinfo --binaries --languages --system --utilities?

System:
    OS: Linux 4.4 Ubuntu 16.04.6 LTS (Xenial Xerus)
    CPU: (2) x64 Intel(R) Xeon(R) CPU E5-2630L v2 @ 2.40GHz
    Memory: 2.31 GB / 3.86 GB
    Container: Yes
    Shell: 4.3.48 - /bin/bash
  Binaries:
    Node: 12.4.0 - ~/.nvm/versions/node/v12.4.0/bin/node
    npm: 6.9.0 - ~/.nvm/versions/node/v12.4.0/bin/npm
  Utilities:
    Make: 4.1 - /usr/bin/make
    GCC: 5.4.0 - /usr/bin/gcc
    Git: 2.7.4 - /usr/bin/git
  Languages:
    Bash: 4.3.48 - /bin/bash
    Perl: 5.22.1 - /usr/bin/perl
    PHP: 7.0.33 - /usr/bin/php
    Python: 2.7.12 - /usr/bin/python

What are the steps to reproduce?

sharp(path).resize(size).crop(sharp.gravity.centre).toFile(toFile, function(err, info) {
            // doesn't reach here
        })

sharp(path).resize(4000, 3000).withoutEnlargement().toFile(toFile, function(err, info) {
            // doesn't reach here
        })

What is the expected behaviour?
To work, as it previous did, but I now get

TypeError: image.resize(...).crop is not a function
TypeError: image.resize(...).withoutEnlargement is not a function

respectively, any ideas what changed in the latest version?

question

Most helpful comment

v0.22.0 - 18th March 2019 Remove functions previously deprecated in v0.21.0: background, crop, embed, ignoreAspectRatio, max, min and withoutEnlargement.

https://sharp.pixelplumbing.com/en/stable/changelog/

All 2 comments

v0.22.0 - 18th March 2019 Remove functions previously deprecated in v0.21.0: background, crop, embed, ignoreAspectRatio, max, min and withoutEnlargement.

https://sharp.pixelplumbing.com/en/stable/changelog/

Thank you for the fast reply, I will have to look over it again, cheers

Was this page helpful?
0 / 5 - 0 ratings

Related issues

AVVS picture AVVS  路  3Comments

OleVik picture OleVik  路  3Comments

Andresmag picture Andresmag  路  3Comments

iq-dot picture iq-dot  路  3Comments

zilions picture zilions  路  3Comments