Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: lovell/sharp
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.30.1
Choose a base ref
...
head repository: lovell/sharp
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v0.30.2
Choose a head ref
  • 12 commits
  • 22 files changed
  • 2 contributors

Commits on Feb 15, 2022

  1. Copy the full SHA
    dc5f4dc View commit details
  2. Copy the full SHA
    7f83ecd View commit details

Commits on Feb 16, 2022

  1. Copy the full SHA
    c620025 View commit details
  2. Bump deps

    lovell committed Feb 16, 2022
    Copy the full SHA
    55efe56 View commit details

Commits on Feb 26, 2022

  1. Windows: ensure C++ runtime is linked statically (#3110)

    And remove the empty invalid parameter handler, which should
    be present in the C layer instead.
    
    This partially reverts commit
    659cdab,
    the added test case in that commit is still preserved.
    kleisauke authored Feb 26, 2022
    Copy the full SHA
    c2ecde6 View commit details
  2. Bump devDeps

    lovell committed Feb 26, 2022
    Copy the full SHA
    801b6fe View commit details
  3. Docs: changelog entry for #3110

    lovell committed Feb 26, 2022
    Copy the full SHA
    808133e View commit details

Commits on Feb 27, 2022

  1. Copy the full SHA
    fc3b4a6 View commit details

Commits on Feb 28, 2022

  1. Copy the full SHA
    21a9607 View commit details

Commits on Mar 2, 2022

  1. Copy the full SHA
    af80d7e View commit details
  2. Copy the full SHA
    003279a View commit details
  3. Release v0.30.2

    lovell committed Mar 2, 2022
    Copy the full SHA
    80d169b View commit details
22 changes: 17 additions & 5 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -5,12 +5,24 @@ labels: enhancement

---

What are you trying to achieve?
## Feature request

Have you searched for similar feature requests?
### What are you trying to achieve?

What would you expect the API to look like?
<!-- Please provide context here. -->

What alternatives have you considered?
### When you searched for similar feature requests, what did you find that might be related?

Is there a sample image that helps explain?
<!-- Please demonstrate your research here. -->

### What would you expect the API to look like?

<!-- Please provide your suggestions here. -->

### What alternatives have you considered?

<!-- Please provide your ideas here. -->

### Please provide sample image(s) that help explain this feature

<!-- Please provide links to one or more images here. -->
31 changes: 26 additions & 5 deletions .github/ISSUE_TEMPLATE/installation.md
Original file line number Diff line number Diff line change
@@ -7,18 +7,39 @@ labels: installation

<!-- Please try to answer as many of these questions as possible. -->

Did you see the [documentation relating to installation](https://sharp.pixelplumbing.com/install)?
## Possible install-time or require-time problem

Have you ensured the architecture and platform of Node.js used for `npm install` is the same as the architecture and platform of Node.js used at runtime?
<!-- Please place an [x] in the box to confirm. -->

Are you using the latest version? Is the version currently in use as reported by `npm ls sharp` the same as the latest version as reported by `npm view sharp dist-tags.latest`?
- [ ] I have read the [documentation relating to installation](https://sharp.pixelplumbing.com/install).
- [ ] I have ensured that the architecture and platform of Node.js used for `npm install` is the same as the architecture and platform of Node.js used at runtime.

### Are you using the latest version of sharp?

<!-- Please place an [x] in the box to confirm. -->

- [ ] I am using the latest version of `sharp` as reported by `npm view sharp dist-tags.latest`.

If you cannot confirm this, please upgrade to the latest version and try again before opening an issue.

If you are using another package which depends on a version of `sharp` that is not the latest, please open an issue against that package instead.

### Is this a problem with filesystem permissions?

If you are using npm v6 or earlier and installing as a `root` or `sudo` user, have you tried with the `npm install --unsafe-perm` flag?

If you are using npm v7 or later, does the user running `npm install` own the directory it is run in?

If you are using the `ignore-scripts` feature of `npm`, have you tried with the `npm install --ignore-scripts=false` flag?

What is the complete output of running `npm install --verbose sharp`? Have you checked this output for useful error messages?
### What is the complete output of running `npm install --verbose sharp`?

<details>

<!-- Please provide output of `npm install --verbose sharp` here. -->

</details>

### What is the output of running `npx envinfo --binaries --system --npmPackages=sharp --npmGlobalPackages=sharp`?

What is the output of running `npx envinfo --binaries --system`?
<!-- Please provide output of `npx envinfo --binaries --system --npmPackages=sharp --npmGlobalPackages=sharp` here. -->
41 changes: 35 additions & 6 deletions .github/ISSUE_TEMPLATE/possible-bug.md
Original file line number Diff line number Diff line change
@@ -7,14 +7,43 @@ labels: triage

<!-- If this issue relates to installation, please use https://github.com/lovell/sharp/issues/new?labels=installation&template=installation.md instead. -->

Are you using the latest version? Is the version currently in use as reported by `npm ls sharp` the same as the latest version as reported by `npm view sharp dist-tags.latest`?
## Possible bug

What are the steps to reproduce?
### Is this a possible bug in a feature of sharp, unrelated to installation?

What is the expected behaviour?
<!-- Please place an [x] in the box to confirm. -->

Are you able to provide a minimal, standalone code sample, without other dependencies, that demonstrates this problem?
- [ ] Running `npm install sharp` completes without error.
- [ ] Running `node -e "require('sharp')"` completes without error.

Are you able to provide a sample image that helps explain the problem?
If you cannot confirm both of these, please open an [installation issue](https://github.com/lovell/sharp/issues/new?labels=installation&template=installation.md) instead.

What is the output of running `npx envinfo --binaries --system`?
### Are you using the latest version of sharp?

<!-- Please place an [x] in the box to confirm. -->

- [ ] I am using the latest version of `sharp` as reported by `npm view sharp dist-tags.latest`.

If you cannot confirm this, please upgrade to the latest version and try again before opening an issue.

If you are using another package which depends on a version of `sharp` that is not the latest, please open an issue against that package instead.

### What is the output of running `npx envinfo --binaries --system --npmPackages=sharp --npmGlobalPackages=sharp`?

<!-- Please provide output of the above command here. -->

### What are the steps to reproduce?

<!-- Please enter steps to reproduce here. -->

### What is the expected behaviour?

<!-- Please enter the expected behaviour here. -->

### Please provide a minimal, standalone code sample, without other dependencies, that demonstrates this problem

<!-- Please provide either formatted code or a link to a repo/gist that allows someone else to reproduce here. -->

### Please provide sample image(s) that help explain this problem

<!-- Please provide links to one or more images here. -->
18 changes: 14 additions & 4 deletions .github/ISSUE_TEMPLATE/question.md
Original file line number Diff line number Diff line change
@@ -7,10 +7,20 @@ labels: question

<!-- If this issue relates to installation, please use https://github.com/lovell/sharp/issues/new?labels=installation&template=installation.md instead. -->

What are you trying to achieve?
## Question about an existing feature

Have you searched for similar questions?
### What are you trying to achieve?

Are you able to provide a minimal, standalone code sample that demonstrates this question?
<!-- Please provide context here. -->

Are you able to provide a sample image that helps explain the question?
### When you searched for similar issues, what did you find that might be related?

<!-- Please demonstrate your research here. -->

### Please provide a minimal, standalone code sample, without other dependencies, that demonstrates this question

<!-- Please provide either formatted code or a link to a repo/gist that helps someone else understand here. -->

### Please provide sample image(s) that help explain this question

<!-- Please provide links to one or more images here. -->
19 changes: 18 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -33,17 +33,33 @@ jobs:
- os: macos-10.15
nodejs_version: 12
prebuild: true
nodejs_arch: x64
- os: macos-10.15
nodejs_version: 14
nodejs_arch: x64
- os: macos-10.15
nodejs_version: 16
nodejs_arch: x64
- os: windows-2019
nodejs_version: 12
nodejs_arch: x86
prebuild: true
- os: windows-2019
nodejs_version: 14
nodejs_arch: x86
- os: windows-2019
nodejs_version: 16
nodejs_arch: x86
- os: windows-2019
nodejs_version: 12
nodejs_arch: x64
prebuild: true
- os: windows-2019
nodejs_version: 14
nodejs_arch: x64
- os: windows-2019
nodejs_version: 16
nodejs_arch: x64
steps:
- name: Dependencies (Linux glibc)
if: contains(matrix.container, 'centos')
@@ -57,9 +73,10 @@ jobs:
run: apk add build-base git python3 --update-cache
- name: Dependencies (macOS, Windows)
if: contains(matrix.os, 'macos') || contains(matrix.os, 'windows')
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.nodejs_version }}
architecture: ${{ matrix.nodejs_arch }}
- name: Checkout
uses: actions/checkout@v2
- name: Fix working directory ownership
17 changes: 0 additions & 17 deletions appveyor.yml

This file was deleted.

2 changes: 0 additions & 2 deletions binding.gyp
Original file line number Diff line number Diff line change
@@ -39,7 +39,6 @@
'VCCLCompilerTool': {
'ExceptionHandling': 1,
'Optimization': 1,
'RuntimeLibrary': '2', # /MD
'WholeProgramOptimization': 'true'
},
'VCLibrarianTool': {
@@ -206,7 +205,6 @@
'VCCLCompilerTool': {
'ExceptionHandling': 1,
'Optimization': 1,
'RuntimeLibrary': '2', # /MD
'WholeProgramOptimization': 'true'
},
'VCLibrarianTool': {
15 changes: 15 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -4,6 +4,21 @@

Requires libvips v8.12.2

### v0.30.2 - 2nd March 2022

* Improve performance and accuracy when compositing multiple images.
[#2286](https://github.com/lovell/sharp/issues/2286)

* Expand pkgconfig search path for wider BSD support.
[#3106](https://github.com/lovell/sharp/issues/3106)

* Ensure Windows C++ runtime is linked statically (regression in 0.30.0).
[#3110](https://github.com/lovell/sharp/pull/3110)
[@kleisauke](https://github.com/kleisauke)

* Temporarily ignore greyscale ICC profiles to workaround lcms bug.
[#3112](https://github.com/lovell/sharp/issues/3112)

### v0.30.1 - 9th February 2022

* Allow use of `toBuffer` and `toFile` on the same instance.
1 change: 0 additions & 1 deletion lib/composite.js
Original file line number Diff line number Diff line change
@@ -162,7 +162,6 @@ function composite (images) {
throw is.invalidParameterError('premultiplied', 'boolean', image.premultiplied);
}
}

return composite;
});
return this;
11 changes: 8 additions & 3 deletions lib/libvips.js
Original file line number Diff line number Diff line change
@@ -86,9 +86,14 @@ const removeVendoredLibvips = function () {
const pkgConfigPath = function () {
if (process.platform !== 'win32') {
const brewPkgConfigPath = spawnSync('which brew >/dev/null 2>&1 && eval $(brew --env) && echo $PKG_CONFIG_LIBDIR', spawnSyncOptions).stdout || '';
return [brewPkgConfigPath.trim(), env.PKG_CONFIG_PATH, '/usr/local/lib/pkgconfig', '/usr/lib/pkgconfig']
.filter(function (p) { return !!p; })
.join(':');
return [
brewPkgConfigPath.trim(),
env.PKG_CONFIG_PATH,
'/usr/local/lib/pkgconfig',
'/usr/lib/pkgconfig',
'/usr/local/libdata/pkgconfig',
'/usr/libdata/pkgconfig'
].filter(Boolean).join(':');
} else {
return '';
}
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "sharp",
"description": "High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP, GIF, AVIF and TIFF images",
"version": "0.30.1",
"version": "0.30.2",
"author": "Lovell Fuller <npm@lovell.info>",
"homepage": "https://github.com/lovell/sharp",
"contributors": [
@@ -126,8 +126,8 @@
"vips"
],
"dependencies": {
"color": "^4.2.0",
"detect-libc": "^2.0.0",
"color": "^4.2.1",
"detect-libc": "^2.0.1",
"node-addon-api": "^4.3.0",
"prebuild-install": "^7.0.1",
"semver": "^7.3.5",
@@ -143,7 +143,7 @@
"exif-reader": "^1.0.3",
"icc": "^2.0.0",
"license-checker": "^25.0.1",
"mocha": "^9.2.0",
"mocha": "^9.2.1",
"mock-fs": "^5.1.2",
"nyc": "^15.1.0",
"prebuild": "^11.0.3",
4 changes: 4 additions & 0 deletions src/common.cc
Original file line number Diff line number Diff line change
@@ -398,6 +398,10 @@ namespace sharp {
// From filesystem
imageType = DetermineImageType(descriptor->file.data());
if (imageType == ImageType::MISSING) {
if (descriptor->file.find("<svg") != std::string::npos) {
throw vips::VError("Input file is missing, did you mean "
"sharp(Buffer.from('" + descriptor->file.substr(0, 8) + "...')?");
}
throw vips::VError("Input file is missing");
}
if (imageType != ImageType::UNKNOWN) {
19 changes: 11 additions & 8 deletions src/pipeline.cc
Original file line number Diff line number Diff line change
@@ -292,7 +292,8 @@ class PipelineWorker : public Napi::AsyncWorker {
if (
sharp::HasProfile(image) &&
image.interpretation() != VIPS_INTERPRETATION_LABS &&
image.interpretation() != VIPS_INTERPRETATION_GREY16
image.interpretation() != VIPS_INTERPRETATION_GREY16 &&
image.interpretation() != VIPS_INTERPRETATION_B_W
) {
// Convert to sRGB/P3 using embedded profile
try {
@@ -581,6 +582,8 @@ class PipelineWorker : public Napi::AsyncWorker {

// Composite
if (shouldComposite) {
std::vector<VImage> images = { image };
std::vector<int> modes, xs, ys;
for (Composite *composite : baton->composite) {
VImage compositeImage;
sharp::ImageType compositeImageType = sharp::ImageType::UNKNOWN;
@@ -626,12 +629,12 @@ class PipelineWorker : public Napi::AsyncWorker {
// gravity was used for extract_area, set it back to its default value of 0
composite->gravity = 0;
}
// Ensure image to composite is sRGB with premultiplied alpha
// Ensure image to composite is sRGB with unpremultiplied alpha
compositeImage = compositeImage.colourspace(VIPS_INTERPRETATION_sRGB);
if (!sharp::HasAlpha(compositeImage)) {
compositeImage = sharp::EnsureAlpha(compositeImage, 1);
}
if (!composite->premultiplied) compositeImage = compositeImage.premultiply();
if (composite->premultiplied) compositeImage = compositeImage.unpremultiply();
// Calculate position
int left;
int top;
@@ -649,12 +652,12 @@ class PipelineWorker : public Napi::AsyncWorker {
std::tie(left, top) = sharp::CalculateCrop(image.width(), image.height(),
compositeImage.width(), compositeImage.height(), composite->gravity);
}
// Composite
image = image.composite2(compositeImage, composite->mode, VImage::option()
->set("premultiplied", TRUE)
->set("x", left)
->set("y", top));
images.push_back(compositeImage);
modes.push_back(composite->mode);
xs.push_back(left);
ys.push_back(top);
}
image = image.composite(images, modes, VImage::option()->set("x", xs)->set("y", ys));
}

// Reverse premultiplication after all transformations:
Loading