Creating a world from an image

Shaping your world can be difficult. Rivers always generate in the wrong place, islands are not where you want, your mountains don't look good enough. Sure, you can achieve a lot with all the biome options. But OTG also has a feature to generate your biomes from an image. With this feature you can take complete control over your world or use the normal biome mode and then have Terrain Control create an image to do some small map improvements.

## Pros and cons

The pros:

* Complete control over your biomes
* Much easier to work with
* Can be used to produce custom (adventure?) maps
* You can configure OTG to generate random biomes both beyond as within the image (Beware of hard, possibly ugly biome transitions)

And the cons:

* Images are not infinite, you must fall back on another biome generator when you are outside the image.
* Has some quirks which are described below.
* Hand painting a map adds a extra step into making your map and thus may take more time dependent on the map size.
* A lot of additional work will be required if Fromimage is used in combination with Random Mode.

## Creating an image

In each of the BiomeConfigs there is a `BiomeColor` variable. This variable is the hexadecimal color of the biome. It's not only used as the output color in the `/tc map` command, but also as the color in the input image. The exact `BiomeColor` must be used in the image to let the biome spawn where painted. Two biomes may not have the same color, if they do that color will result in ocean generating instead. For each custom biome you should change the `BiomeColor` from 0x000000 (black) to another color.

The default biome colors in both RGB and hex (OTG uses the same colors as AMIDST):

Each pixel on the image represents 4x4 blocks. As said above, the color in the image must be exactly the `BiomeColor`. Most brush tools of the photo editors won't work, as they change the color to another one:

The blurring (called anti-aliasing) allows objects to blend properly with the rest of an image, however OTG doesn't recognize those colors. When OTG finds a color it doesn't have a config for it places ocean. It is better to use editors (commonly called) pencil tool since that tool doesn't use anti-aliasing. Be sure to save the image as a png file as this is the only format supported and most other formats will change the colors during compression. Before generating a world check the image to ensure it hasn't been anti-aliased or compressed.

Another common error is to resize the image without disabling anti-aliasing:

When painting your image from scratch either assume the right edge (right as 'not left', not as 'not wrong') is north, or use the top as north (as most commonly do) and rotate your image 90 degrees clockwise before generating. If you are editing a map made from the `/otg map` command see that section below.

## Letting OTG generate it properly

After you are satified with your image and everything is rotated and resized correctly, it's time to let OTG do the work! Place the image next to the WorldConfig.ini file and take a look at the following settings in that file:

`ImageMode` - Can be set to `ContinueNormal` or `FillEmpty`. `ContinueNormal` will tell OTG to generate terrain randomly (like `BiomeMode:Normal`, based on it's settings) once it has hit areas outside the image or a color without a biome assigned. `FillEmpty` will fill any areas outside the image with the biome set in the `ImageFillBiome` setting, default ocean.

`ImageFile` - The name of the image file to use, default of map.png. Must be a .png image.

`ImageFillBiome` - The biome to use for generation once outside of the image area when `ImageMode` is set to FillEmpty. (Note: need to test if this changes the biome used when TC finds a biome color it doesn't recognize or conflicts with another biome color.)

`ImageXOffset` and `ImageYOffset` - Shift the the co-ordinate position of the image, useful for getting the center of your image at x:0 y:0. When using `ContinueNormal` set these to half the image size. In FillEmpty mode set this to half the image size in the negative value. Example - A 500x500 pixel map.png would have X and Y offset set to 250 in `ContinueNormal` and -250 in FillEmpty.

## Editing a random map using /tc map and ContinueNormal

OTG has the command `/otg map` to output a biome map. The images generated by it can, with some extra work, be reused as an input image for `FromImage`.

When using `/otg map` OTG creates a map at which 1 pixel = 1 block, but the input must always 1 pixel = 4x4 blocks. To get the image the right size it must be downsized to a quarter its normal size.

## Guide/ Tutorial Credits & Source:

Creating a world from an image by Rutger Kok and revisions done by patrix87 & matt112986

https://github.com/MCTCP/TerrainControl/wiki/Creating-a-world-from-an-image