Here's how to do it:
1. First of all get a good image to work with. Go into the menu inside the fantasy city generator and disable "raised buildings". Mess with any other settings as you prefer, possibly getting rid of triangular buildings or putting more gaps between buildings. I like setting the buildings to "complex", also.
2. Export the image as an SVG. You can do this in the menu under "Settlement". The reason to do this is because you can open the SVG in Inkscape and remove all the text. Text covering up buildings will be a huge problem.
3. Additionally, export a PNG version of the image with colored districts, in case you want a map while you are building. The version you embed in the terrain will get hard to read, as you can see from my screenshot.
4. Once you've removed text and other unwanted elements from the SVG, save it as a PNG. Using MS Paint or Photoshop or Gimp etc., convert the image to black and white (no grey - just black and white) and scale it to an appropriate size. You probably need to make it much smaller!
5. Next, you need to decide what materials you want to use to create the building outlines or "foundations". Get a matching number here: https://www.worldpainter.net/trac/wiki/Scripting/TerrainTypeValues For example I used yellow terracotta, which is 15. (Using yellow terracotta was a bad decision! Use something which will be higher-contrast on your maps!) For the background, around the buildings, I used 0, which is grass. (Sadly this means any non-grass blocks on the surface were changed to grass.)
6. In the black and white image, change the black lines to the appropriate color for your material. In my case, the RGB color (15, 15, 15), a very dark grey, represented Yellow Terracotta. Then, change the background to pure black, (0,0,0) (or whichever material you want for the non-building background). The end result will be a very dark image, which is your terrain map. Now save this as a grayscale BMP. In Gimp, this is done by selecting Image -> Mode -> Grayscale, then File -> Export as... (and name it something ending in .bmp). It seems to work without messing with the export settings.
7. In WorldPainter, use Edit -> Import -> Mask as terrain or layer. Select the grayscale image you've created. If you've coded the colors correctly, you will now be able to select "terrain" and "one to one". Type in an offset to get the image to the right location in your world, and then hit "OK".
You can do this to an existing Minecraft world, but exercise some caution - use the 'read only' layer to prevent WorldEdit from making strange little changes.
If you want to get fancy, instead of importing the image as a terrain map you can make a custom layer, holding a custom ground cover, and then import the image as that custom layer. For example, you could bury the ruins under a single layer of dirt. so that you have to actually excavate them. I think I may have used a custom layer for my world, to make the terracotta markings 3 blocks deep.
I haven't tested these precise instructions, and I did this awhile ago! So I hope it's all correct but obviously exercise some caution if you're altering an existing Minecraft world.