Resizing and optimizing images in terminal
In terminal, type:
brew install imageoptim-cli
Then navigate to a directory holding all of the pngs you want to optimize, and type:
imageoptim --imagealpha '**/*.png'
This also works with a program called #JPEGmini for optimizing jpg’s but I haven’t tried that out yet.
Now batch resizing! Navigate to the directory holding images you wish to resize. Let's say this time there are both pngs and jpgs in this directory and you want to resize them all to have a width of 640px and maintain their aspect ratio. Type:
sips -Z 640 *.png *.jpg
Badabing, badabang! This is how that line breaks down.
sips is the program you’re running,
-Z tells it to maintain the aspect ratio,
640 is the width you want to resize all the images as in pixels, and then the next part is you identifying which image types you are resizing, in this case both
*.png *.jpg filetypes will be affected. If only png, all you’d need to have here is
- K V V P Λ [e-mail] [website]
30-something, he/him, pnw. “Retired” show promoter and scene kid, a not-very-good gamer, depressed most of the time. I'm big into music, animation (old Nickelodeon), spooky things, self-care, and my family.