I have approx. 6000 PNG files (256*256 pixels) and want to combine them into a big PNG holding all of them programmatically.
What\'s the best/fastest way to do that?
simple python script for joining tiles into one big image:
import Image
TILESIZE = 256
ZOOM = 15
def merge_images( xmin, xmax, ymin, ymax, output) :
out = Image.new( 'RGB', ((xmax-xmin+1) * TILESIZE, (ymax-ymin+1) * TILESIZE) )
imx = 0;
for x in range(xmin, xmax+1) :
imy = 0
for y in range(ymin, ymax+1) :
tile = Image.open( "%s_%s_%s.png" % (ZOOM, x, y) )
out.paste( tile, (imx, imy) )
imy += TILESIZE
imx += TILESIZE
out.save( output )
run:
merge_images(18188, 18207, 11097, 11111, "output.png")
works for files named like %ZOOM_%XCORD_%YCORD.png , for example 15_18188_11097.png