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 consize
After installing Awesome package manager:
awesome install shinokada/consize
Download the latest release from the releases page.
cd /path/to/dir
sudo apt install consize_x.x.x-1_all.deb
Please clone or download from the repo.
git clone https://github.com/shinokada/consize.git
Consize 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/outputdir
To WEBP:
consize jpg2webp -o path/to/outputdir
To PNG:
consize jpg2png -o path/to/outputdir
The 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 outputDir
The 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/outputdir
To WEBP:
consize png2webp -o path/to/outputdir
Resize command requires -w
, --width
option and it all images is created in the resized
directory.
consize resize -w 540 -h 284
To set only the width
:
consize resize -w 540
Converting SVG files require the -w
, --width
option.
To JPG:
consize svg2jpg -w 50
To PNG:
consize svg2png
To JPG:
consize webp2jpg
To PNG:
consize webp2png
cd spec
./test_functions.sh
Converting 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".