mapeditor / tiled

Flexible level editor
https://www.mapeditor.org/
Other
11.16k stars 1.75k forks source link

tmxrasterizer cannot run without X server #512

Open flyte opened 11 years ago

flyte commented 11 years ago

I'm unable to run tmxrasterizer on a headless box:

$ tmxrasterizer 
tmxrasterizer: cannot connect to X server 

I can't find anywhere in the code for tmxrasterizer which looks for an X server specifically so I assume it must be in one of the imported Tiled modules.

Does the module inherently need X server to perform the functions that tmxrasterizer uses, or does the module just check for the X server because it assumes you're going to run Tiled proper?

flyte commented 11 years ago

The workaround I'm using is to use xvfb:

$ xvfb-run tmxrasterizer 
Usage:
  tmxrasterizer [options] [input file] [output file]

Options:
  -h --help           : Display this help
  -v --version        : Display the version
  -s --scale SCALE    : The scale of the output image
  -t --tilesize SIZE  : The requested size in pixels at which a tile is rendered
                        Overrides the --scale option
  -a --anti-aliasing  : Smooth the output image using anti-aliasing
bjorn commented 11 years ago

This is because libtiled uses QPixmap rather than QImage, which means tmxrasterizer needs to use a QApplication instead of a QCoreApplication. The plan is to drop QPixmap usage from libtiled, see issue #505.