# Import a map as a bitmap?

**URL:** <https://discourse.mapeditor.org/t/import-a-map-as-a-bitmap/180>\
**Category:** Questions\
**Created:** [January 19, 2015, 11:21pm UTC](https://discourse.mapeditor.org/t/import-a-map-as-a-bitmap/180 "2015-01-19T23:21:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bsabiston](https://avatars.discourse-cdn.com/v4/letter/b/b5ac83/32.png) [@bsabiston](https://discourse.mapeditor.org/u/bsabiston)\
**Post date:** [January 19, 2015, 11:21pm UTC](https://discourse.mapeditor.org/t/import-a-map-as-a-bitmap/180/1 "2015-01-19T23:21:18Z")

</div>

Hello,  
I want to generate some terrain bitmaps on my own, then bring them into Tiled for further editing. Can that be done? Like I would have a bitmap where each pixel in the bitmap would represent a tile in Tiled. Surely that is something people have done with this program before? I looked at the types of files that Tiled can open, but it doesn’t look like any bitmap formats. Alternatively is there any simple code example that would generate a .tmx file from a given bitmap?

Note I am not talking about the much harder thing that apparently is available, where it automatically generates a tile set from a game image. I’m just talking about converting a grid of numbers into the appropriate Tiled map format – and it would just use whichever tile set you load to go with it…

Thanks  
Bob

---

<div class="post-metadata">

**Author:** ![Ablu](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.mapeditor.org/ablu/32/1496_2.png) [@Ablu](https://discourse.mapeditor.org/u/Ablu)\
**Post date:** [January 21, 2015, 9:38pm UTC](https://discourse.mapeditor.org/t/import-a-map-as-a-bitmap/180/2 "2015-01-21T21:38:00Z")

</div>

A thing which might help you would be to load the initial bitmap as an image layer (you might need to resize it before to match your tilesize and then stamp tiles over the preset…

Alternatively you could write a plugin which allows loading the bitmap you are imagining (see [this thread](http://forum.mapeditor.org/t/about-custom-export-formats/656) for more info) or simply generate a tmx file with xml encoding (see [https://github.com/bjorn/tiled/wiki/TMX-Map-Format](https://github.com/bjorn/tiled/wiki/TMX-Map-Format) for details (or just generate an example file and look at it in your text editor of choice)).

I hope this helped,  
Ablu

---

<div class="post-metadata">

**Author:** ![bsabiston](https://avatars.discourse-cdn.com/v4/letter/b/b5ac83/32.png) [@bsabiston](https://discourse.mapeditor.org/u/bsabiston)\
**Post date:** [January 22, 2015, 12:31am UTC](https://discourse.mapeditor.org/t/import-a-map-as-a-bitmap/180/3 "2015-01-22T00:31:07Z")

</div>

OK thanks – I wrote some code to just generate the TMX file. It was pretty easy with OSX’s NSXML class.
