lovell / lovell/sharp

Extend the 10,000-pixel limit for extend() to standard dimension limit

Open
#4,605 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug ready-to-ship
Dominant language
JavaScript
Stars
32.7k
Forks
1.4k
Avg merge
1d 14h
Merged PRs (30d)
5

Description

The 10,000-pixel limit added to `extend()` in Sharp 0.35.3 is blocking us from upgrading. Our workflow needs larger padding values, and these have worked fine in previous versions.

Here’s a simple example:

```js
await sharp({
create: {
width: 1,
height: 1,
channels: 3,
background: 'white'
}
})
.extend({ left: 20000, background: 'black' })
.png()
.toBuffer();
```

This only produces a narrow, 20,001-pixel image, but the new validation rejects it.

I found the [commit that introduced this](https://github.com/lovell/sharp/blob/2bc2f3270ece597ae2fc5a2bc26b0af23f50d865/lib/resize.mjs#L424), but couldn’t find any discussion about why 10,000 was chosen. Is there a technical reason for that number?

Protective defaults make sense, but this feels like an arbitrary cutoff without a way around it. Neither `limitInputPixels: false` nor `unlimited: true` bypasses it.

Could we have a way to raise or disable this limit, similar to `limitInputPixels`?

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

Start in lib/resize.mjs around line 424, where the 10,000-pixel validation for extend() was introduced. Compare that validation with the existing limitInputPixels and unlimited options mentioned in the issue. Done means larger padding, such as left: 20000, works while a suitable configurable or disabled protective limit remains available.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
api, computer-graphics
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.