Skip to content

orlandorode97/gofilter

Repository files navigation

Go Filter

Go Filter is a TUI (Terminal User Interface) tool to transform images with filters like grey-scale, inverted colors, and more.

Demo

gofilter TUI walkthrough recorded with VHS

How to start

# Clone the repository
git clone https://github.com/OrlandoRomo/go-filter.git

# Change directory to go-filter
cd go-filter

# Install dependencies
go mod tidy

# Build project (binary in bin/)
make build

# Or, without Make:
cd cmd/gofilter && go build -o gofilter .

Move the binary to your local environment:

  • Linux/Mac: sudo mv bin/gofilter /usr/local/bin (after make build), or sudo mv gofilter /usr/local/bin if you built inside cmd/gofilter.

Recording the demo GIF

Requires VHS, ttyd, and ffmpeg. Then:

make demo-gif

This refreshes fixtures/demo.png, builds gofilter, and writes gofilter.gif via gofilter.tape.

Usage

To use gofilter, open a terminal and run:

gofilter

The application will launch a TUI (Terminal User Interface) with the following flow:

1. File Selection

  • A file picker will appear showing directories and image files
  • Supported formats: .png, .jpg, .jpeg
  • .gif and .webp are NOT supported
  • Use arrow keys to navigate, enter to select a file or directory

2. Filter Selection

After selecting an image, you'll see a list of available filters:

  • gray - Gray scale filter
  • sepia - Sepia filter
  • negative - Negative/inverted colors filter
  • sketch - Sketch filter
  • red - Red scale filter
  • green - Green scale filter
  • blue - Blue scale filter
  • mirror - Mirror/flip filter
  • sharp - Sharp filter
  • blur - Blur filter

Use arrow keys (up/down or k/j) to navigate, enter to select.

3. Output Path Configuration

  • Default output path is your home directory
  • You can edit the path to change where the filtered image will be saved
  • Press enter to confirm and start processing, esc to go back

4. Processing

  • A progress bar will show the processing status
  • The image is being transformed in the background

5. Success

  • A success message will display the full output path and filename
  • Press any key to exit

Examples

Filter Result
gray
negative
red
blue
green
mirror
sepia
sketch
sharp

Project Structure

gofilter/
├── cmd/
│   └── gofilter/
│       └── main.go              # Entry point
├── internal/
│   ├── filter/                  # Filter implementations
│   │   ├── filter.go           # Filter interface & Effect struct
│   │   ├── gray.go             # Gray filter
│   │   ├── sepia.go            # Sepia filter
│   │   ├── negative.go         # Negative filter
│   │   ├── sketch.go           # Sketch filter
│   │   ├── red.go              # Red filter
│   │   ├── green.go            # Green filter
│   │   ├── blue.go             # Blue filter
│   │   ├── mirror.go           # Mirror filter
│   │   ├── sharp.go            # Sharp filter
│   │   ├── blur.go             # Blur filter
│   │   └── list.go             # Filter list utility
│   ├── image/                  # Image reading/writing
│   │   ├── reader.go          # Image reader
│   │   └── writer.go          # Image writer
│   └── tui/                    # Bubble Tea TUI
│       ├── model.go            # Main TUI model
│       ├── filepicker.go       # File picker view
│       ├── filterlist.go       # Filter list view
│       ├── outputpath.go       # Output path view
│       ├── progress.go         # Progress bar view
│       └── success.go          # Success/error views
├── go.mod
└── README.md

Dependencies

TODO

  1. Add more filters
  2. Add option to overwrite original file
  3. Add batch processing support
  4. Add image preview before/after filter application

About

gfilter is a CLI tool to transform an image to any filter such as a greyscale, inverted colors, etc

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors