ts-map icon indicating copy to clipboard operation
ts-map copied to clipboard

Canvas area to image file

Open meatlayer opened this issue 6 years ago • 8 comments

You consider the possibility to add function in canvas area to save full map in a bitmap file .png ? By add an appropriate button on form and the ability to select zoom/scope and image resolution when saving.

meatlayer avatar Dec 01 '18 16:12 meatlayer

Saving the whole map in a single image is hard if you want to have a good definition of every road because you need to have a lot of RAM memory, not only for creating it but also for managing it. Best way is reducing the whole map in more tiles.

edoaxyz avatar Dec 01 '18 17:12 edoaxyz

@edoaxyz Hello! Tell, please, and how you get tiles from a game, for example for leaflet.js? Are you using some solution of your own? For example how to crop tiles from a large image, I know. And from the game to get the map and how... Is there a special approach? Thanks.

meatlayer avatar Dec 01 '18 20:12 meatlayer

Actually I'm using this software, a little modified by me, for taking pictures from the canvas that is displayed and moving along the whole map. I can put it here on github but I need to do some editings on it.

edoaxyz avatar Dec 01 '18 20:12 edoaxyz

Actually I don't have time for rewriting it, because I'm very busy with other projects. Anyway it seems that @dariowouters has made something about it in the latest commits in branch develop.

edoaxyz avatar Dec 10 '18 06:12 edoaxyz

If save to file more than 1-2 times with a resolution higher 10000х10000, there is a crash of the program (System.ArgumentException). Maybe it memory leak?

meatlayer avatar May 15 '19 22:05 meatlayer

@meatlayer I believe the cause for that is that the bitmap is never disposed. You can see how I generate tiles (only 4000×4000 instead of 256×256 at the moment) here. You can also stitch the map, but that will take around 24 hours and 500GB of temporary storage.

Koenvh1 avatar Jul 29 '19 19:07 Koenvh1

Sorry it took this long to answer and give a solution, but I took some time off from the project and just the game(s) in general. You can now generate a tile map using the program (develop branch), you only have to enter the maximum zoom level you want and select the export path, it will then generate all the images in the correct folders. (this can take a while if you go for higher zoom levels. With a zoom level of 8 you get a detailed city view on the ETS2 map, but it does generate 87 381 files and took about 20 minutes on an i5-4690) (next thing I'm probably looking into is optimization of the program)

Here you can see a quick example of the ETS2 map with a max zoom level of 4.

Here you can find the source of the web page and how you can use the tile map with OpenLayers.

dariowouters avatar Aug 03 '19 22:08 dariowouters

Thank you very much - this is really useful functionality! Because every game update and DLC release, it is very difficult to capture and update map for view in browser.

I checked with zoom = 8, tiles generated in 12 minutes on configuration: CPU: i7-7700K @ 4.2Ghz GPU: GTX1070 HDD: 1TB 7.2K SATA Enterprise OS: Windows 10 x64 RAM: 16GB DDR4

Very fast result! 👍

meatlayer avatar Aug 06 '19 05:08 meatlayer