Giter Site home page Giter Site logo

go-dither's Introduction

Dithering

This is a command line tool for converting images to black and white using dithering techniques.

Dither is an intentionally applied form of noise used to randomize quantization error, preventing large-scale patterns such as color banding in images. Dither is routinely used in processing of both digital audio and video data, and is often one of the last stages of mastering audio to a CD. A common use of dither is converting a grayscale image to black and white, such that the density of black dots in the new image approximates the average gray level in the original.

See Wikipedia



Usage

go run main.go [image file] -m [dithering method] -f [output format] -o [output name] -q [output quality] -t [threshold value]

The following dithering methods are supported:

  • "o4": Ordered 4x4 dithering
  • "o9": Ordered 9x9 dithering
  • "t": Threshold dithering
  • "r": Random dithering
  • "a": Apply all dithering methods and save the output with different names

The following output formats are supported:

  • "jpg"
  • "png"

The output quality parameter should be an integer between 1 and 100.

The threshold value is only used for threshold dithering.

If no arguments are provided, the program will use default values:

  • Dithering method: "o4"
  • Output format: "jpg"
  • Output name: "output"
  • Output quality: 100
  • Threshold value: 0

The tool checks if the provided image file exists, and exits with an error message if it does not.

Example Usage

go run main.go image.jpg -m o9 -f png -o image_o9 -q 75 -t 128

This will take the image "image.jpg", apply ordered 9x9 dithering, and save the output as a PNG image named "image_o9" with quality 75 and threshold 128.

Acknowledgements

This CLI tool is heavily inspired by sloum/lid

go-dither's People

Contributors

cbrgm avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

millerhooks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.