Skip to content

Commit

Permalink
first iteration, script is working, need to pass file name, and tresh…
Browse files Browse the repository at this point in the history
…old(s) as argument of script
  • Loading branch information
N LNG authored and N LNG committed Dec 8, 2022
1 parent 2c8cd9c commit 6d31e89
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Binary file added bg_construct.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 10 additions & 1 deletion img2pa.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
from PIL import image
from PIL import Image
import os

dir = os.getcwd()
img = Image.open(dir+'/bg_construct.png')

for i in range(0, 251, 25): #for multiple iteration
thresh = i
fn = lambda x : 255 if x > thresh else 0
r = img.convert('L').point(fn, mode='1')
r.save(dir + '/bg_const_bw_' + str(i) + '.png')

0 comments on commit 6d31e89

Please sign in to comment.