Skip to content

AdrienB2/QOI-encoder-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

QOI-encoder-go

Overview

This project implements the Quite OK Image Format (QOI) — a simple, lossless image compression format — in the form of a Command Line Interface (CLI) written in Go. QOI offers comparable file sizes to PNG but encodes images 20–50 times faster and decodes them 3–4 times faster, making it an efficient alternative for many image processing applications.

Features

  • 🔄 Image Format Conversion
    Convert images from PNG to QOI and back, maintaining lossless quality.

  • 🚀 High Performance
    Enjoy the benefits of QOI's fast encoding and decoding speeds.

  • 🧰 Simple Command Line Interface
    Clean CLI interface with basic usage options including input/output file management and clear error messages.

  • 📊 Benchmarking
    Compare file size and speed metrics between PNG and QOI formats:

    • File size comparisons.
    • Encoding/decoding time measurements.

Why QOI?

  • Minimal specification: One A4 page is enough to define the entire format.
  • Easier to implement than formats like PNG.
  • Great learning opportunity for understanding real-world compression techniques.

Project Goals

  • Implement the QOI encoding and decoding algorithms.
  • Build a robust CLI tool for image conversion.
  • Validate correctness with automated tests.

Getting Started

Prerequisites

  • Go 1.21 or later installed on your machine.
  • make (optional, for building the project).
  • go command line tool (for building and running the project).

Installation

Option 1: download a pre-built binary from the releases page.

Option 2: build from source:

  1. Clone the repository:
git clone git@github.com:AdrienB2/QOI-encoder-go.git
cd QOI-encoder-go
  1. Install dependencies:
    • If you have make installed, run:
      make deps
    • If you don't have make, run:
      go mod tidy
  2. Build the project for your platform: - If you have make installed, run:
    make build
    • If you don't have make, run: bash go build -o pngqoi You can also build the for a specific platform using the one of the following commands:
make mac-x64
make mac-arm64
make linux-x64
make linux-arm64
make windows-x64
make build-all # build for all platforms

Usage

Commands:

  • encode: Convert a PNG file or directory of PNG files into QOI format.
  • decode: Convert a QOI file or directory of QOI files back into PNG format.

Common Arguments: Both encode and decode commands accept the following arguments: Both encode and decode commands accept the following arguments:

Argument Shortcut Description Required
-input -i Path to the input file or directory. For batch mode, this must be a directory. Yes
-output -o Path to the output file or directory. For batch mode, this must be a directory. Yes
-batch -d Enable batch mode to process all files in the input directory. Output files will keep the same names. No
-benchmark -b Run benchmark on the encode/decode process. Prints time taken, total size of input/output, and ratio. No
-help -h Show help message and exit. No

Examples:

  • Encode a single PNG file to QOI
./pngqoi encode -i input.png -o output.qoi
  • Decode a single QOI file to PNG
./pngqoi decode -i input.qoi -o output.png
  • Encode all PNG files in a directory to QOI format (batch mode)
./pngqoi encode -i input_directory -o output_directory -d
  • Decode all QOI files in a directory to PNG format (batch mode)
./pngqoi decode -i input_directory -o output_directory -d
  • Encode a file with benchmarking enabled
./pngqoi encode -i input.png -o output.qoi -b

References

Author

Adrien Barmaz

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors