Menu

LEX File Exchange
EA Support Files
SC4 Wikipedia
Network Addon Mod
Dependencies
Chat

Author Topic: importing 16bit png file  (Read 4456 times)

0 Members and 1 Guest are viewing this topic.

Offline SchlauFuchs

  • Forums Inhabitant
  • *
  • Posts: 4
  • Total likes: 0
  • Reputation: 0
  • Your slogan here
importing 16bit png file
« on: November 15, 2012, 01:41:36 AM »
Hello,

I'm trying to use the import 16bit png function from sc4 mapper. I used a geotiff elevation data file, transformed it to png16 but the result didn't seem right in mapper. I wrote a little java image processor to produce a png16 following some specs from other forums (16 bit unsigned, .1 precision, 0 = -250m )  and produced a png that looks pretty black. SC4 mapper accepts it but the result looks like the the scenery of a bad Kevin Costner movie. Is there any sourcecode available to test this things out and to locate the issue?

Or does anyone have contact details if the creator?

Cheers,
Kai

Offline cogeo

  • NAM Team
  • Forums Parliamentarian
  • *
  • Posts: 1160
  • Total likes: 38
  • Reputation: 18
  • CL:
    SC4 Station Master
Re: importing 16bit png file
« Reply #1 on: November 15, 2012, 02:14:46 AM »
Welcome to SC4D!

The format "specs" you mention are right. For example, a 20m elevation would be represented as a (gray) value of 20x10 + 250x10 = 2700 (convert this to 16-bit int). So if your code is OK, play with the png format options if any, eg compression, planar configuration maybe, or that little/big endian thingy. Also check for implicit conversions carried-out by java itself.

SC4TF/M were written in Python, while for the 16-bit PNGs an "external image library" was used, the creator said.

Offline SchlauFuchs

  • Forums Inhabitant
  • *
  • Posts: 4
  • Total likes: 0
  • Reputation: 0
  • Your slogan here
Re: importing 16bit png file
« Reply #2 on: November 15, 2012, 03:09:04 AM »
Hi,

I got a good step forward, there was a bug in my solution and the next try produced a nice region. I have to fine-tune my geotiff a bit because there is currently everything a tiny bit too high but then this could be declared as something useful for more SC4 fans.