There are many tools to optimize images, and it is hard to remember how to use them correctly.
How to optimize images
Then you can use
npx imagemin-cli input.png > output.png to optimize
input.png and save it as
This tool supports
png images, so you have no excuse not to optimize all of your images before publishing them on the web!
One more trick: if you're using this tool often, install it globally using
npm install --global imagemin-cli so that you don't wait for npx to query NPM.