Код: Выделить всё
convert -crop 256x256 +repage input.jpg tiles_%d.jpg
UPD: Используя Python, сделал так:
Код: Выделить всё
from PIL import Image
src_path = 'DSCN9461.JPG'
tile_size = 256
src_img = Image.open(src_path)
# get size of original image
src_width, src_height = src_img.size
# calculate size of target image
target_width = src_width + (tile_size - src_width % tile_size)
target_height = src_height + (tile_size - src_height % tile_size)
# create transparent background
target_img = Image.new('RGBA', (target_width, target_height))
# combine original image and background
target_img.paste(src_img, (0, 0))
target_img.save('output.PNG', 'PNG')