Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lmarzen/dice-mosaic
Generate dice mosaics from jpeg/png images.
https://github.com/lmarzen/dice-mosaic
converter dice die generator image-processing mosaic mural
Last synced: about 21 hours ago
JSON representation
Generate dice mosaics from jpeg/png images.
- Host: GitHub
- URL: https://github.com/lmarzen/dice-mosaic
- Owner: lmarzen
- License: gpl-3.0
- Created: 2022-01-28T20:22:09.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-03-01T17:02:16.000Z (almost 2 years ago)
- Last Synced: 2024-11-11T09:53:21.333Z (about 1 month ago)
- Topics: converter, dice, die, generator, image-processing, mosaic, mural
- Language: C
- Homepage:
- Size: 5.44 MB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# dice-mosaic
Generate dice mosaics from jpeg/png images.Default options will attempt to read from 'input.jpg' in the current directory, scale the image by 0.05, then convert each pixel to grayscale before generating a dice mosaic using black die(w/ white dots) and saving the dice mosaic to 'output.png'.
Usage
---
Example: `./dice-mosaic -i examples/moon.jpg -o examples/moon_black_dice.png`![moon black dice](examples/moon_black_dice.png)
For all white die(w/ black dots) use the '-g w' flag.
Example: `./dice-mosaic -i examples/moon.jpg -o examples/moon_white_dice.png -g w`
![moon white dice](examples/moon_white_dice.png)
Here is an example of a mixed(white and black) die mosaic that was processed with increased contrast and brightness, and scaled to the largest resolution possible while not exceeding 48,000 die. Additionally the option -l [filename], indicates that the program should output a text file containing a map of dice values.
Example: `./dice-mosaic -i examples/sg.jpg -o examples/sg_dice.png -b 8 -c 1.17 -g m -m 48000 -l examples/sg.txt`
![sg dice](examples/sg_dice.png)
Options
---
-i [filename]
Input image(jpeg/png) filename or path.
Default is 'input.jpg'
-o [filename]
Output image filename or path. Default output format is .png.
Default is 'output.png`
-x [scale_factor]
Factor to scale input image by. Aspect ratio is preserved. Must be greater than 0. After scaling, each pixel cooresponds to a single dice. (this is the default scaling behavior if -x, -w, -h or -m, are not specified)
Default is 0.05
Cannot be used in conjunction with -w, -h, or -m.
-w [width]
Alternative scaling option, will scale an image to a specified number of die in width while preserving aspect ratio. Must be an integer greater than 0.
Cannot be used in conjunction with -x, -h, or -m.
-h [height]
Alternative scaling option, will scale an image to a specified number of die in height while preserving aspect ratio. Must be an integer greater than 0.
Cannot be used in conjunction with -x, -w, or -m.
-m [max_allowable_die]
Alternative scaling option, will scale the input image as large as possible while not exceed the specified number of die. Aspect ratio is preserved. Must be an integer greater than 0.
Cannot be used in conjunction with -x, -w, or -h.
-l [filename]
Will output a text file containing a list of dice values, at the specified path.
-g [m,b,w]
For all black die(w/ white dots) use './dice-mosaic -g b'. (this is the default if -g is not specified)
For all white die(w/ black dots) use './dice-mosaic -g w'.
For a mix of black and white die use './dice-mosaic -g m'.
-j [jpg_quality]
Set the output image format to JPEG and set JPEG quality setting. Integer from 0-100. High quality is 80-90.
Cannot be used in conjunction with -p.
-p
Set the output image format to png. (this is the default if -j or -p is not specified)
Cannot be used in conjunction with -j.
-c [contrast_modifier]
Change the contrast. a > 1 means more contrast, 0 < a < 1 means less contrast.
The value of a pixel is determined by the following function: f(x) = a(x) + b
Default is a=1.0
-b [brightness_modifier]
Change the brightness.
The value of a pixel is determined by the following function: f(x) = a(x) + b
Default is b=0.0
-r [dice_resolution]
Set the resolution of the dice that make up the mosaic. [dice_resolution] is the length of the sides of each dice. Must be an integer that is at least 12.
Default is 40
-d [cost_per_dice]
When this input is given the program will calculate the total cost of the mosaic. (Assumes USD)
-s [dice_size]
When this input is given the program will calculate the total size of the mural. (Assumes inches) (0.63in (16mm) is most common)
Getting Started
---
You are welcome to compile the code from source, otherwise here are instructions for how to get started with the provided compiled binaries.
Linux or Windows:
* Clone repository `git clone https://github.com/lmarzen/dice-mosaic.git` or download and extract ZIP.
* Open a terminal(or command prompt on Windows) in the folder that contains the dice-mosaic program.
* Run the program by typing `./dice-mosaic` if on linux or `dice-mosaic_x86.exe` if on windows 32-bit or `dice-mosaic_x64.exe` if on windows 64-bit, followed by any valid arguments.
* Done.