Sharp Machine is an image optimizing program cli meant to be installed globally. After execution Sharp Machine will scan for images and optimize them according to config set up via interactive cli.
You can resize, crop and force format and edit whole sharp module config (will open your fav editor) via cli command.
Uses sharp npm module as base for image manipulation.
npm i -g sharpmachine
Navigate to a folder with images and run
sharpmachine
|_|
Welcome to sharp machine
- Either type folder name, or type "." for current folder (required)
- Enter output folder (required)
If selected folder contains images (png, jpg, gif, webp), you can :
-
Optimize images with default config; Images will optimized with 80 quality, unless specified via cli, the images will not be resized.
-
Optimize images to webp format with default config; Images will optimized with 80 quality, unless specified via cli, the images will not be resized.
For both options cli will ask for resizing options, if specified yes, cli will demand width (number: required), height (number: leave empty to keep the aspect ration) and image quality (0 - 100)
- Custom Config; custom config option will open your favorite text editor, where global sharp image config resides:
{
"quality":90,
"rotate":false,
"trim":false,
"jpegQuality":90,
"pngQuality":90,
"webpQuality":90,
"jpegProgressive":true,
"cropFocus":"left top",
"width":false,
"height":false,
"pngCompressionLevel":9,
"pngCompressionSpeed":4,
"toFormat":"",
"useMozJpeg":false
}
edit, save and quit
Configuration options and types can be found at: https://sharp.pixelplumbing.com/en/stable/api-operation/
-
Show Stats (yes/no) Shows simple statistics on executed files. (Slower)
-
Add watermark to images, cli will ask for watermark addition, in order to make this work put watermark.png into input folder. Sharpmachine will add the watermark image in the bottom right corner, please note that watermark should be smaller than the pictures you are optimizing
All requests are more than welcome
- Select files from the list
- Improve progress bars
- Improve verbose statistics
Type: ISC
Author: Lukasz Celitan, "Spaceghost", https://spaceout.pl, info@spaceout.pl