lovell / lovell/sharp

extract: add option to treat width and height as "maximum" rather than absolute values

Open
#1,907 2 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

If we try to extract more pixels than has an image - we will get "extract_area: bad extract area"

Can we ignore exception and extract an actual pixels? I don't want calculate if image.width < etc.. i suppose it should be in a core. May be additional option?

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 by tracing the extract entry point to libvips's extract_area failure and checking how width and height are currently passed. Done means an explicit option treats those dimensions as maximums, returns the available pixels when they exceed the image, and avoids the bad extract area error.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
backend, computer-graphics
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 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.