0
This repository has been archived on 2025-04-25. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
Minecraft-Overviewer/contrib/gallery.py
2012-01-01 22:44:08 -05:00

41 lines
960 B
Python

"""
Outputs a huge image with all currently-supported block textures.
"""
from overviewer_core import textures
import sys
import Image
if len(sys.argv) != 2:
print "usage: %s [output.png]" % (sys.argv[0],)
sys.exit(1)
t = textures.Textures()
t.generate()
blocks = {}
for blockid in xrange(textures.max_blockid):
for data in xrange(textures.max_data):
tex = t.blockmap[blockid * textures.max_data + data]
if tex:
if not blockid in blocks:
blocks[blockid] = {}
blocks[blockid][data] = tex
columns = max(map(len, blocks.values()))
rows = len(blocks)
texsize = t.texture_size
gallery = Image.new("RGBA", (columns * texsize, rows * texsize), t.bgcolor)
row = 0
for blockid, textures in blocks.iteritems():
column = 0
for data, tex in textures.iteritems():
gallery.paste(tex[0], (column * texsize, row * texsize))
column += 1
row += 1
gallery.save(sys.argv[1])