diff -Nurd -X.diff_ignore freeciv/client/climisc.c freeciv/client/climisc.c
--- freeciv/client/climisc.c	2013-02-27 08:31:35.674134476 +0200
+++ freeciv/client/climisc.c	2013-02-28 08:06:44.044400560 +0200
@@ -1428,5 +1428,5 @@
     return FALSE;
   }
 
-  return mapimg_create(pmapdef, TRUE, mapimgfile);
+  return mapimg_create(pmapdef, TRUE, mapimgfile, NULL);
 }
diff -Nurd -X.diff_ignore freeciv/common/mapimg.c freeciv/common/mapimg.c
--- freeciv/common/mapimg.c	2013-02-27 08:31:26.166134684 +0200
+++ freeciv/common/mapimg.c	2013-02-28 08:06:44.044400560 +0200
@@ -395,7 +395,8 @@
 static const char *img_playerstr(const struct player *pplayer);
 static void img_plot(struct img *pimg, const struct tile *ptile,
                      const struct rgbcolor *pcolor, const bv_pixel pixel);
-static bool img_save(const struct img *pimg, const char *mapimgfile);
+static bool img_save(const struct img *pimg, const char *mapimgfile,
+                     const char *path);
 static bool img_save_ppm(const struct img *pimg, const char *mapimgfile);
 #ifdef HAVE_MAPIMG_MAGICKWAND
 static bool img_save_magickwand(const struct img *pimg,
@@ -1312,7 +1313,8 @@
   If 'force' is FALSE, the image is only created if game.info.turn is a
   multiple of the map setting turns.
 ****************************************************************************/
-bool mapimg_create(struct mapdef *pmapdef, bool force, const char *savename)
+bool mapimg_create(struct mapdef *pmapdef, bool force, const char *savename,
+                   const char *path)
 {
   struct img *pimg;
   char mapimgfile[MAX_LEN_PATH];
@@ -1357,7 +1359,7 @@
 
     pimg = img_new(pmapdef, map.xsize, map.ysize);
     img_createmap(pimg);
-    if (!img_save(pimg, mapimgfile)) {
+    if (!img_save(pimg, mapimgfile, path)) {
       ret = FALSE;
     }
     img_destroy(pimg);
@@ -1380,7 +1382,7 @@
 
       pimg = img_new(pmapdef, map.xsize, map.ysize);
       img_createmap(pimg);
-      if (!img_save(pimg, mapimgfile)) {
+      if (!img_save(pimg, mapimgfile, path)) {
         ret = FALSE;
       }
       img_destroy(pimg);
@@ -1409,7 +1411,7 @@
   image is created for each supported toolkit and image format. The filename
   will be <basename as used for savegames>-colortest-<tookit>.<format>.
 ****************************************************************************/
-bool mapimg_colortest(const char *savename)
+bool mapimg_colortest(const char *savename, const char *path)
 {
   struct img *pimg;
   const struct rgbcolor *pcolor;
@@ -1509,7 +1511,7 @@
         /* filename for color test */
         generate_save_name(savename, mapimgfile, sizeof(mapimgfile), buf);
 
-        if (!img_save(pimg, mapimgfile)) {
+        if (!img_save(pimg, mapimgfile, path)) {
           /* If one of the mapimg format/toolkit combination fail, return
            * FALSE, i.e. an error occured. */
           ret = FALSE;
@@ -2003,19 +2005,34 @@
 /****************************************************************************
   Save an image as ppm file.
 ****************************************************************************/
-static bool img_save(const struct img *pimg, const char *mapimgfile)
+static bool img_save(const struct img *pimg, const char *mapimgfile,
+                     const char *path)
 {
   enum imagetool tool = pimg->def->tool;
   const struct toolkit *toolkit = img_toolkit_get(tool);
+  char tmpname[600];
 
   if (!toolkit) {
     MAPIMG_LOG(_("toolkit not defined"));
     return FALSE;
   }
 
+  if (!path_is_absolute(mapimgfile) && path != NULL) {
+    make_dir(path);
+
+    sz_strlcpy(tmpname, path);
+    if (tmpname[0] != '\0') {
+      sz_strlcat(tmpname, "/");
+    }
+  } else {
+    tmpname[0] = '\0';
+  }
+
+  sz_strlcat(tmpname, mapimgfile);
+
   MAPIMG_ASSERT_RET_VAL(toolkit->img_save, FALSE);
 
-  return toolkit->img_save(pimg, mapimgfile);
+  return toolkit->img_save(pimg, tmpname);
 }
 
 /****************************************************************************
diff -Nurd -X.diff_ignore freeciv/common/mapimg.h freeciv/common/mapimg.h
--- freeciv/common/mapimg.h	2012-09-29 20:48:24.625493514 +0300
+++ freeciv/common/mapimg.h	2013-02-28 08:06:44.044400560 +0200
@@ -123,8 +123,9 @@
 bool mapimg_delete(int id);
 bool mapimg_show(int id, char *str, size_t str_len, bool detail);
 bool mapimg_id2str(int id, char *str, size_t str_len);
-bool mapimg_create(struct mapdef *pmapdef, bool force, const char *savename);
-bool mapimg_colortest(const char *savename);
+bool mapimg_create(struct mapdef *pmapdef, bool force, const char *savename,
+                   const char *path);
+bool mapimg_colortest(const char *savename, const char *path);
 
 struct mapdef *mapimg_isvalid(int id);
 
diff -Nurd -X.diff_ignore freeciv/server/srv_main.c freeciv/server/srv_main.c
--- freeciv/server/srv_main.c	2013-02-27 08:31:29.982134600 +0200
+++ freeciv/server/srv_main.c	2013-02-28 08:06:44.044400560 +0200
@@ -2307,7 +2307,8 @@
         for (i = 0; i < mapimg_count(); i++) {
           struct mapdef *pmapdef = mapimg_isvalid(i);
           if (pmapdef != NULL) {
-            mapimg_create(pmapdef, FALSE, game.server.save_name);
+            mapimg_create(pmapdef, FALSE, game.server.save_name,
+                          srvarg.saves_pathname);
           } else {
             log_error("%s", mapimg_error());
           }
diff -Nurd -X.diff_ignore freeciv/server/stdinhand.c freeciv/server/stdinhand.c
--- freeciv/server/stdinhand.c	2013-02-28 05:08:25.916635279 +0200
+++ freeciv/server/stdinhand.c	2013-02-28 08:31:54.348367423 +0200
@@ -5385,7 +5385,7 @@
       goto cleanup;
     }
 
-    mapimg_colortest(game.server.save_name);
+    mapimg_colortest(game.server.save_name, NULL);
     cmd_reply(CMD_MAPIMG, caller, C_OK, _("Map color test images saved."));
     break;
 
@@ -5406,7 +5406,8 @@
       for (id = 0; id < mapimg_count(); id++) {
         struct mapdef *pmapdef = mapimg_isvalid(id);
         if (pmapdef != NULL) {
-          mapimg_create(pmapdef, TRUE, game.server.save_name);
+          mapimg_create(pmapdef, TRUE, game.server.save_name,
+                        srvarg.saves_pathname);
         } else {
           cmd_reply(CMD_MAPIMG, caller, C_FAIL,
                 _("Error saving map image %d: %s."), id, mapimg_error());
@@ -5423,7 +5424,8 @@
 
       pmapdef = mapimg_isvalid(id);
       if (pmapdef != NULL) {
-        mapimg_create(pmapdef, TRUE, game.server.save_name);
+        mapimg_create(pmapdef, TRUE, game.server.save_name,
+                      srvarg.saves_pathname);
       } else {
         cmd_reply(CMD_MAPIMG, caller, C_FAIL,
               _("Error saving map image %d: %s."), id, mapimg_error());
