DEV Community

Cover image for I got tired of Googling "resize,compress ,optimize image online " so I built a CLI for it
KUSHAL BARAL
KUSHAL BARAL

Posted on

I got tired of Googling "resize,compress ,optimize image online " so I built a CLI for it

Every time I need to resize a batch of images, strip metadata, or convert to WebP, I end up in the same loop:

  1. Google "resize image online"
  2. Pick a site, upload my photos (hope they don't keep them)
  3. Wait for download
  4. Repeat for the next thing

Or I open GIMP. Or I write yet another 10-line Pillow script that I'll lose by tomorrow.

So I built ImageX. It's the dumbest, simplest thing:

pip install imagex
cd ~/Pictures # works cross-platform with Python installed
imagex
Enter fullscreen mode Exit fullscreen mode

imagex menu image

A menu pops up. Pick what you want. Done. No uploads, no ads, no "premium" upsells.

What's in the box

Rotate, resize, convert, compress, watermark, strip metadata, rename batch, add noise. That covers 90% of what I ever need. Each one is an interactive prompt , no flags or command to memorize.

How it works

Every feature is its own .py file in a folder. Drop a new one in with a NAME, DESCRIPTION, and a run() function, and it shows up in the menu automatically. That's it.

NAME = "Rotate"
DESCRIPTION = "Rotate images 90° Left, 90° Right, or 180°"


def run(file, output_path, args):
    img = Image.open(file)
    rotated = img.transpose(args["method"])
    rotated.save(output_path)
    return True
Enter fullscreen mode Exit fullscreen mode

Added in 20 lines. No config, no registration, no boilerplate.

Why you should contribute

If you've ever thought "I should make an open source PR someday" — this is a great place to start. The codebase is small, pure Python + Pillow, no framework, no build system. Adding a feature is literally writing one file. Want to add auto-color correction? Blur? Border? Side-by-side merge? Go for it.

Links

PRs welcome. Even if it's just a feature in 20 lines.

Top comments (1)

Some comments may only be visible to logged-in visitors. Sign in to view all comments.