Created
May 13, 2018 18:59
-
-
Save tinyfpga/59a969616af340c2099ed1149d8afa7a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def create_layers(img, name): | |
from PIL import Image | |
def combine(img, layers): | |
result = Image.new('RGB', img.size, 0x000000) | |
for i in range(img.size[0]): | |
for j in range(img.size[1]): | |
if img.getpixel((i, j)) in layers: | |
result.putpixel((i, j), 0xFFFFFF) | |
else: | |
result.putpixel((i, j), 0x000000) | |
return result | |
img_q = img.quantize(5) | |
combine(img_q, [4, 2, 1]).save(name + "_copper.png") | |
combine(img_q, [2, 3]).save(name + "_soldermask.png") | |
combine(img_q, [1]).save(name + "_silkscreen.png") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment