khalyomede / khalyomede/gulp-sharp-responsive

withoutEnlargement

Open
#4 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
18
Forks
6
PR merge metrics
No merged PRs in 30d

Description

Hi! Could you please help me to add this sharp option (https://sharp.pixelplumbing.com/api-resize#parameters):
_options.withoutEnlargement Boolean do not enlarge if the width or height are already less than the specified dimensions, equivalent to GraphicsMagick's > geometry option. (optional, default false)_

Is it possible?
I have tried different variants that are not working:
```
.pipe(sharpResponsive({
includeOriginalFile: true,
withoutEnlargement: true,
formats: [
{ width: 768, sharp: { withoutEnlargement: true }, withoutEnlargement: true, quality: 100, rename: { suffix: "_mq2" } },
]
}))
```
The original image (3kb) is enlarged to 1202kb

Contributor guide

Open the contributing guide

Research direction

Start at the sharpResponsive option handling and trace how resize options are passed to Sharp. Compare the requested withoutEnlargement behavior with Sharp's resize parameters, then verify using the supplied 3kb image and 768px width that the output is not enlarged.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Feature
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.