For large-scale terraforming Factorio's map editor can be cumbersome, so I made a mod that exports maps to files and a program to convert those files into an image. This means you can use your favorite image editing program to edit a map and then convert that image and import it into Factorio.
I have tested this program on both Windows and Ubuntu on both my laptop and on my stationary, so I really hope it will work for you guys as well.
Right now it only import/export terrain tiles. I figured it would get kind of messy if you had to associate every entity (and direction of it) with a unique color, but if there's interest I can definitely add that.
If you want to, you can export your save, edit it, import it into the game and save it, and then convert it to a scenario and continue editing it in the map editor. Have a look at the wiki to find out how to convert it to a scenario
Installation
Windows
Download MapConverterWindows.zip and extract the archive somewhere, it contains the .exe and two .dll files, ready to go
Linux (at least Ubuntu)
Download MapConverterLinux.zip and extract the archive somewhere.
You need to install the DevIL library and minizip. You can do this by using "sudo apt-get install libdevil1c2" and "sudo apt-get install minizip" on Ubuntu.
The mod also uses boost_filesystem and boost_system, but I didn't have to install those on a fresh install. If you're using Ubuntu you probably know how to fix issues with missing libraries anyway
Download MapConverterWindows.zip and extract the archive somewhere, it contains the .exe and two .dll files, ready to go
Linux (at least Ubuntu)
Download MapConverterLinux.zip and extract the archive somewhere.
You need to install the DevIL library and minizip. You can do this by using "sudo apt-get install libdevil1c2" and "sudo apt-get install minizip" on Ubuntu.
The mod also uses boost_filesystem and boost_system, but I didn't have to install those on a fresh install. If you're using Ubuntu you probably know how to fix issues with missing libraries anyway
Usage
Run the executable to generate the mod's zip and tiles.txt. Put MapConverter_1.0.0.zip in Factorio's mods directory and make sure it's enabled when you run the game. For information about "tiles.txt", read the "tiles.txt" section
IF DRAGGING AND DROPPING DOESN'T WORK (I know it didn't work for me on Ubuntu) you have to start the program from the command line and use --in. There's an example in the "arguments" section
To extract an image from a map
Start a game as usual with the map you want to extract. When in-game, open up the console and enter
/c remote.call("MapConverter", "Export")
Now, depending on the map size the game will freeze for a while. If you're worried that game might have crashed you can go to "factorio/script-output/MapExport" and make sure files are being created. It exports everything chunk-wise, so it will probably create quite a lot of files. Don't be surprised if it creates thousands of files.
If there is no "script-output" folder in your Factorio directory you should have a look in %appdata/Factorio
When the game starts responding again the entire map has been exported. You can now drag and drop the "MapExport" folder onto the MapConverter executable.
Usually the program is done pretty quickly and the extracted map will be placed in a folder named "extractedmaps", by default it's a .png
Have a look at tiles.txt to see which tile corresponds to which color.
To import a map from an image
When you're done editing the image, you do the exact same thing as when you extracted the image, except you drag and drop the image onto the program and this time it will output a new version of MapConverter_1.0.0.zip. Replace the one you have in your mods directory with this new one and start (or restart) Factorio.
When in-game you can import the map by opening the console and entering
/c remote.call("MapConverter", "Import")
Once again, when the game unfreezes the mod is done and your map should be imported.
Say you only added some grass and some sand somewhere, then it's unnecessary to update every single tile. You can import only certain tiles by using
/c remote.call("MapConverter", "Import", {"grass", "sand"})
Alternatively you can ignore certain tiles e.g. "out-of-map" by using
/c remote.call("MapConverter", "Import", nil, {"out-of-map"})
Now everything except "out-of-map" will be imported. I would recommend you to always ignore out-of-map unless you have a specific reason not to.
IF DRAGGING AND DROPPING DOESN'T WORK (I know it didn't work for me on Ubuntu) you have to start the program from the command line and use --in. There's an example in the "arguments" section
To extract an image from a map
Start a game as usual with the map you want to extract. When in-game, open up the console and enter
/c remote.call("MapConverter", "Export")
Now, depending on the map size the game will freeze for a while. If you're worried that game might have crashed you can go to "factorio/script-output/MapExport" and make sure files are being created. It exports everything chunk-wise, so it will probably create quite a lot of files. Don't be surprised if it creates thousands of files.
If there is no "script-output" folder in your Factorio directory you should have a look in %appdata/Factorio
When the game starts responding again the entire map has been exported. You can now drag and drop the "MapExport" folder onto the MapConverter executable.
Usually the program is done pretty quickly and the extracted map will be placed in a folder named "extractedmaps", by default it's a .png
Have a look at tiles.txt to see which tile corresponds to which color.
To import a map from an image
When you're done editing the image, you do the exact same thing as when you extracted the image, except you drag and drop the image onto the program and this time it will output a new version of MapConverter_1.0.0.zip. Replace the one you have in your mods directory with this new one and start (or restart) Factorio.
When in-game you can import the map by opening the console and entering
/c remote.call("MapConverter", "Import")
Once again, when the game unfreezes the mod is done and your map should be imported.
Say you only added some grass and some sand somewhere, then it's unnecessary to update every single tile. You can import only certain tiles by using
/c remote.call("MapConverter", "Import", {"grass", "sand"})
Alternatively you can ignore certain tiles e.g. "out-of-map" by using
/c remote.call("MapConverter", "Import", nil, {"out-of-map"})
Now everything except "out-of-map" will be imported. I would recommend you to always ignore out-of-map unless you have a specific reason not to.
Parameters
There are a handful of parameters available if you start the program from the command line.
All parameters that take an argument will include an example. If the argument is a path it accepts both relative and absolute paths.
If you want to use spaces in the path you need to use quotes.
Example: --in "A path/with spaces/in it.png"
--in
Specifies where the input data is. This is either the "MapExport" folder or the path to the image you would like to import.
Example: --in ../Factorio/script-output/MapExport
--out
Specifies where you would like the output of the program to be placed and which file name and format you would like to use. If you get an error using some file format a .bmp is usually a safe bet.
Example: --out extractedmaps/Map.png
--data
Specifies where the data file is.
Example: --in E:/FactorioMapConverter/tiles.txt
--dontoverwrite
Tells the program to not overwrite when extracting an image. Instead it will add a number to its file name if it already exists (only when extracting).
--flipx
Flips the image along the x-axis before converting it (only when importing).
--flipy
Flips the image along the y-axis before converting it (only when importing).
--generatetiles
Generates the default tiles.txt file.
--help
Shows how to use the program. It basically prints this post
Full example
This is what it might look like when you put them all together:
MapConverter --in MapExport --out "extracted image.png" --data E:/somefolder/tiles.txt --dontoverwrite
If you don't supply an argument its default value will be used
All parameters that take an argument will include an example. If the argument is a path it accepts both relative and absolute paths.
If you want to use spaces in the path you need to use quotes.
Example: --in "A path/with spaces/in it.png"
--in
Specifies where the input data is. This is either the "MapExport" folder or the path to the image you would like to import.
Example: --in ../Factorio/script-output/MapExport
--out
Specifies where you would like the output of the program to be placed and which file name and format you would like to use. If you get an error using some file format a .bmp is usually a safe bet.
Example: --out extractedmaps/Map.png
--data
Specifies where the data file is.
Example: --in E:/FactorioMapConverter/tiles.txt
--dontoverwrite
Tells the program to not overwrite when extracting an image. Instead it will add a number to its file name if it already exists (only when extracting).
--flipx
Flips the image along the x-axis before converting it (only when importing).
--flipy
Flips the image along the y-axis before converting it (only when importing).
--generatetiles
Generates the default tiles.txt file.
--help
Shows how to use the program. It basically prints this post
Full example
This is what it might look like when you put them all together:
MapConverter --in MapExport --out "extracted image.png" --data E:/somefolder/tiles.txt --dontoverwrite
If you don't supply an argument its default value will be used
tiles.txt
This file is the file knows as the "data file". It contains all the tiles as of version 0.11.5 and the colors they correspond to in the image. You can change this file to your liking, but note that when exporting, if this file doesn't contain the tile that the game wants to export it will use the first value. If you notice that there are a bunch of tiles that are incorrect when you convert your image or map it's because this file contains errors.
Every tile should be listed on its own line and the color as an RGB value between 0 and 255. Make sure to spell the tile's names correctly and to enter the correct color values.
You need to regenerate the mod's zip archive before using the mod again (run the program without arguments).
If another mod adds more tiles you can add them to this file and exporting should still work.
Every tile should be listed on its own line and the color as an RGB value between 0 and 255. Make sure to spell the tile's names correctly and to enter the correct color values.
You need to regenerate the mod's zip archive before using the mod again (run the program without arguments).
If another mod adds more tiles you can add them to this file and exporting should still work.
Help
Why are there weird lines everywhere?
When you make substantial changes to a map there will probably be a bunch of lines here and there. These are the borders of the chunks that build up the world. The mod works chunk-wise and when you place down tiles it can sometimes get weird when Factorio decides to change them around (turning ground into shorelines for instance).
The simple solution to this is to run the command to import the map again until it works.
After Another import most lines are gone!
http://i.imgur.com/3wjlyIW.png
After yet another one there are no more lines.
http://i.imgur.com/qxbNsdM.png
It only imports a couple of tiles around me, not the entire map
Factorio will only replace tiles if the chunks have been generated. This means that if you want to import a 2000x2000 map you need to load up a map that is at least 2000x2000.
A very easy way of doing this is to open up the map editor and fly around and generate the world until it's big enough.
The minimap didn't update after importing
Yeah, it doesn't. You can make it update by using
/c game.player.force.rechart()
There's a lot of black on a map I just exported
The program will pad the image to maintain chunk positions, otherwise the center of the image wouldn't be the center of the map (i.e. spawn)
I can't start it because MSVC120.dll isn't found
You need to download this http://www.microsoft.com/en-us/download ... x?id=40784. If that didn't fix it try installing the same package but for Visual Studio 2012
I can't start it because I am running a 32-bit operating system
I didn't bother creating a 32-bit executable because I don't think people still use that.
When you make substantial changes to a map there will probably be a bunch of lines here and there. These are the borders of the chunks that build up the world. The mod works chunk-wise and when you place down tiles it can sometimes get weird when Factorio decides to change them around (turning ground into shorelines for instance).
The simple solution to this is to run the command to import the map again until it works.
After Another import most lines are gone!
http://i.imgur.com/3wjlyIW.png
After yet another one there are no more lines.
http://i.imgur.com/qxbNsdM.png
It only imports a couple of tiles around me, not the entire map
Factorio will only replace tiles if the chunks have been generated. This means that if you want to import a 2000x2000 map you need to load up a map that is at least 2000x2000.
A very easy way of doing this is to open up the map editor and fly around and generate the world until it's big enough.
The minimap didn't update after importing
Yeah, it doesn't. You can make it update by using
/c game.player.force.rechart()
There's a lot of black on a map I just exported
The program will pad the image to maintain chunk positions, otherwise the center of the image wouldn't be the center of the map (i.e. spawn)
I can't start it because MSVC120.dll isn't found
You need to download this http://www.microsoft.com/en-us/download ... x?id=40784. If that didn't fix it try installing the same package but for Visual Studio 2012
I can't start it because I am running a 32-bit operating system
I didn't bother creating a 32-bit executable because I don't think people still use that.
Pictures
I hope I didn't forget anything.A map in Factorio after I genereated it and ran /c game.forces.player.chart({lefttop = {x = -1000, y = -1000}, rightbottom = {x = 1000, y = 1000}})
The original screenshots are 1920x1200 and the exported maps are 2336x2400, so I shrunk them, that's why they look so small
The resulting image after converting the files
Then I made some changes
And then when back in-game and the map had been recharted
The original screenshots are 1920x1200 and the exported maps are 2336x2400, so I shrunk them, that's why they look so small
The resulting image after converting the files
Then I made some changes
And then when back in-game and the map had been recharted