full_tile_widths can be 0 for items with many parts

This commit is contained in:
j 2016-09-05 15:47:36 +02:00
parent 0f0f5f42d8
commit 400162e400

View file

@ -9,15 +9,9 @@ import re
from PIL import Image
from ox.utils import json
__all__ = ['join_tiles', 'split_tiles']
def join_tiles(source_paths, durations, target_path):
'''
This is an implementation of a join_tiles function for new-style timelines.
Timelines of files will be read from source_paths, the timeline of the item will
be written to target_path.
'''
def divide(num, by):
def divide(num, by):
# divide(100, 3) -> [33, 33, 34]
arr = []
div = int(num / by)
@ -26,6 +20,13 @@ def join_tiles(source_paths, durations, target_path):
arr.append(div + (i > by - 1 - mod))
return arr
def join_tiles(source_paths, durations, target_path):
'''
This is an implementation of a join_tiles function for new-style timelines.
Timelines of files will be read from source_paths, the timeline of the item will
be written to target_path.
'''
def get_file_info(file_name):
for mode in modes:
if re.match('^timeline' + mode + '64p\d+\.jpg', file_name):
@ -84,6 +85,7 @@ def join_tiles(source_paths, durations, target_path):
#print(image_file)
if mode == full_tile_mode:
# render full tile
if data['full_tile_widths'][0]:
resized = data['target_images']['large'].resize((
data['full_tile_widths'][0], large_tile_h
), Image.ANTIALIAS)