Skip to content

Adjust tile color balance #23

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
ENV
*.jpg
*.jpeg
.DS_Store
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ For example:
<pre>python mosaic.py game_of_thrones_poster.jpg /home/admin/images/screenshots
</pre>

Or, if you want to use the included plain color tiles for pixel art effect (you can generate your own palette by modifying [the generation script](extras/gen_colors_rgb.py)):

<pre>python mosaic.py game_of_thrones_poster.jpg images/colors
</pre>

The images below show an example of how the mosaic tiles are matched to the details of the original image:

![Mosaic Image](https://codebox.net/assets/images/mosaic/mosaic_small.jpg)
Expand Down
22 changes: 22 additions & 0 deletions extras/gen_colors_rgb.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from PIL import Image
import os

# Creates a palette of small 32x32px PNG images.

output_dir = "output_images"
os.makedirs(output_dir, exist_ok=True)

# Define the equally spaced RGB levels for the palette combinations
nLevels = 10
step = 255.0/(nLevels-1)
levels = [int(i * step) for i in range(nLevels)]

# Generate and save the images
for r in levels:
for g in levels:
for b in levels:
img = Image.new("RGB", (32, 32), (r, g, b))
hex_color = f"{r:02x}{g:02x}{b:02x}"
img.save(os.path.join(output_dir, f"{hex_color}.png"))

print(f"Image generation complete; saved to {output_dir}")
Binary file added images/colors/000000.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/colors/00001c.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/colors/000038.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/colors/000055.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/colors/000071.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/colors/00008d.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/colors/0000aa.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/colors/0000c6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/colors/0000e2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/colors/0000ff.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/colors/001c00.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/colors/001c1c.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/colors/001c38.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/colors/001c55.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/colors/001c71.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/colors/001c8d.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/colors/001caa.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/colors/001cc6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/colors/001ce2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/colors/001cff.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/colors/003800.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/colors/00381c.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/colors/003838.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/colors/003855.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/colors/003871.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/colors/00388d.png
Binary file added images/colors/0038aa.png
Binary file added images/colors/0038c6.png
Binary file added images/colors/0038e2.png
Binary file added images/colors/0038ff.png
Binary file added images/colors/005500.png
Binary file added images/colors/00551c.png
Binary file added images/colors/005538.png
Binary file added images/colors/005555.png
Binary file added images/colors/005571.png
Binary file added images/colors/00558d.png
Binary file added images/colors/0055aa.png
Binary file added images/colors/0055c6.png
Binary file added images/colors/0055e2.png
Binary file added images/colors/0055ff.png
Binary file added images/colors/007100.png
Binary file added images/colors/00711c.png
Binary file added images/colors/007138.png
Binary file added images/colors/007155.png
Binary file added images/colors/007171.png
Binary file added images/colors/00718d.png
Binary file added images/colors/0071aa.png
Binary file added images/colors/0071c6.png
Binary file added images/colors/0071e2.png
Binary file added images/colors/0071ff.png
Binary file added images/colors/008d00.png
Binary file added images/colors/008d1c.png
Binary file added images/colors/008d38.png
Binary file added images/colors/008d55.png
Binary file added images/colors/008d71.png
Binary file added images/colors/008d8d.png
Binary file added images/colors/008daa.png
Binary file added images/colors/008dc6.png
Binary file added images/colors/008de2.png
Binary file added images/colors/008dff.png
Binary file added images/colors/00aa00.png
Binary file added images/colors/00aa1c.png
Binary file added images/colors/00aa38.png
Binary file added images/colors/00aa55.png
Binary file added images/colors/00aa71.png
Binary file added images/colors/00aa8d.png
Binary file added images/colors/00aaaa.png
Binary file added images/colors/00aac6.png
Binary file added images/colors/00aae2.png
Binary file added images/colors/00aaff.png
Binary file added images/colors/00c600.png
Binary file added images/colors/00c61c.png
Binary file added images/colors/00c638.png
Binary file added images/colors/00c655.png
Binary file added images/colors/00c671.png
Binary file added images/colors/00c68d.png
Binary file added images/colors/00c6aa.png
Binary file added images/colors/00c6c6.png
Binary file added images/colors/00c6e2.png
Binary file added images/colors/00c6ff.png
Binary file added images/colors/00e200.png
Binary file added images/colors/00e21c.png
Binary file added images/colors/00e238.png
Binary file added images/colors/00e255.png
Binary file added images/colors/00e271.png
Binary file added images/colors/00e28d.png
Binary file added images/colors/00e2aa.png
Binary file added images/colors/00e2c6.png
Binary file added images/colors/00e2e2.png
Binary file added images/colors/00e2ff.png
Binary file added images/colors/00ff00.png
Binary file added images/colors/00ff1c.png
Binary file added images/colors/00ff38.png
Binary file added images/colors/00ff55.png
Binary file added images/colors/00ff71.png
Binary file added images/colors/00ff8d.png
Binary file added images/colors/00ffaa.png
Binary file added images/colors/00ffc6.png
Binary file added images/colors/00ffe2.png
Binary file added images/colors/00ffff.png
Binary file added images/colors/1c0000.png
Binary file added images/colors/1c001c.png
Binary file added images/colors/1c0038.png
Binary file added images/colors/1c0055.png
Binary file added images/colors/1c0071.png
Binary file added images/colors/1c008d.png
Binary file added images/colors/1c00aa.png
Binary file added images/colors/1c00c6.png
Binary file added images/colors/1c00e2.png
Binary file added images/colors/1c00ff.png
Binary file added images/colors/1c1c00.png
Binary file added images/colors/1c1c1c.png
Binary file added images/colors/1c1c38.png
Binary file added images/colors/1c1c55.png
Binary file added images/colors/1c1c71.png
Binary file added images/colors/1c1c8d.png
Binary file added images/colors/1c1caa.png
Binary file added images/colors/1c1cc6.png
Binary file added images/colors/1c1ce2.png
Binary file added images/colors/1c1cff.png
Binary file added images/colors/1c3800.png
Binary file added images/colors/1c381c.png
Binary file added images/colors/1c3838.png
Binary file added images/colors/1c3855.png
Binary file added images/colors/1c3871.png
Binary file added images/colors/1c388d.png
Binary file added images/colors/1c38aa.png
Binary file added images/colors/1c38c6.png
Binary file added images/colors/1c38e2.png
Binary file added images/colors/1c38ff.png
Binary file added images/colors/1c5500.png
Binary file added images/colors/1c551c.png
Binary file added images/colors/1c5538.png
Binary file added images/colors/1c5555.png
Binary file added images/colors/1c5571.png
Binary file added images/colors/1c558d.png
Binary file added images/colors/1c55aa.png
Binary file added images/colors/1c55c6.png
Binary file added images/colors/1c55e2.png
Binary file added images/colors/1c55ff.png
Binary file added images/colors/1c7100.png
Binary file added images/colors/1c711c.png
Binary file added images/colors/1c7138.png
Binary file added images/colors/1c7155.png
Binary file added images/colors/1c7171.png
Binary file added images/colors/1c718d.png
Binary file added images/colors/1c71aa.png
Binary file added images/colors/1c71c6.png
Binary file added images/colors/1c71e2.png
Binary file added images/colors/1c71ff.png
Binary file added images/colors/1c8d00.png
Binary file added images/colors/1c8d1c.png
Binary file added images/colors/1c8d38.png
Binary file added images/colors/1c8d55.png
Binary file added images/colors/1c8d71.png
Binary file added images/colors/1c8d8d.png
Binary file added images/colors/1c8daa.png
Binary file added images/colors/1c8dc6.png
Binary file added images/colors/1c8de2.png
Binary file added images/colors/1c8dff.png
Binary file added images/colors/1caa00.png
Binary file added images/colors/1caa1c.png
Binary file added images/colors/1caa38.png
Binary file added images/colors/1caa55.png
Binary file added images/colors/1caa71.png
Binary file added images/colors/1caa8d.png
Binary file added images/colors/1caaaa.png
Binary file added images/colors/1caac6.png
Binary file added images/colors/1caae2.png
Binary file added images/colors/1caaff.png
Binary file added images/colors/1cc600.png
Binary file added images/colors/1cc61c.png
Binary file added images/colors/1cc638.png
Binary file added images/colors/1cc655.png
Binary file added images/colors/1cc671.png
Binary file added images/colors/1cc68d.png
Binary file added images/colors/1cc6aa.png
Binary file added images/colors/1cc6c6.png
Binary file added images/colors/1cc6e2.png
Binary file added images/colors/1cc6ff.png
Binary file added images/colors/1ce200.png
Binary file added images/colors/1ce21c.png
Binary file added images/colors/1ce238.png
Binary file added images/colors/1ce255.png
Binary file added images/colors/1ce271.png
Binary file added images/colors/1ce28d.png
Binary file added images/colors/1ce2aa.png
Binary file added images/colors/1ce2c6.png
Binary file added images/colors/1ce2e2.png
Binary file added images/colors/1ce2ff.png
Binary file added images/colors/1cff00.png
Binary file added images/colors/1cff1c.png
Binary file added images/colors/1cff38.png
Binary file added images/colors/1cff55.png
Binary file added images/colors/1cff71.png
Binary file added images/colors/1cff8d.png
Binary file added images/colors/1cffaa.png
Binary file added images/colors/1cffc6.png
Binary file added images/colors/1cffe2.png
Binary file added images/colors/1cffff.png
Binary file added images/colors/380000.png
Binary file added images/colors/38001c.png
Binary file added images/colors/380038.png
Binary file added images/colors/380055.png
Binary file added images/colors/380071.png
Binary file added images/colors/38008d.png
Binary file added images/colors/3800aa.png
Binary file added images/colors/3800c6.png
Binary file added images/colors/3800e2.png
Binary file added images/colors/3800ff.png
Binary file added images/colors/381c00.png
Binary file added images/colors/381c1c.png
Binary file added images/colors/381c38.png
Binary file added images/colors/381c55.png
Binary file added images/colors/381c71.png
Binary file added images/colors/381c8d.png
Binary file added images/colors/381caa.png
Binary file added images/colors/381cc6.png
Binary file added images/colors/381ce2.png
Binary file added images/colors/381cff.png
Binary file added images/colors/383800.png
Binary file added images/colors/38381c.png
Binary file added images/colors/383838.png
Binary file added images/colors/383855.png
Binary file added images/colors/383871.png
Binary file added images/colors/38388d.png
Binary file added images/colors/3838aa.png
Binary file added images/colors/3838c6.png
Binary file added images/colors/3838e2.png
Binary file added images/colors/3838ff.png
Binary file added images/colors/385500.png
Binary file added images/colors/38551c.png
Binary file added images/colors/385538.png
Binary file added images/colors/385555.png
Binary file added images/colors/385571.png
Binary file added images/colors/38558d.png
Binary file added images/colors/3855aa.png
Binary file added images/colors/3855c6.png
Binary file added images/colors/3855e2.png
Binary file added images/colors/3855ff.png
Binary file added images/colors/387100.png
Binary file added images/colors/38711c.png
Binary file added images/colors/387138.png
Binary file added images/colors/387155.png
Binary file added images/colors/387171.png
Binary file added images/colors/38718d.png
Binary file added images/colors/3871aa.png
Binary file added images/colors/3871c6.png
Binary file added images/colors/3871e2.png
Binary file added images/colors/3871ff.png
Binary file added images/colors/388d00.png
Binary file added images/colors/388d1c.png
Binary file added images/colors/388d38.png
Binary file added images/colors/388d55.png
Binary file added images/colors/388d71.png
Binary file added images/colors/388d8d.png
Binary file added images/colors/388daa.png
Binary file added images/colors/388dc6.png
Binary file added images/colors/388de2.png
Binary file added images/colors/388dff.png
Binary file added images/colors/38aa00.png
Binary file added images/colors/38aa1c.png
Binary file added images/colors/38aa38.png
Binary file added images/colors/38aa55.png
Binary file added images/colors/38aa71.png
Binary file added images/colors/38aa8d.png
Binary file added images/colors/38aaaa.png
Binary file added images/colors/38aac6.png
Binary file added images/colors/38aae2.png
Binary file added images/colors/38aaff.png
Binary file added images/colors/38c600.png
Binary file added images/colors/38c61c.png
Binary file added images/colors/38c638.png
Binary file added images/colors/38c655.png
Binary file added images/colors/38c671.png
Binary file added images/colors/38c68d.png
Binary file added images/colors/38c6aa.png
Binary file added images/colors/38c6c6.png
Binary file added images/colors/38c6e2.png
Binary file added images/colors/38c6ff.png
Binary file added images/colors/38e200.png
Binary file added images/colors/38e21c.png
Binary file added images/colors/38e238.png
Binary file added images/colors/38e255.png
Binary file added images/colors/38e271.png
Binary file added images/colors/38e28d.png
Binary file added images/colors/38e2aa.png
Binary file added images/colors/38e2c6.png
Binary file added images/colors/38e2e2.png
Binary file added images/colors/38e2ff.png
Binary file added images/colors/38ff00.png
Binary file added images/colors/38ff1c.png
Binary file added images/colors/38ff38.png
Binary file added images/colors/38ff55.png
Binary file added images/colors/38ff71.png
Binary file added images/colors/38ff8d.png
Binary file added images/colors/38ffaa.png
Loading