mirror of
https://github.com/lovell/sharp.git
synced 2025-12-06 12:01:41 +01:00
Compare commits
2 Commits
e1628d8ef5
...
ef86a75560
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ef86a75560 | ||
|
|
6c1e840098 |
@ -1,5 +1,5 @@
|
||||
{
|
||||
"$schema": "https://biomejs.dev/schemas/2.3.3/schema.json",
|
||||
"$schema": "https://biomejs.dev/schemas/2.3.4/schema.json",
|
||||
"vcs": {
|
||||
"enabled": true,
|
||||
"clientKind": "git",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@img/sharp-darwin-arm64",
|
||||
"version": "0.34.4",
|
||||
"version": "0.34.5-rc.0",
|
||||
"description": "Prebuilt sharp for use with macOS 64-bit ARM",
|
||||
"author": "Lovell Fuller <npm@lovell.info>",
|
||||
"homepage": "https://sharp.pixelplumbing.com",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@img/sharp-darwin-x64",
|
||||
"version": "0.34.4",
|
||||
"version": "0.34.5-rc.0",
|
||||
"description": "Prebuilt sharp for use with macOS x64",
|
||||
"author": "Lovell Fuller <npm@lovell.info>",
|
||||
"homepage": "https://sharp.pixelplumbing.com",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@img/sharp-linux-arm",
|
||||
"version": "0.34.4",
|
||||
"version": "0.34.5-rc.0",
|
||||
"description": "Prebuilt sharp for use with Linux (glibc) ARM (32-bit)",
|
||||
"author": "Lovell Fuller <npm@lovell.info>",
|
||||
"homepage": "https://sharp.pixelplumbing.com",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@img/sharp-linux-arm64",
|
||||
"version": "0.34.4",
|
||||
"version": "0.34.5-rc.0",
|
||||
"description": "Prebuilt sharp for use with Linux (glibc) 64-bit ARM",
|
||||
"author": "Lovell Fuller <npm@lovell.info>",
|
||||
"homepage": "https://sharp.pixelplumbing.com",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@img/sharp-linux-ppc64",
|
||||
"version": "0.34.4",
|
||||
"version": "0.34.5-rc.0",
|
||||
"description": "Prebuilt sharp for use with Linux (glibc) ppc64",
|
||||
"author": "Lovell Fuller <npm@lovell.info>",
|
||||
"homepage": "https://sharp.pixelplumbing.com",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@img/sharp-linux-riscv64",
|
||||
"version": "0.34.4",
|
||||
"version": "0.34.5-rc.0",
|
||||
"description": "Prebuilt sharp for use with Linux (glibc) RISC-V 64-bit",
|
||||
"author": "Lovell Fuller <npm@lovell.info>",
|
||||
"homepage": "https://sharp.pixelplumbing.com",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@img/sharp-linux-s390x",
|
||||
"version": "0.34.4",
|
||||
"version": "0.34.5-rc.0",
|
||||
"description": "Prebuilt sharp for use with Linux (glibc) s390x",
|
||||
"author": "Lovell Fuller <npm@lovell.info>",
|
||||
"homepage": "https://sharp.pixelplumbing.com",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@img/sharp-linux-x64",
|
||||
"version": "0.34.4",
|
||||
"version": "0.34.5-rc.0",
|
||||
"description": "Prebuilt sharp for use with Linux (glibc) x64",
|
||||
"author": "Lovell Fuller <npm@lovell.info>",
|
||||
"homepage": "https://sharp.pixelplumbing.com",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@img/sharp-linuxmusl-arm64",
|
||||
"version": "0.34.4",
|
||||
"version": "0.34.5-rc.0",
|
||||
"description": "Prebuilt sharp for use with Linux (musl) 64-bit ARM",
|
||||
"author": "Lovell Fuller <npm@lovell.info>",
|
||||
"homepage": "https://sharp.pixelplumbing.com",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@img/sharp-linuxmusl-x64",
|
||||
"version": "0.34.4",
|
||||
"version": "0.34.5-rc.0",
|
||||
"description": "Prebuilt sharp for use with Linux (musl) x64",
|
||||
"author": "Lovell Fuller <npm@lovell.info>",
|
||||
"homepage": "https://sharp.pixelplumbing.com",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@img/sharp",
|
||||
"version": "0.34.4",
|
||||
"version": "0.34.5-rc.0",
|
||||
"private": "true",
|
||||
"workspaces": [
|
||||
"darwin-arm64",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@img/sharp-wasm32",
|
||||
"version": "0.34.4",
|
||||
"version": "0.34.5-rc.0",
|
||||
"description": "Prebuilt sharp for use with wasm32",
|
||||
"author": "Lovell Fuller <npm@lovell.info>",
|
||||
"homepage": "https://sharp.pixelplumbing.com",
|
||||
@ -31,7 +31,7 @@
|
||||
"node": "^18.17.0 || ^20.3.0 || >=21.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@emnapi/runtime": "^1.6.0"
|
||||
"@emnapi/runtime": "^1.7.0"
|
||||
},
|
||||
"cpu": [
|
||||
"wasm32"
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@img/sharp-win32-arm64",
|
||||
"version": "0.34.4",
|
||||
"version": "0.34.5-rc.0",
|
||||
"description": "Prebuilt sharp for use with Windows 64-bit ARM",
|
||||
"author": "Lovell Fuller <npm@lovell.info>",
|
||||
"homepage": "https://sharp.pixelplumbing.com",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@img/sharp-win32-ia32",
|
||||
"version": "0.34.4",
|
||||
"version": "0.34.5-rc.0",
|
||||
"description": "Prebuilt sharp for use with Windows x86 (32-bit)",
|
||||
"author": "Lovell Fuller <npm@lovell.info>",
|
||||
"homepage": "https://sharp.pixelplumbing.com",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@img/sharp-win32-x64",
|
||||
"version": "0.34.4",
|
||||
"version": "0.34.5-rc.0",
|
||||
"description": "Prebuilt sharp for use with Windows x64",
|
||||
"author": "Lovell Fuller <npm@lovell.info>",
|
||||
"homepage": "https://sharp.pixelplumbing.com",
|
||||
|
||||
36
package.json
36
package.json
@ -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.34.4",
|
||||
"version": "0.34.5-rc.0",
|
||||
"author": "Lovell Fuller <npm@lovell.info>",
|
||||
"homepage": "https://sharp.pixelplumbing.com",
|
||||
"contributors": [
|
||||
@ -144,8 +144,8 @@
|
||||
"semver": "^7.7.3"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@img/sharp-darwin-arm64": "0.34.4",
|
||||
"@img/sharp-darwin-x64": "0.34.4",
|
||||
"@img/sharp-darwin-arm64": "0.34.5-rc.0",
|
||||
"@img/sharp-darwin-x64": "0.34.5-rc.0",
|
||||
"@img/sharp-libvips-darwin-arm64": "1.2.4",
|
||||
"@img/sharp-libvips-darwin-x64": "1.2.4",
|
||||
"@img/sharp-libvips-linux-arm": "1.2.4",
|
||||
@ -156,30 +156,30 @@
|
||||
"@img/sharp-libvips-linux-x64": "1.2.4",
|
||||
"@img/sharp-libvips-linuxmusl-arm64": "1.2.4",
|
||||
"@img/sharp-libvips-linuxmusl-x64": "1.2.4",
|
||||
"@img/sharp-linux-arm": "0.34.4",
|
||||
"@img/sharp-linux-arm64": "0.34.4",
|
||||
"@img/sharp-linux-ppc64": "0.34.4",
|
||||
"@img/sharp-linux-riscv64": "0.34.4",
|
||||
"@img/sharp-linux-s390x": "0.34.4",
|
||||
"@img/sharp-linux-x64": "0.34.4",
|
||||
"@img/sharp-linuxmusl-arm64": "0.34.4",
|
||||
"@img/sharp-linuxmusl-x64": "0.34.4",
|
||||
"@img/sharp-wasm32": "0.34.4",
|
||||
"@img/sharp-win32-arm64": "0.34.4",
|
||||
"@img/sharp-win32-ia32": "0.34.4",
|
||||
"@img/sharp-win32-x64": "0.34.4"
|
||||
"@img/sharp-linux-arm": "0.34.5-rc.0",
|
||||
"@img/sharp-linux-arm64": "0.34.5-rc.0",
|
||||
"@img/sharp-linux-ppc64": "0.34.5-rc.0",
|
||||
"@img/sharp-linux-riscv64": "0.34.5-rc.0",
|
||||
"@img/sharp-linux-s390x": "0.34.5-rc.0",
|
||||
"@img/sharp-linux-x64": "0.34.5-rc.0",
|
||||
"@img/sharp-linuxmusl-arm64": "0.34.5-rc.0",
|
||||
"@img/sharp-linuxmusl-x64": "0.34.5-rc.0",
|
||||
"@img/sharp-wasm32": "0.34.5-rc.0",
|
||||
"@img/sharp-win32-arm64": "0.34.5-rc.0",
|
||||
"@img/sharp-win32-ia32": "0.34.5-rc.0",
|
||||
"@img/sharp-win32-x64": "0.34.5-rc.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@biomejs/biome": "^2.3.3",
|
||||
"@biomejs/biome": "^2.3.4",
|
||||
"@cpplint/cli": "^0.1.0",
|
||||
"@emnapi/runtime": "^1.6.0",
|
||||
"@emnapi/runtime": "^1.7.0",
|
||||
"@img/sharp-libvips-dev": "1.2.4",
|
||||
"@img/sharp-libvips-dev-wasm32": "1.2.4",
|
||||
"@img/sharp-libvips-win32-arm64": "1.2.4",
|
||||
"@img/sharp-libvips-win32-ia32": "1.2.4",
|
||||
"@img/sharp-libvips-win32-x64": "1.2.4",
|
||||
"@types/node": "*",
|
||||
"emnapi": "^1.6.0",
|
||||
"emnapi": "^1.7.0",
|
||||
"exif-reader": "^2.0.2",
|
||||
"extract-zip": "^2.0.1",
|
||||
"icc": "^3.0.0",
|
||||
|
||||
@ -219,10 +219,10 @@ class MetadataWorker : public Napi::AsyncWorker {
|
||||
if (!baton->levels.empty()) {
|
||||
int i = 0;
|
||||
Napi::Array levels = Napi::Array::New(env, static_cast<size_t>(baton->levels.size()));
|
||||
for (std::pair<int, int> const &l : baton->levels) {
|
||||
for (const auto& [width, height] : baton->levels) {
|
||||
Napi::Object level = Napi::Object::New(env);
|
||||
level.Set("width", l.first);
|
||||
level.Set("height", l.second);
|
||||
level.Set("width", width);
|
||||
level.Set("height", height);
|
||||
levels.Set(i++, level);
|
||||
}
|
||||
info.Set("levels", levels);
|
||||
@ -279,10 +279,10 @@ class MetadataWorker : public Napi::AsyncWorker {
|
||||
if (baton->comments.size() > 0) {
|
||||
int i = 0;
|
||||
Napi::Array comments = Napi::Array::New(env, baton->comments.size());
|
||||
for (auto &c : baton->comments) {
|
||||
for (const auto& [keyword, text] : baton->comments) {
|
||||
Napi::Object comment = Napi::Object::New(env);
|
||||
comment.Set("keyword", c.first);
|
||||
comment.Set("text", c.second);
|
||||
comment.Set("keyword", keyword);
|
||||
comment.Set("text", text);
|
||||
comments.Set(i++, comment);
|
||||
}
|
||||
info.Set("comments", comments);
|
||||
|
||||
@ -455,12 +455,10 @@ class PipelineWorker : public Napi::AsyncWorker {
|
||||
std::tie(image, background) = sharp::ApplyAlpha(image, baton->resizeBackground, shouldPremultiplyAlpha);
|
||||
|
||||
// Embed
|
||||
int left;
|
||||
int top;
|
||||
std::tie(left, top) = sharp::CalculateEmbedPosition(
|
||||
const auto& [left, top] = sharp::CalculateEmbedPosition(
|
||||
inputWidth, inputHeight, baton->width, baton->height, baton->position);
|
||||
int width = std::max(inputWidth, baton->width);
|
||||
int height = std::max(inputHeight, baton->height);
|
||||
const int width = std::max(inputWidth, baton->width);
|
||||
const int height = std::max(inputHeight, baton->height);
|
||||
|
||||
image = nPages > 1
|
||||
? sharp::EmbedMultiPage(image,
|
||||
@ -479,13 +477,10 @@ class PipelineWorker : public Napi::AsyncWorker {
|
||||
// Crop
|
||||
if (baton->position < 9) {
|
||||
// Gravity-based crop
|
||||
int left;
|
||||
int top;
|
||||
|
||||
std::tie(left, top) = sharp::CalculateCrop(
|
||||
const auto& [left, top] = sharp::CalculateCrop(
|
||||
inputWidth, inputHeight, baton->width, baton->height, baton->position);
|
||||
int width = std::min(inputWidth, baton->width);
|
||||
int height = std::min(inputHeight, baton->height);
|
||||
const int width = std::min(inputWidth, baton->width);
|
||||
const int height = std::min(inputHeight, baton->height);
|
||||
|
||||
image = nPages > 1
|
||||
? sharp::CropMultiPage(image,
|
||||
@ -803,7 +798,7 @@ class PipelineWorker : public Napi::AsyncWorker {
|
||||
}
|
||||
if (image.interpretation() != baton->colourspace) {
|
||||
image = image.colourspace(baton->colourspace, VImage::option()->set("source_space", image.interpretation()));
|
||||
if (inputProfile.first && baton->withIccProfile.empty()) {
|
||||
if (inputProfile.first != nullptr && baton->withIccProfile.empty()) {
|
||||
image = sharp::SetProfile(image, inputProfile);
|
||||
}
|
||||
}
|
||||
@ -860,8 +855,8 @@ class PipelineWorker : public Napi::AsyncWorker {
|
||||
if (!baton->withExifMerge) {
|
||||
image = sharp::RemoveExif(image);
|
||||
}
|
||||
for (const auto& s : baton->withExif) {
|
||||
image.set(s.first.data(), s.second.data());
|
||||
for (const auto& [key, value] : baton->withExif) {
|
||||
image.set(key.c_str(), value.c_str());
|
||||
}
|
||||
}
|
||||
// XMP buffer
|
||||
@ -1440,11 +1435,11 @@ class PipelineWorker : public Napi::AsyncWorker {
|
||||
std::string
|
||||
AssembleSuffixString(std::string extname, std::vector<std::pair<std::string, std::string>> options) {
|
||||
std::string argument;
|
||||
for (auto const &option : options) {
|
||||
for (const auto& [key, value] : options) {
|
||||
if (!argument.empty()) {
|
||||
argument += ",";
|
||||
}
|
||||
argument += option.first + "=" + option.second;
|
||||
argument += key + "=" + value;
|
||||
}
|
||||
return extname + "[" + argument + "]";
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user