-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Testing default modulate() parameters
Related to #4 - trying to pinpoint interesting default parameters for keyword invocations
- Loading branch information
1 parent
fd7b4bb
commit 4bb2a77
Showing
1 changed file
with
42 additions
and
0 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import os | ||
from wand.image import Image | ||
from shutil import copyfile | ||
import glob | ||
import pdb | ||
|
||
modulate_presets_1 = { (-100, -200): 'dark'} | ||
modulate_presets_2 = { (200, 300): 'default', (-1000, -1000): 'galaxy', (200, -800): 'flir'} | ||
cwd = './defaults_test/' | ||
|
||
def get_images(directory): | ||
inv_dict_1 = {val: key for key, val in modulate_presets_1.items()} | ||
inv_dict_2 = {val: key for key, val in modulate_presets_2.items()} | ||
pdb.set_trace() | ||
count = 0 | ||
for sample in glob.glob(directory + '*.*'): | ||
for word in sorted(inv_dict_1.keys()): | ||
copy = cwd + 'src_copy.jpg' | ||
copyfile(sample, copy) | ||
copyfile(copy, cwd + 'modulate_%s_original_1.jpg' % str(count)) | ||
with Image(filename=copy) as modify: | ||
modify.modulate(inv_dict_1[word][0], inv_dict_1[word][1]) | ||
modify.save(filename = cwd + 'modulate_%s_%s_1.jpg' % (str(count), word)) | ||
for word in sorted(inv_dict_2.keys()): | ||
copy = cwd + 'src_copy.jpg' | ||
copyfile(sample, copy) | ||
copyfile(copy, cwd + 'modulate_%s_original_2.jpg' % str(count)) | ||
with Image(filename=copy) as modify: | ||
modify.modulate(inv_dict_2[word][0], inv_dict_2[word][1]) | ||
modify.save(filename = cwd + 'modulate_%s_%s_2.jpg' % (str(count), word)) | ||
count += 1 | ||
|
||
if not os.path.isdir(cwd): | ||
os.mkdir(cwd) | ||
else: | ||
for filename in glob.glob(cwd + 'modulate*.jpg'): | ||
os.remove(filename) | ||
|
||
def main(): | ||
get_images('./stock_images/') | ||
|
||
main() |