Can I export a world as a image?

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. :slight_smile: 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.
1 Like

image

I do appreciate your aid.
If you meant this exe file that I marked, it doesn’t work from my PC even though I try to open it as a administrator.

Would you please give me a way to open that?
Sorry. I am newbie to this type of things :frowning:

Cheers,

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.

Thanks for your kind reply, eishiya.

I could not figure how to command my world file tho.
I will address this ticket to my co-worker to export a world map file as an image properly.

Cheers.

Using: tmxrasterizer -t40 “M:\Midgard Maps\Tiled Map Files\World\Knightguild.world” “c:\test.png”

I get a few - “libpng warning: iCCP: cHRM chunk does not match sRGB”
and “libpng waring: iCCP: known incorrect sRGB profile”

and finally ends with: “Error while writing “c:\test.png”: Cannot open device for writing: Access is denied.”

I moved the output to my G: drive (485 GB free), switched to jpg and tried again. Now I get:

“Maximum supported image dimension is 65500 pixels”
"Error while writing “g:\test.jpg”: Unknown error

Is there something that shows what the appropriate values for “scale”, “tilesize” or “size” are? How to get rid of the errors?

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.

1 Like

Thank you!

Thank you, that’s got it.