Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Canvas area to image file #5

Open
meatlayer opened this issue Dec 1, 2018 · 8 comments
Open

Canvas area to image file #5

meatlayer opened this issue Dec 1, 2018 · 8 comments

Comments

@meatlayer
Copy link

meatlayer commented Dec 1, 2018

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.

@edoaxyz
Copy link

edoaxyz commented Dec 1, 2018

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.

@meatlayer
Copy link
Author

@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.

@edoaxyz
Copy link

edoaxyz commented Dec 1, 2018

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
Copy link

edoaxyz commented Dec 10, 2018

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.

@meatlayer
Copy link
Author

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?

@Koenvh1
Copy link

Koenvh1 commented Jul 29, 2019

@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.

@dariowouters
Copy link
Owner

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.

@meatlayer
Copy link
Author

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! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants