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, I like to share what's on my mind! I used to be an all-ages show promoter and I've been involved with numerous creative projects over the years. My interests include loud music, sp00ky stuff, 90's era nickelodeon, tech, writing, crafting, self-care, nintendo, live streaming & much more. I have a yorkie-poo named Toby and I am raising 6 goofy, temperamental hens. 🐔