else
This commit is contained in:
parent
e66d2736f8
commit
f66dbc331c
3 changed files with 30 additions and 16 deletions
|
@ -22,7 +22,7 @@ def listfiles(directory):
|
|||
files = [name for name in files if os.path.isfile(name)]
|
||||
return files
|
||||
|
||||
def stitch(images, outputfilename):
|
||||
def stitch(images):
|
||||
largest_width = max(image.size[0] for image in images)
|
||||
largest_height = max(image.size[1] for image in images)
|
||||
print('Using cell size of %dx%dpx' % (largest_width, largest_height))
|
||||
|
@ -43,16 +43,18 @@ def stitch(images, outputfilename):
|
|||
gridspot_y = index // grid_width
|
||||
pixel_x = (gridspot_x * largest_width) + pad_x
|
||||
pixel_y = (gridspot_y * largest_height) + pad_y
|
||||
print(index, image.filename, gridspot_x, gridspot_y, pixel_x, pixel_y)
|
||||
print(index, gridspot_x, gridspot_y, pixel_x, pixel_y)
|
||||
stitched_image.paste(image, (pixel_x, pixel_y))
|
||||
print('Saving "%s"' % outputfilename)
|
||||
stitched_image.save(outputfilename)
|
||||
return stitched_image
|
||||
|
||||
|
||||
directory = sys.argv[1]
|
||||
images = listfiles(directory)
|
||||
directory_id = 'massstitch_%s.png' % directory
|
||||
if directory_id in images:
|
||||
images.remove(directory_id)
|
||||
images = load_all_images(images)
|
||||
stitch(images, directory_id)
|
||||
if __name__ == '__main__':
|
||||
directory = sys.argv[1]
|
||||
images = listfiles(directory)
|
||||
directory_id = 'massstitch_%s.png' % directory
|
||||
if directory_id in images:
|
||||
images.remove(directory_id)
|
||||
images = load_all_images(images)
|
||||
stitched_image = stitch(images)
|
||||
print('Saving "%s"' % directory_id)
|
||||
stitched_image.save(directory_id)
|
|
@ -11,8 +11,20 @@ import string
|
|||
import sys
|
||||
import time
|
||||
|
||||
x = clipext.resolve(sys.argv[1])
|
||||
if '--lines' in sys.argv:
|
||||
by_lines = True
|
||||
sys.argv.remove('--lines')
|
||||
else:
|
||||
by_lines = False
|
||||
text = clipext.resolve(sys.argv[1], split_lines=by_lines)
|
||||
transformation = ' '.join(sys.argv[2:])
|
||||
|
||||
result = eval(transformation)
|
||||
print(result)
|
||||
if by_lines:
|
||||
for line in text:
|
||||
x = line
|
||||
result = eval(transformation)
|
||||
print(result)
|
||||
else:
|
||||
x = text
|
||||
result = eval(transformation)
|
||||
print(result)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import math
|
||||
import random
|
||||
import sys
|
||||
import bytestring
|
||||
from voussoirkit import bytestring
|
||||
CHUNK_SIZE = 512 * (2 ** 10)
|
||||
def listget(li, index, fallback=None):
|
||||
try:
|
||||
|
|
Loading…
Reference in a new issue