"""Return width to height ratio of image."""
width, height = image.size
return float(width) / height
"""Return width to height ratio of image."""
width, height = image.size
return float(width) / height
# Check ratio
if ratio(image) > 1:
images = [crop(image, 0.6), crop(image, 0.6, from_right=True)]
else:
images = [image]
# Check ratio
if ratio(image) > 1:
images = [crop(image, 0.6), crop(image, 0.6, from_right=True)]
else:
images = [image]
for i, image in enumerate(images):
image_name = '%s.%d.png' % (basename(base_name), i)
for i, image in enumerate(images):
image_name = '%s.%d.png' % (basename(base_name), i)
# Save files
small_image = resize(image, 640, 960)
small_image = small_image.convert('L')
# Save files
small_image = resize(image, 640, 960)
small_image = small_image.convert('L')
tmp_output_dir + '/' + image_name,
))
os.remove(tmp_output_dir + '/' + image_name)
tmp_output_dir + '/' + image_name,
))
os.remove(tmp_output_dir + '/' + image_name)
# big_image = resize(image, 960, 1440)
# big_image = big_image.convert('L')
# big_image = big_image.filter(ImageFilter.SHARPEN)
# big_image = resize(image, 960, 1440)
# big_image = big_image.convert('L')
# big_image = big_image.filter(ImageFilter.SHARPEN)
# tmp_output_dir + '/' + image_name,
# ))
# os.remove(tmp_output_dir + '/' + image_name)
# tmp_output_dir + '/' + image_name,
# ))
# os.remove(tmp_output_dir + '/' + image_name)