lovell / lovell/sharp

Enhancement: add support to extend feature for width and height

Open
#1,072 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Hello,

is there a way to pad an image if it's smaller than required dimensions?

For example:

| desired dimensions | actual dimensions | expected result |
|---------------------|-------------------|-----------------|
| 1000x1000 | 200x200 | 1000x1000 image with 200x200 centered inside |
| 300x300 | 350x350 | downscaled to 300x300 |

**Original**
![original](https://user-images.githubusercontent.com/174716/34170327-be70304c-e4ea-11e7-9608-b5c409755f7e.jpeg)

**Desired output**
![large](https://user-images.githubusercontent.com/174716/34170329-c4343e9c-e4ea-11e7-8c34-41513c8a3c2b.jpeg)

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

No files or tests are named in the issue. Start by locating the image resize entry point that handles requested width and height, then review how smaller and larger images are currently treated. Done means supporting padding smaller images with centered content while retaining downscaling for oversized images, with coverage for both examples.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
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.