The International Simutrans Forum

 

Author Topic: [request] map generation from png image  (Read 819 times)

0 Members and 1 Guest are viewing this topic.

Offline Phystam

  • Devotee
  • *
  • Posts: 496
  • Pak256.Ex developer
    • Pak256 wiki page
  • Languages: JP, EN, EO
[request] map generation from png image
« on: December 18, 2019, 05:14:46 PM »
Hello,

I have an idea about map generation.
Currently the game accepts only BMP or PPM images, however the file formats have really large file size since they are not compressed formats. So when I create large grayscale map files, the maps spend a lot of storage.
If the map generator accepts also png file, it is very helpful to reduce map file size.

Offline Leartin

  • Heir-Benevolent-Dictator-Apparent
  • Devotee
  • *
  • Posts: 1473
  • PAK-DEV P192C
  • Languages: DE, EN
Re: [request] map generation from png image
« Reply #1 on: December 18, 2019, 05:57:31 PM »
There was a patch in the works to support PNG for inline images, which would have added them for map import as well. Was a while ago, but for completions sake: https://forum.simutrans.com/index.php/topic,15049.0.html

Offline Yona-TYT

  • Devotee
  • *
  • Posts: 1528
    • Simutrans-BLOG
  • Languages: ES
Re: [request] map generation from png image
« Reply #2 on: December 22, 2019, 03:50:22 AM »
There was a patch in the works to support PNG for inline images, which would have added them for map import as well. Was a while ago, but for completions sake: https://forum.simutrans.com/index.php/topic,15049.0.html
How much nostalgia .  ::'(

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 10305
  • Languages: De,EN,JP
Re: [request] map generation from png image
« Reply #3 on: January 20, 2020, 03:34:18 AM »
That patch was never finished unfortunately, it had issues with the water line etc. Adding PNG reading support would be easy, but then those must be lossless compressed PNG. Otherwise the nosie will do strange things around hills and river.

About size, a BMP 256 color (greyscale) can be compressed by RLE, and then is quite small.

Offline Freahk

  • Devotee
  • *
  • Posts: 1357
  • Languages: DE, EN
Re: [request] map generation from png image
« Reply #4 on: January 20, 2020, 03:47:21 AM »
png is by definition either uncompressed or lossless compressed.

For sure one can use some special techniques like reducing the number of colors in an image to allow for better compression rates but this is not part of the png specification.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 10305
  • Languages: De,EN,JP
Re: [request] map generation from png image
« Reply #5 on: January 21, 2020, 12:27:49 AM »
Ok, indeed, my error.