lovell / lovell/sharp

withoutReduction: true - does not stop from downscaling images

Open
#3,595 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

question
Dominant language
JavaScript
Stars
32.7k
Forks
1.4k
Avg merge
1d 14h
Merged PRs (30d)
5

Description

### What are the steps to reproduce?

An image of size 500x500 will get resized to 400 despite the `withoutReduction: true` flag.

```js
sharp('large.png')
.resize(400, 400, {
withoutReduction: true
}).toFile('small.png');
```

### What is the expected behaviour?

Only smaller images should be resized (upscaled) to 400px
Trying to resize a larger image than 400x400 should due to `withoutReduction: true` should result in an image with with the dimensions of the original image, effectively not performing any resizing.

### version:

"sharp": "^0.31.3",

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the resize(400, 400, { withoutReduction: true }) example with a 500x500 image and inspect the resize implementation and existing resize tests. Done means larger images retain their original dimensions while smaller images can still be upscaled to 400px, with the relevant behavior covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
computer-vision
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.