Giter Club home page Giter Club logo

flood_fill_png's Introduction

Simple recursive flood fill algorithm implementation

What the algorithm looks like in action

Introduction

This was made based on the wikipedia page on the flood fill algorithm: https://en.wikipedia.org/wiki/Flood_fill

Compilation

If you have gcc and libpng-dev installed, you can compile the code by doing:

./compile.sh 

If you are on Debian, you can install libpng by doing:

sudo apt install libpng-dev

Example

This is an implementation of the recursive version of the flood fill algorithm, so it is only feasible for usage with smaller images. test_img.png is a test file you can use.

For example, using the test image, you can do:

./flood_fill_png test_img.png 60 70 255 255 255 255 0 255 255 150 example_out.png

Which turns the test image from:

To:

General usage

flood_fill_png <png_in> <x_root> <y_root> <R> <G> <B> <A> <R_target> <G_target> <B_target> <A_target> <png_out>

Where:

  • png_in : Input png image
  • x_root : X coordinate to start filling from
  • y_root : Y coordinate to start filling from
  • R : Red value of target color to replace
  • G : Green value of target color to replace
  • B : Blue value of target color to replace
  • A : Transparency value of target color to replace
  • R_target : Red value to replace target color with
  • G_target : Green value to replace target color with
  • B_target : Blue value to replace target color with
  • A_target : Transparency value to replace target color with
  • png_out : Output file name

flood_fill_png's People

Contributors

wickdchromosome avatar

Watchers

 avatar  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.