Hi. I just wanted to know if I can export an entire world as an image.
I just understand that create a world can bind many tiled maps as if they are a single file.
However, when I try to export as an image, only one tiled map was exported even though that was bound to a world.
I know it is an annoying question but it will help my project directly.
Cheers
It’s not an annoying question, it makes a lot of sense. Unfortunately it’s not possible yet in the UI, but you can render an entire world to an image using the tmxrasterizer tool that ships with Tiled (which also supports other map formats, regardless of its name).
Usage instructions:
Usage: ./tmxrasterizer [options] map|world image
Renders a Tiled map or world to an image.
Options:
-h, --help Displays help on commandline options.
--help-all Displays help including Qt specific options.
-v, --version Displays version information.
-s, --scale <scale> The scale of the output image (default: 1).
-t, --tilesize <size> The requested size in pixels at which a tile
is rendered (overrides the --scale option).
--size <size> The output image fits within a SIZE x SIZE
square (overrides the --scale and --tilesize
options).
-a, --anti-aliasing Antialias edges of primitives.
--no-smoothing Use nearest neighbour instead of smooth
blending of pixels.
--ignore-visibility Ignore all layer visibility flags in the map
file, and render all layers in the output
(default is to omit invisible layers).
--hide-layer <name> Specifies a layer to omit from the output
image. Can be repeated to hide multiple
layers.
--show-layer <name> If used only specified layers are shown. Can
be repeated to show multiple specified layers
only.
--advance-animations <duration> If used tile animations are advanced by the
specified duration.
Arguments:
map|world Map or world file to render.
image Image file to output.
tmxrasterizer is a command line tool, you’ll need to run it from a command line if you want to see its text output. Open up cmd or PowerShell in Windows, navigate to the Tiled directory where tmxrasterizer.exe resides, and then you can use it.
The PNG map it created is truncated an only shows part of the upper corner of the map. The png file is 224 MB in size, Or 110336 x 122624 pixes in size. My map is made up of 480 region maps, each made up of 390 256x256 tiles.
As the error stated, the maximum image dimension tmxrasterizer can produce is 65500px.
So, if you want it to be able to output your world, you’ll need to set the scale such that your whole world can fit within 65500px. If your calculated size is correct, then your largest dimension is 122624. To fit that into 65500, you need a scale of about 0.53 (65500/122624).
Each of those parameters controls what the size of the target image will be, in different ways. When none of those parameters is provided, the world would get rendered at 1:1, but this is generally going to result in an image that is too large to be practical.
If you pass -t40, you’re telling it to export each tile at a size of 40 pixels. Apparently, this resulted in an image that was beyond the limits of JPG.
Alternatively you can pass for example --scale 0.53, as calculated by @eishiya to create the largest possible JPG. However, normally such large images are not practical so you may want to generate something much smaller.
You can also consider how large you’d need the target image to be, and then pass that size directly, using for example --size 1024, you’ll get an image with a width and height that are at most 1024.