-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
first iteration, script is working, need to pass file name, and tresh…
…old(s) as argument of script
- Loading branch information
N LNG
authored and
N LNG
committed
Dec 8, 2022
1 parent
2c8cd9c
commit 6d31e89
Showing
2 changed files
with
10 additions
and
1 deletion.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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') |