By Gaurab Chhetri on September 16, 2025
TL;DR: Building my first CLI tool taught me that solving your own problems can be fun, educational, and surprisingly impactful. Here’s what I learned from creating optimize-images-cli.
The tool in question is called optimize-images-cli, and it’s available on NPM. You can install it globally with:
npm i -g optimize-images-cli
In short, Optimize Images CLI is a powerful and flexible command-line utility for compressing, resizing, and converting images. It supports modern formats like WebP and AVIF, making it easy to optimize images for both web and app development.
This project started with a very real problem. I was working on a project (can’t share details yet) that had a folder with 200+ images. I needed to compress them and convert everything into a consistent format like .jpeg
.
Like anyone else would, I first turned to Google. Most of the online compressors I found were bloated with ads, slow, and not designed for bulk processing. I couldn’t find a tool that matched my exact use case.
That’s when I thought: why not build my own tool?
I had two options:
I went with the CLI route. The only catch? I had never built a CLI tool before.
I started by binge-watching a few YouTube tutorials and asking ChatGPT for quick guidance on libraries and project setup. I discovered new NPM packages I had never touched before, and soon enough, I had a working prototype.
Some highlights of what I implemented:
It was surprisingly fun to see the tool come alive piece by piece.
Of course, it wasn’t all smooth sailing. Some of the challenges I faced:
These pushed me to think about design, not just code.
Building this tool taught me more than I expected:
Right now, optimize-images-cli solves the problem I built it for. But if it gains traction, I’d love to expand it. Possible future directions include:
This project reminded me of the power of being a developer: sometimes, when the tools you need don’t exist, you can just build them yourself. It doesn’t always have to be big or complex to be useful.
If this story resonates, I’d love for you to try optimize-images-cli and share feedback. Who knows, your use case might inspire the next feature!