Consize converts and resizes image formats. It supports converting PNG, JPG, JPEG and WEBP files. The script is built with the help of ImageMagick, webp, and optipng.
Consize can be installed using Homebrew, Awesome package manager or by cloning/downloading the repository.
brew tap shinokada/consize
brew install consizeAfter installing Awesome package manager:
awesome install shinokada/consizeDownload the latest release from the releases page.
cd /path/to/dir
sudo apt install consize_x.x.x-1_all.debPlease clone or download from the repo.
git clone https://github.com/shinokada/consize.gitConsize requires the following dependencies to be installed:
- zsh
# debian/ubuntu
sudo apt install zsh- ImageMagick
# mac
brew install imagemagick
# debian/ubuntu
sudo apt -y install imagemagick- webp
# mac
brew install webp
# debian/ubuntu
sudo apt -y install webp- jpegoptim
# mac
brew install jpegoptim
# debian/ubuntu
sudo apt -y install jpegoptim- optipng
# mac
brew install optipng
# debian/ubuntu
sudo apt -y install optipng- svgo
npm install -g svgo- svgexport
npm install -g svgexport| Options | Description |
|---|---|
| -i | Input directory option has the default value of the current directory (.) |
| -o | Output directory option has no default value |
| -q | Quality option has the default value of 100 |
consize img2webp -o path/to/outputdirTo WEBP:
consize jpg2webp -o path/to/outputdirTo PNG:
consize jpg2png -o path/to/outputdirThe following commands will run recursively in the current directory or the directory specified by the -o option.
consize optimize_jpg -o outputDir
consize optimize_png -o outputDir
consize optimize_svg -o outputDirThe consize organize_files command will create directories based on the file extensions and move all files into their respective directories. The default output directory is oraganized.
consize organize_files -o 'outputdir'To JPG:
consize png2jpg -o path/to/outputdirTo WEBP:
consize png2webp -o path/to/outputdirResize command requires -w, --width option and it all images is created in the resized directory.
consize resize -w 540 -h 284To set only the width:
consize resize -w 540Converting SVG files require the -w, --width option.
To JPG:
consize svg2jpg -w 50To PNG:
consize svg2pngTo JPG:
consize webp2jpgTo PNG:
consize webp2pngcd spec
./test_functions.shConverting Images to WebP From Terminal
This website can be downloaded and installed on your device for offline access as a Progressive Web App.
To install a PWA, look for the "Add to Home Screen" option in the browser's menu or settings. On most mobile devices, this option can be found by visiting the website, then selecting the "Options" or "Menu" button in the browser, and looking for the "Add to Home Screen" option. On some desktop browsers, right-click on the page and select "Install".