Sivan, thanks - I didn't thought about the impact of maximum texture size the 3D card. Though, d3d_texlimit is initialized with the highest possible texture resolution anyway. For my card it is 8192. So, when setting it to 6 * 2048 = 12288 it is obvious, that leads to an error, when bmap_save or bmap_fill are executed on such a huge bitmap.

Though, your code doesn't changed the behaviour of the script on my computer; bmap_fill still crashes and bmap_save doesn't produce any output file.

At least bmap_fill should check the bitmap dimensions first, in my opppinion. And the manual should refer to d3d_texlimit as constraint for both functions. At least it is written about bmap_save that the image size must be a multiple of 8.