Skip to content

🐼 A simple CLI applet to generate 'White Noise' pictures. Now with PNG & GIF support.

License

Notifications You must be signed in to change notification settings

michalspano/white-noise

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

White Noise Generator

A simple CLI applet written in Go to create pictorial representations of White Noise.

Example

example

Okay, but how?

An output file of type .pgm in plain text (with valid headers) is created and that is, in fact, a Portable GrayMap. You may read more here.

Download

  1. Zip Download
  2. Manual download
$ git clone [email protected]:michalspano/white-noise.git && cd white-noise

Dependencies

Manual run requires a local copy of the Golang Binaries (with proper set-up).

PNG Parser Dependencies

  1. Python >= 3.6
  2. pip & pypng

GIF Parser Dependencies

  1. Python >= 3.6
  2. pip & PIL

Execute

Note: all command are executed from the root of the repository. A compiled binary is available for Linux and MacOS systems.

$ .bin/wnoise <...>

Manual execution is also available.

$ go run src/wnoise.go <...>

Windows support

Windows users may use the .exe binary that is compiled for Windows with a shell script.

64-bit version

$ bash .win/.win_64-bit.sh

32-bit version

$ bash .win/.win_32-bit.sh

Note: The .exe binaries for Windows will be stored in the bin folder.

Usage

Default use

$ ./wnoise <width> <height>

Custom use

Used to specify a custom output path with a custom name of the output file.

$ ./wnoise <width> <height> -d <output_path> -png

Help flag

See additional help.

$ ./wnoise <width> <height> -h

Png flag

Now, you can convert a generated .pgm file to a .png file. Just use the -png prefix at the end. Check Dependencies for correct set-up.

$ ./wnoise <width> <height> ... -png

GIF Parser

You can even convert generated sequence of .png files to a .gif file with a predefined

Example

gif-demo

shell command.

$ bash ./gif-parse/parse.sh <gif-stash_path> <output_path.png>

Default GIF attributes

A .json file containing the default GIF attributes is available in the gif-parse folder. You can change the gif-duration and gif-loop-count (0 indicates infinite loop).

Default values:

{
  "gif-preferences": {
    "duration": 200,
    "loop": 0
  }
}

Subcommands

Move all .png files to the Gif-stash folder.

$ bash ./gif-parse/dump_png.sh

Reset contents of the Gif-stash folder.

$ bash ./gif-parse/reset_stash.sh

Demo

live_demo