Giter VIP home page Giter VIP logo

experimental-image-dithering's Introduction

Experimental Image Dithering w/ImageMagick

Install

brew install imagemagick

Basic Command

convert input.png -dither Riemersma output.png
// or 
convert input.png -dither FloydSteinberg output.png

Monochrome

convert input.png -monochrome -dither Riemersma output.png
// or 
convert input.png -monochrome -dither FloydSteinberg output.png

Posterize

When using the -posterize option you need to add a level. Low numbers like 2, 3, 4, 5 have the most effect. → Official Reference

convert input.png -posterize 2 -dither FloydSteinberg output.png

Remap

Reduce the number of colors in an image to the colors used by another image (e.g. remapImage.png). → Official Reference

convert input.png -remap remapImage.png -dither FloydSteinberg output.png

The remap (input) image

The output image

Color Reduction

Set the preferred number of colors in the image. → Official Reference

convert input.png -colors 4 -dither FloydSteinberg output.png

2 Colors

5 Colors

10 Colors

Threshold Map

Use -ordered-dither to apply threshold mapped dither patterns, using uniform color maps, rather than specific color maps. → Official Reference.

convert input.png -colors 10 -ordered-dither o2x2 -dither FloydSteinberg output.png

-ordered-dither checks

-ordered-dither h4x4a

-ordered-dither h8x8a

-ordered-dither o2x2

Use convert list -threshold to see all available thresholds.

Morphology

Dilate

convert input.png -colors 10 -morphology Dilate Octagon:10 -dither FloydSteinberg output.jpg

Hit & Miss

The 'Hit-And-Miss' morphology method, also commonly known as "HMT" in computer science literature, is a high level morphology method that is specifically designed to find and locate specific patterns in images. It does this by looking for a specific configuration of 'foreground' and 'background' pixels around the 'origin'. → Official Reference.

convert input.png -colors 10 -morphology Hit-and-Miss '2x1:1,0' -dither FloydSteinberg output.jpg
// or 
convert input.png -colors 10 -morphology Hit-and-Miss '3x1:1,-,0' -dither FloydSteinberg output.jpg

Thinning

This method subtracts them from the original image. → Official Reference.

convert input.png -colors 10 -morphology Thinning '10x1+1+0:1,1,1,1,1,1,1,1,1,1' output.jpg

Skeleton

Create a Skeleton from your image. This works best when you make your images monochrome first. → Official Reference.

convert input.png -monochrome -morphology Thinning:-1 Skeleton output.jpg

Resources

experimental-image-dithering's People

Stargazers

 avatar

Watchers

 avatar

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.