# -*- coding: utf-8 -*- #Width: 174 px #Height: #* Top - 48 px #* Title - 50 px #* Body - 1 px #* Bottom - 66 px (bottomy is 289) # USAGE: python make_parts.py # eg. python make_parts.py ../blocks PNG import sys from os import path, system width=174 height='' #height_top='0 0 174 48' #height_title='0 49 174 98' #height_body='0 99 174 100' #height_bottom='0 101 174 167' height_top='0 0 174 48' height_title='0 49 174 50' height_body='0 99 174 1' height_bottom='0 223 174 66' block_list = ('block1-users.png','block2-devs.png','block3-biz.png','block4-community.png','block5-outreach.png') file_in = sys.argv[1] file_block = '' prefix_out = sys.argv[2] for block_image in block_list: file_block = file_in + '/' + block_image file_out = block_image[0:6] for part in ('top','title','body','bottom'): if part == 'top': height = height_top if part == 'title': height = height_title if part == 'body': height = height_body if part == 'bottom': height = height_bottom cmd = 'gdal_translate -of %s -srcwin %s %s %s' % (prefix_out, height, file_block, file_out+'-'+part+'.png') print cmd # system(cmd)