vseventer / sharp-cli Goto Github PK
View Code? Open in Web Editor NEWCLI for sharp.
License: MIT License
CLI for sharp.
License: MIT License
sharp extend Extends/pads the edges of the image with the provided background colour
I've tried a few ways but I can't figure out how to specify a colour. Advice would be appreciated. Thank you!
Support a directory as output (-o dir/
).
There have been multiple reports (#8, #13) where it is assumed the input files are saved in the output directory. The readme even shows this as an example (sharp -i ./input.jpg -o ./out resize 300 200
- out/input.jpg
will be a [...] version of input.jpg
).
It makes sense for the CLI to support this ask.
The following behavior is only true if the output directory exists. Otherwise, current behavior applies.
sharp -i single-file.jpg -o dir/
: single output file is dir/single-file.jpg
.sharp -i *.jpg -o dir/
: multiple output files are dir/*.jpg
sharp -i single-file-*.jpg -o dir/
: single output file is dir/single-file-*.jpg
.Running sharp resize --help
gives me as the first example:
Examples:
sharp resize --height 100 The output will be 100 pixels high,
auto-scaled width
However, if I try this like sharp resize --height 100 -i input.jpg -o output.jpg
, I get:
Not enough non-option arguments: got 0, need at least 1
Specify --help for available options
Either the example should be removed or resize should also work without non-option arguments. Personally, I'd prefer the latter.
node-gyp rebuild fails in my system ubuntu 16 64bit
Hey,
Ive been trying to debug my sharp implementation with your tool but i cant find one thing - fit
Its documented here: https://sharp.pixelplumbing.com/api-resize#resize
Im using fit: inside
in my app but i dont know where to specify it when using the cli.
Thanks for your help :)
How to composite multiple images by a single command? I'm making a PHP SDK for Sharp using this project so maybe we need a solution for composite multiple images like Imagick.
I'm trying to run the following command into a GitLab CI file .gitlab-ci.yml
:
npx sharp-cli resize 800 800 --withoutEnlargement true --optimise true --progressive true --withMetadata false --format input --fit inside --input $(find ./docs -name *.jpg -or -name *.png) --output "{dir}/{base}"
On my laptop, everything run well:
$ npx sharp-cli resize 800 800 --withoutEnlargement true --optimise true --progressive true --withMetadata false --format input --fit inside --input $(find ./docs -name *.jpg -or -name *.png) --output "{dir}/{base}"
info sharp Using cached /home/myuser/.npm/_libvips/libvips-8.8.1-linux-x64.tar.gz
/home/path/to/website/docs/images/photos/sejour.jpg
But inside a GitLab CI pipeline, it fails fast:
$ npx sharp-cli resize 800 800 --withoutEnlargement true --optimise true --progressive true --withMetadata false --format input --fit inside --input $(find ./docs -name *.jpg -or -name *.png) --output "{dir}/{base}"
internal/modules/cjs/loader.js:964
throw err;
^Error: Cannot find module '/root/.npm/_npx/12/lib/node_modules/sharp-cli/node_modules/sharp/install/libvips'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:961:17)
at Function.Module._load (internal/modules/cjs/loader.js:854:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, stat '/root/.npm/_npx/12/lib/node_modules/sharp-cli/node_modules/sharp/.node-gyp/13.3.0'
gyp ERR! System Linux 4.19.0-6-amd64
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /root/.npm/_npx/12/lib/node_modules/sharp-cli/node_modules/sharp
gyp ERR! node -v v13.3.0
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install:(node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2019-12-08T22_44_57_178Z-debug.log
Install for [ 'sharp-cli@latest' ] failed with code 1
Authenticating with credentials from /root/.docker/config.json
ERROR: Job failed: exit code 1
This error might not be specific to sharp-cli
and maybe more related to GitLab CI, but maybe someone will have a suggestion, or a starting point to look from.
I do not understand why node-gyp
is into the logs. Is libvips
being rebuilt on CI while it is simply downloaded on my laptop?
Thanks !
Hello!
Thanks for this tool, it works beautifully and is probably the best in town :-)
I discovered url-template
but the {dir}
directive does not correspond to what I expected. Ref to require('path').parse
.
For example, this is a command I used and did not work as expected:
$ sharp -i content/playstation/images/boite-de-console-playstation-europeen.jpg -o '{dir}/{name}.sq{ext}' resize 170 170
vips__file_open_write: unable to open file "/Users/oncletom/workspace/emunova/emunova.net/%2FUsers%2Foncletom%2Fworkspace%2Femunova%2Femunova.net%2Fcontent%2Fplaystation%2Fimages/boite-de-console-playstation-europeen.sq.jpg" for writing
unix error: No such file or directory
I was expecting {dir}
to be equal to either content/playstation/images
or /Users/oncletom/workspace/emunova/emunova.net/content/playstation/images
.
{dir}
looks like an encoded value of some sort, which is prefixed by $(pwd)
.
Am I using it wrong?
Thanks for your help :-)
I wanted to use sharp-cli
to scale images at <folder>/original/<picture>.png
to folder/scaled/<picture>.png
. When I used sharp resize 2000 --input "*/original/*.png" --output "{dir}/../scaled/{base}"
, I got the error ENOENT: no such file or directory, open 'scaled/<picture>.png'
because the folder scaled
doesn't exist on the project level but only in the subfolders (i.e. <folder>/scaled
). (Please take all values in this example figuratively. The error message used an absolute path but I cut the prefix as it's not relevant here, etc.)
After debugging sharp-cli
locally, I realized that the problem is not where the output template is processed but rather where the arguments are parsed. So apparently yargs
is to blame for this. When looking at
Lines 87 to 97 in cf12e80
and yarg
's options documentation, it became clear that sharp-cli
asks yarg
to normalize the template. After removing normalize: true,
, I had the behavior I wanted.
Is there any reason to ask yarg
for this normalization (rather than just resolving the path after processing the template)? If not, can you remove this line upstream so that I don't have to run a custom version of sharp-cli
on my computer? (If you want, I can make a PR for this.) It cannot be there for security reasons as it's still possible to leave the current working directory with --output "{dir}/../../scaled/{base}"
respectively just --output "../generated/{base}"
.
sharp resize 100 --input '*.png' --output '{dir}'
works in Node v14.17.2 but fails in Node v16.4.1 with the following error message:
The value of "position" is out of range. It must be an integer. Received Infinity
By inserting logger.error(err.stack)
in index.js
, I got the following stack trace:
RangeError [ERR_OUT_OF_RANGE]: The value of "position" is out of range. It must be an integer. Received Infinity
at read (node:fs:653:3)
at node:internal/util:335:7
at new Promise (<anonymous>)
at read (node:internal/util:321:12)
at Readable.read [as _read] (/[…]/sharp-cli/node_modules/rw-stream/index.js:43:39)
at Readable.read (node:internal/streams/readable:483:10)
at resume_ (node:internal/streams/readable:981:12)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
whenever I try to run sharp cli on a folder with subfolders to optimize pngs
this throws: Input buffer contains unsupported image format
sharp --input './**/*.png' -o {dir} --optimize
but this works:
sharp --input './**/*.jpg' -o {dir} --optimize
often times when this fails, it will change all my images to blank corrupted files.
note
this appears to occur when there is a corrupt/empty file in the matching group of files, could there be something done to skip invalid files so it doesn't destroy all my images?
environment info:
OS: windows 10
sharp 1.13.1
node v12.16.1
Hi @vseventer,
right now, sharp has output option "avif" https://sharp.pixelplumbing.com/api-output. could you help support this output in cli?
Thanks
Hi and thanks for the great cli!
I've used it before and everything was ok, but now when I'm -i ./big/* -o ./mini resize 200
I'm getting:
vips__file_open_write: unable to open file "/Users/myname/Desktop/mini" for writing
unix error: Is a directory
Am I doing something wrong?
sharp resize --help
:
sharp resize <width> [height]
Resize image to width × height
Reading this, I would expect that the height is inferred (so that the aspect ratio is preserved) if I only pass one value. However, as far as I can judge from playing around with the command, this is not what is happening. If only one value is provided, it is taken for both the width and the height. If this is intended, I'd suggest to change the documentation to something like:
sharp resize <width> <height>
sharp resize <width_and_height>
Resize image to width × height respectively to a square if only one value is provided
A similar change would then also make sense for sharp --help
, of course. This is just a suggestion to make this tool, which I really like so far, more user-friendly. 🙂
Hi!
First of all sorry for bothering you with this question.
I'm in a process to switch from imagemagick to sharp-cli but i'm having headaches trying to "convert" this composite command (who basically "stamps" a emoji .png file into a Windows Folder icon .png and outputs the composite result in another .png file for further processing):
magick <windows_folder_icon_dir>\256.png emoji_256.png -gravity SouthEast -geometry +16+29 -composite "compositeicon_256.png"
Is possible to make the same result using sharp-cli alone? Thanks in advance!
http://sharp.pixelplumbing.com/en/stable/changelog/#v022-uptake <- the new sharp/libvips compiles/installs cleanly for me, whereas the version currently pegged (0.21.3) fails with compilation errors. I see this while building expo-cli
.
Using [email protected]:
❯ file logo.png
logo.png: PNG image data, 512 x 512, 8-bit/color RGBA, non-interlaced
❯ npx sharp-cli -i ./logo.png -o ./logo_opt.png
/.../logo_opt.png
❯ file logo_opt.png
logo_opt.png: PNG image data, 512 x 512, 8-bit/color RGBA, non-interlaced
❯ file logo_opt.png
logo_opt.png: PNG image data, 512 x 512, 8-bit/color RGBA, non-interlaced
❯ npx sharp-cli -i ./logo.png -o ./logo_opt80.png --quality 80
/.../logo_opt80.png
❯ file logo_opt80.png
logo_opt80.png: ISO Media
We committed our own data and some data for our friends and family. It's all gone now, but we should remove it from the git history to be safe.
We could remove the entire early history or go through one commit at a time and remove things.
As far as I can judge from just quickly looking at the code, https://github.com/vseventer/sharp-cli/blob/master/cmd/resize.js is never used. All code seems to reference the (almost) identical file https://github.com/vseventer/sharp-cli/blob/master/cmd/resizing/resize.js.
Hello,
When I install your package or after install it when I do an upgrade, I have this warning in the shell:
"warning [email protected]: The engine "yargs" appears to be invalid."
I am using Yarn package manager instead of NPM.
Yarn 0.24.6
NodeJS 7.10.0
macOS Sierra 10.12.4
Could you check why this warning appears?
Regards
Is it possible resize image by percentage?
Something like scale...
Thanks
I'm getting an error when using the tool. Does the tool work on windows?
λ sharp -i ./1.png -o ./out resize 300 200
C:\Users\sblowes\AppData\Roaming\npm\node_modules\sharp-cli\lib\index.js:35
module.exports = (argv, options = { }) => {
^
SyntaxError: Unexpected token =
at exports.runInThisContext (vm.js:54:16)
at Module._compile (module.js:375:25)
at Object.Module._extensions..js (module.js:406:10)
at Module.load (module.js:345:32)
at Function.Module._load (module.js:302:12)
at Module.require (module.js:355:17)
at require (internal/module.js:13:17)
at Object.<anonymous> (C:\Users\sblowes\AppData\Roaming\npm\node_modules\sharp-cli\bin\cli.js:29:1)
at Module._compile (module.js:399:26)
at Object.Module._extensions..js (module.js:406:10)
sharp --help
module.js:355
Module._extensions[extension](this, filename);
^
Error: Module version mismatch. Expected 46, got 48.
at Error (native)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (/usr/local/lib/node_modules/sharp-cli/node_modules/sharp/index.js:12:13)
at Module._compile (module.js:434:26)
at Object.Module._extensions..js (module.js:452:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (/usr/local/lib/node_modules/sharp-cli/lib/runner.js:34:15)
at Module._compile (module.js:434:26)
at Object.Module._extensions..js (module.js:452:10)
at Module.load (module.js:355:32)````
Hi @vseventer,
First, thanks for this project. I find it very handy.
Second, I propose that we add a --animated
Global Option. It’s an option given by sharp and it amounts to the same as --pages -1
, but it’s a bit more descriptive.
I found some references to such a flag in the codebase, but couldn’t get it work. I tried putting --animated
in many places on the command and the only one that didn’t complain about an unknown parameter was sharp-cli -i animated.gif animated -o animated.webp
, but even then the output file wasn’t animated.
Thanks in advance.
can I use the cli to get meta data on the file?
I know you can use {dir}
to overwrite the original, but that can't help if the operation is a conversion from, for example, png
to jpg
.
Thanks for sharing this great project!
The npm install on wrong directory
gyp WARN EACCES user "root" does not have permission to access the dev dir "/root/.node-gyp/6.0.0"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/home/pi/node_modules/sharp/.node-gyp"
should be /usr/local/lib/nod_modules/sharp/
and /usr/local/bin
for node_modules/.bin
It appears that sharp-cli is embedding url-template that allow to use pattern matching in its command line.
It would be great to document that in the README file so that one can discover how to optimize a whole tree hierarchy.
Imagine there is the following tree:
directory/
directory/subdir1
directory/subdir1/image1.jpg
directory/subdir2
directory/subdir2/image2.png
I want to use a command that looks like npx sharp-cli resize 800 800 --format input --fit inside --input ./directory/**/*.{jpg|png} --output ./directory/
so that all jpg and png images are optimized and resized (if too big).
I found that url-template documentation is much too light and does not give much information about available variables.
@vseventer proposed something like --output "{dir}/{base}"
but I could not succeed to make it work.
Support overwriting the input file.
We've been historically able to do this, but I removed that feature since it led to errors when processing large files. The node dependency I relied upon back then is no longer maintained, so there might be a better alternative. This is also a user ask in #23.
sharp -i file.jpg -o file.jpg
: input file is overwritten with the processed image.sharp -i *.jpg -o ./
: multiple input files are overwritten with processed images.I'm trying to resize a directory of png images, but some of the images are already below my specified width/height, resulting in them being either cropped (if --max
isn't provided) or scaled up.
For example,
sharp -i src/images/*.png -o dist/images resize 640 640 --withoutEnlargement --max -- --quality 90 --optimize
results in all images being scaled up to 640
, regardless of whether or not some of the images are already smaller than 640
, even though I specified the --withoutEnlargement
flag.
Any ideas?
Expected positive integer for width but received 1204.9586776859503 of type number
Specify --help for available options
I'm getting this error in 1.13.1 — is it because of the crazy specificity I'm passing, and it's supposed to error like this, or is this a bug? 😅 I don't think this failed in earlier versions, but I'm having problems installing older versions on my new computer...
Support glob input patterns.
We need a more powerful way of matching multiple files, as right now we only support what the command line support. This came up as part of #26, where it seems the expectation that this "just works".
sharp -i '**/*.{jpg,png}'
: matches all JPG and PNG files in current and child directories.Today i found https://sharp.pixelplumbing.com/ and after reading i found your cli version. I am impressed by the results, it works great. Now i am running it on thousands of images and i wonder why it does not use the full power of my 16 cores 5950x. Load in htop looks pretty low. Is there anything i could do?
I found no switch to set a core-count, or something.
Regards.
Not sure if its an "issue"...
Since lasts versions and #26, sharp-cli allows to parse a whole tree and to process files in place (replacing the original file).
However, hidden files and directory are not processed are they are not parsed. They're simply ignored.
I'd love to see sharp-cli able to optimize images that are in a hidden directory.
With bash, I can set how bash behave with setting a specific shopt option:
$ shopt -u dotglob
$ ls docs/**/*.jpg
$
$ shopt -s dotglob
$ ls docs/**/*.jpg
docs/directory/.hidden-image.jpg
docs/.hidden-directory/image.jpg
$
Is there a way to set a similar option for sharp-cli? If not, could it be possible to add options to set how sharp-cli behave?
$ npx sharp-cli --include-hidden-files
$ npx sharp-cli --include-hidden-directory
Hi,
I need to resize an image with 2048px maximum hight or 2048px maximum width.
How to do this with command line?
Hello, i have one more question regarding Windows. I have Node 6 here, but i cannot manage how to use the cli properly. The point is, that it creates the new image in the same folder, and NOT uses the folder path i passed as "-o" parameter. See my output:
Admin@DESKTOP-RLI0V1T MINGW64 /d/Site/maerchen (master)
$ sharp -i ./static/images/* -o ./out resize 1500 0
D:%5CSite%5Cmaerchen%5Cout
D:%5CSite%5Cmaerchen%5Cout
So it's creating new files with wrong names in folder where i stand.
I have tried using the "Git Bash" and "Cmder". Result is the same.
Would someone have a hint for me?
I want to resize a serie of images that are in a directory. I'm using the following command:
npx sharp-cli resize 800 800 --withoutEnlargement true --optimise true --progressive true --withMetadata false --format input --input *.jpg --output "out/"
Images smaller than 800x800 are just copied in the output directory.
But bigger image are resized to 800x800 (square). What I wanted is that when an image is resized, its ratio is keeped: 800x600 for a landscape, and 600x800 for a portrait.
Have I missed something?
When I have a look at the documentation, I'm not sure if I have to use a height or width parameter or not:
sharp resize [height]
--height Number of pixels wide the resultant image should be [nombre]
--width Number of pixels high the resultant image should be [nombre]
Hi, any idea when the 1.5.3 version will be published on npm?
Currently I miss the option to set it to inside
or another of the possible values when I use resize
.
https://github.com/lovell/sharp/blob/master/docs/api-resize.md#resize
Yaaaarg! Apologies if this is a repost, but I continue to see yargs-parser
vulnerabilities in so many packages including this one. npm audit fix
suggests installing sharp-cli version 1.3.0, which seems like an extreme rollback solution...
# npm audit report
yargs-parser 6.0.0 - 13.1.1
Severity: moderate
yargs-parser Vulnerable to Prototype Pollution - https://github.com/advisories/GHSA-p9pc-299p-vxgp
fix available via `npm audit fix --force`
Will install [email protected], which is a breaking change
node_modules/sharp-cli/node_modules/yargs-parser
yargs 8.0.0-candidate.0 - 12.0.5
Depends on vulnerable versions of yargs-parser
node_modules/sharp-cli/node_modules/yargs
sharp-cli >=1.4.0
Depends on vulnerable versions of yargs
node_modules/sharp-cli
3 moderate severity vulnerabilities
I get 7 errors when i run npm test
. They all seems related to libheif
being missing. Is there any way I can fix this? I am trying to create a pull request where sharp
is updated to the latest v0.24.0, because that solves expo/expo-cli#1373.
Error: The heif operation requires libvips to have been installed with support for libheif
AssertionError: ["webp"] must have length of 2
AssertError: expected heif to be called with match
AssertionError: ["webp","tiff","jpeg"] must have length of 4
AssertError: expected heif to be called with match
AssertionError: ["webp","tiff","jpeg"] must have length of 4
AssertError: expected heif to be called with match
1) sharp-cli <options> [command..]
<options>
--hcompression
must execute the pipeline:
Error: The heif operation requires libvips to have been installed with support for libheif
at Sharp.heif (node_modules/sharp/lib/output.js:456:11)
at Function.invoke (node_modules/sinon/lib/sinon/spy.js:302:51)
at Sharp.heif (node_modules/sinon/lib/sinon/spy.js:90:30)
at /Users/janaagaard/Projects/sharp-cli/lib/cli.js:83:305
at /Users/janaagaard/Projects/sharp-cli/lib/queue.js:26:154
at Array.reduce (<anonymous>)
at Array.value (lib/queue.js:26:84)
at Context.<anonymous> (test/cli.js:263:32)
at /Users/janaagaard/Projects/sharp-cli/lib/cli.js:91:31
at parse (node_modules/yargs/yargs.js:567:18)
at Object.cli.parse (lib/cli.js:74:31)
at Context.<anonymous> (test/cli.js:252:32)
at processImmediate (internal/timers.js:456:21)
2) sharp-cli <options> [command..]
<options>
--lossless
must update the pipeline:
AssertionError: ["webp"] must have length of 2
at Context.<anonymous> (test/cli.js:320:40)
at /Users/janaagaard/Projects/sharp-cli/lib/cli.js:91:31
at parse (node_modules/yargs/yargs.js:567:18)
at Object.cli.parse (lib/cli.js:74:31)
at Context.<anonymous> (test/cli.js:313:32)
at processImmediate (internal/timers.js:456:21)
3) sharp-cli <options> [command..]
<options>
--lossless
must execute the pipeline:
AssertError: expected heif to be called with match
at Object.fail (node_modules/sinon/lib/sinon/assert.js:106:21)
at failAssertion (node_modules/sinon/lib/sinon/assert.js:65:16)
at Object.assert.<computed> [as calledWithMatch] (node_modules/sinon/lib/sinon/assert.js:91:13)
at Context.<anonymous> (test/cli.js:326:22)
at /Users/janaagaard/Projects/sharp-cli/lib/cli.js:91:31
at parse (node_modules/yargs/yargs.js:567:18)
at Object.cli.parse (lib/cli.js:74:31)
at Context.<anonymous> (test/cli.js:313:32)
at processImmediate (internal/timers.js:456:21)
4) sharp-cli <options> [command..]
<options>
--q
must update the pipeline:
AssertionError: ["webp","tiff","jpeg"] must have length of 4
at Context.<anonymous> (test/cli.js:538:42)
at /Users/janaagaard/Projects/sharp-cli/lib/cli.js:91:31
at parse (node_modules/yargs/yargs.js:567:18)
at Object.cli.parse (lib/cli.js:74:31)
at Context.<anonymous> (test/cli.js:531:34)
at processImmediate (internal/timers.js:456:21)
5) sharp-cli <options> [command..]
<options>
--q
must execute the pipeline:
AssertError: expected heif to be called with match
at Object.fail (node_modules/sinon/lib/sinon/assert.js:106:21)
at failAssertion (node_modules/sinon/lib/sinon/assert.js:65:16)
at Object.assert.<computed> [as calledWithMatch] (node_modules/sinon/lib/sinon/assert.js:91:13)
at Context.<anonymous> (test/cli.js:546:24)
at /Users/janaagaard/Projects/sharp-cli/lib/cli.js:91:31
at parse (node_modules/yargs/yargs.js:567:18)
at Object.cli.parse (lib/cli.js:74:31)
at Context.<anonymous> (test/cli.js:531:34)
at processImmediate (internal/timers.js:456:21)
6) sharp-cli <options> [command..]
<options>
--quality
must update the pipeline:
AssertionError: ["webp","tiff","jpeg"] must have length of 4
at Context.<anonymous> (test/cli.js:538:42)
at /Users/janaagaard/Projects/sharp-cli/lib/cli.js:91:31
at parse (node_modules/yargs/yargs.js:567:18)
at Object.cli.parse (lib/cli.js:74:31)
at Context.<anonymous> (test/cli.js:531:34)
at processImmediate (internal/timers.js:456:21)
7) sharp-cli <options> [command..]
<options>
--quality
must execute the pipeline:
AssertError: expected heif to be called with match
at Object.fail (node_modules/sinon/lib/sinon/assert.js:106:21)
at failAssertion (node_modules/sinon/lib/sinon/assert.js:65:16)
at Object.assert.<computed> [as calledWithMatch] (node_modules/sinon/lib/sinon/assert.js:91:13)
at Context.<anonymous> (test/cli.js:546:24)
at /Users/janaagaard/Projects/sharp-cli/lib/cli.js:91:31
at parse (node_modules/yargs/yargs.js:567:18)
at Object.cli.parse (lib/cli.js:74:31)
at Context.<anonymous> (test/cli.js:531:34)
at processImmediate (internal/timers.js:456:21)
"expo optimize" shows below error , even though after installing sharp-cli
Optimizing ./assets/icon.png
This command requires version 1.10.0 of sharp-cli
.
You can install it using npm install -g [email protected]
.
For prerequisites, see: https://sharp.dimens.io/en/stable/install/#prerequisites
Set EXPO_DEBUG=true in your env to view the stack trace.
When I run
sharp --input image.png --output image_pyramid tile 256 --layout google
I keep getting this error:
Unsupported output format dz
I also tried --layout zoomify
but it doesn't work either. Any tips?
Putting this image through sharp-cli
makes the semi-transparent pixels opaque, or a least a lot less transparent.
I have tried adding --alphaQuality 100
and --quality 100
to the command, but that doesn't help.
(I hope I am reporting this issue the correct place. This is the original issue that I have: expo/expo-cli#1373.)
Hi, and first of all thanks for this awesome CLI. It has sped up my thumbnailing process a TON.
There was a regression in my setup when moving from 1.10.0 to 1.11.0
This is the cmd I'm running
sharp -i media/images/site/project-gallery/tine-1/a2hlnlcafc.jpg
-o media/images/site/project-gallery/tine-1/xlarge/{name}{ext}
--quality 85 --palette true --format jpg resize 1900 --withoutEnlargement --fit inside
It works fine on 1.10.0, but on 1.11.0 it errors with
The heif operation requires libvips to have been installed with support for libheif
Specify --help for available options
Thanks!
When unknown arguments are attached to the resize command the output of the cli gives the error shown below.
Unknown argument: min
Specify --help for available options
The command below was used when throwing the error.
sharp -i image.jpg -o image.jpg resize 360 640 -q 100 --lossless --min
I expected that the cli would throw an exit code of 1 when the command fails.
Hello, I just found this package and tried installing on my M1 MacBook Pro.
It failed because Sharp in version 0.25.4 does not have ARM64 support.
However, I have used Sharp in version 0.30.3 in other projects which does have ARM64 support.
Can we just update the dependency for this library and release a new version or is there more work needed?
I have multiples subdirectories in my image directories, and I want to convert images inside these subdirectories and output the formatted files there.
I tried with the following cmd but it outputs all files in the main directory, images. Is something like this possible? Do I need to hard code subdirectories?
npx sharp --input './dist/images/**/*.jpg' --output './dist/images/' -f webp;
Would be good to have this as example because this package is more than a wrapper and has to support / add the different options too as it seems (cmd dir).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.