
paramat wrote:Yes those were sideviews of worlds instead of cross sections. Here's a central cross seciton of a flexrealm mod dyson sphere 2600x1200px, the rings are interference patterns in the clouds.
python minetestmapper-numpy.py worlds/stampyworld/ stampyugb.png --drawunderground --minheight -32

spillz wrote:(And I had no idea that clouds get drawn -- or is this a feature of you mod?)
thetoon wrote:Am I the only one having trouble on 64bits python?
spillz wrote:What's the problem?
EDIT: If using python3, try pulling the latest version from my github repo. (Left in a python2 print statement)
Traceback (most recent call last):
File "./minetestmapper-numpy.py", line 707, in generate_map_info
plist = map_block(mapdata, version, ypos, maxy, plist, cdata, hdata, dnddata, day_night_differs, id_map, ignore, air, face_swap_order)
File "./minetestmapper-numpy.py", line 343, in map_block
cdata[po] = content[opaques]
TypeError: Cannot cast array data from dtype('int64') to dtype('int32') according to the rule 'safe'
Error at (-72,-1,-47): Cannot cast array data from dtype('int64') to dtype('int32') according to the rule 'safe'
Traceback (most recent call last):
File "./minetestmapper-numpy.py", line 707, in generate_map_info
plist = map_block(mapdata, version, ypos, maxy, plist, cdata, hdata, dnddata, day_night_differs, id_map, ignore, air, face_swap_order)
File "./minetestmapper-numpy.py", line 343, in map_block
cdata[po] = content[opaques]
TypeError: Cannot cast array data from dtype('int64') to dtype('int32') according to the rule 'safe'thetoon wrote:Still, when running the script, I got hundreds of the following statement :
paramat wrote:spillz, the cross section images facing north, south etc. work but have been reversed left to right, try comparing a cross section with an overhead view and you'll see.
spillz wrote:Update: Added LevelDB support
Traceback (most recent call last):
File "E:\Programme\minetest\util\minetestmapper-numpy.py", line 30, in <module
>
import cStringIO
ImportError: No module named 'cStringIO'import io
cStringIO.StringIO replace with io.StringIO~/.minetest/mods/minetest/util$ python minetestmapper-numpy.py ~/.minetest/worlds/stampyworld/ stampyugb.png --drawunderground --minheight -32
Result image (w=752 h=832) will be written to stampyugb.png
Error at (-23,3,-23): initial_value must be unicode or None, not buffer
Traceback (most recent call last):
File "minetestmapper-numpy.py", line 619, in generate_map_info
f = db.get(ps)
File "minetestmapper-numpy.py", line 429, in get
return io.StringIO(r[0])
TypeError: initial_value must be unicode or None, not buffer
Block data: Traceback (most recent call last):
File "minetestmapper-numpy.py", line 1005, in <module>
main()
File "minetestmapper-numpy.py", line 1000, in main
world.generate_map_info(str_to_uid)
File "minetestmapper-numpy.py", line 781, in generate_map_info
for c in r[0]:
NameError: global name 'r' is not defined~/.minetest/mods/minetest/util$ python3 minetestmapper-numpy.py ~/.minetest/worlds/stampyworld/ stampyugb.png --drawunderground --minheight -32
Traceback (most recent call last):
File "minetestmapper-numpy.py", line 1005, in <module>
main()
File "minetestmapper-numpy.py", line 987, in main
uid_to_color, str_to_uid = load_colors()
File "minetestmapper-numpy.py", line 198, in load_colors
f = file("colors.txt")
NameError: name 'file' is not defined
# region is incorrect if world limits are exceeded. I attempted to correct this, but it didn't work
# as this code generates incorrect values if the requested region is greater than the world dimensions
#pngminx = int(args.region[0]/16)*16 if args.region[0] < minx*16 else minx*16
#pngmaxx = int((args.region[1]+16)/16)*16 if args.region[1] > maxx*16 else maxx*16
#pngminz = int(args.region[2]/16)*16 if args.region[2] < minz*16 else minz*16
#pngmaxz = int((args.region[3]+16)/16)*16 if args.region[3] > maxz*16 else maxz*16
# worldlimits are measured in cubes of 16x16x16
pngminx = minx*16
pngmaxx = maxx*16
pngminz = minz*16
pngmaxz = maxz*16
pngregion=[pngminx, pngmaxx, pngminz, pngmaxz]
print("Saving to: "+ args.output)
print("PNG Region: ", pngregion)
print("Pixels PerNode: ", args.pixelspernode)
print("border: ", border)
# This saves data in tEXt chunks (non-standard naming tags are allowed according to the PNG specification)
im.info["pngRegion"] = str(pngregion[0])+ ","+ str(pngregion[1])+ ","+ str(pngregion[2])+ ","+ str(pngregion[3])
im.info["pngMinX"] = str(pngminx)
im.info["pngMaxZ"] = str(pngmaxz)
im.info["border"] = str(border)
im.info["pixPerNode"] = str(args.pixelspernode)
pngsave(im, args.output)
# Now create a square 'thumbnail' for display on square faces (which turns out to benefit from quite high resolution).
thumbSize = 512
imSize = im.size
if imSize[0] > imSize[1]:
reSize=(thumbSize, int(thumbSize*(int(imSize[1])/imSize[0])))
else:
reSize=(int(thumbSize*(float(imSize[0])/imSize[1])), thumbSize)
thumbBorder=((thumbSize-reSize[0])/2, (thumbSize-reSize[1])/2, thumbSize-(thumbSize-reSize[0])/2, thumbSize-(thumbSize-reSize[1])/2)
thumbIm = Image.new("RGB", (thumbSize,thumbSize), args.bgcolor)
thumbIm.paste(im.resize(reSize),thumbBorder)
thumbIm.save(args.output.replace(".png", "_thumb.png"), "PNG")
#
# wrapper around PIL 1.1.6 Image.save to preserve PNG metadata
#
# public domain, Nick Galbreath
# http://blog.client9.com/2007/08/28/python-pil-and-png-metadata-take-2.html
#
def pngsave(im, file):
# these can be automatically added to Image.info dict
# they are not user-added metadata
reserved = ('interlace', 'gamma', 'dpi', 'transparency', 'aspect')
# undocumented class
from PIL import PngImagePlugin
meta = PngImagePlugin.PngInfo()
# copy metadata into new object
for k,v in im.info.iteritems():
if k in reserved: continue
meta.add_text(k, v, 0)
# and save
im.save(file, "PNG", pnginfo=meta)
size = 128, 128
im.thumbnail(size, Image.ANTIALIAS)
im.save(args.output+ ".thumbnail", "PNG")
dgm5555 wrote:I'd also vote for water *semi* transparency if you're doing it, and just realised I've possibly done your ToDo #2. GUI. Have you got any other suggestions for it?
spillz wrote:Re GUI, the main thing I had in mind was a small app that draws the top view map, then makes it easy to select cross sections to view. Not sure that's all that useful (or easy to implement) for your in-game map.
spillz wrote:One thing I'm thinking about is that it should be possible to define various blocks as transparent in colors.txt and apply that color with a specified alpha level to blocks beneath.
Users browsing this forum: No registered users and 8 guests