stdin for ppm?

Discussions on NConvert - the command line tool for image conversion and manipulation

Moderators: XnTriq, helmut, xnview

roytam1
Posts: 18
Joined: Sat Sep 23, 2006 2:24 am

Post by roytam1 »

Anonymous wrote:Being a longstanding developer and co-author of the 3D space simulation Celestia

http://www.shatters.net/celestia/

I first of all want to express our strong interest in NConvert. As Joerg mentioned above, I have been writing a set of dedicated, cross-platform tools (in C++ ) specialized in generating HUGE planetary textures (~10 GB each ;-) ) of highest quality directly from the published scientific data, cutting these into tiles etc.

http://www.celestialmatters.org/cm/index.shtml
http://www.celestialmatters.org/cm/host ... s/nmtools/

Besides my nmtools for normalmap generation, there is now a complementary set, my txtools, that perform analogous tasks for base and specular textures, do high-quality DXT1..3 and notably DXT5nm compression and many other specialized tasks, like mounting RGB + A -> RGBA etc.

NConvert would be a great format conversion tool for us, except it has substantial weaknesses where I need it to be VERY strong ;-)

-- I need perfect operation wrto STDIN/STDOUT such that nconvert may be piped together with my other tools.

-- I need optimized dynamic memory management, since we start to work with texture sizes, where other tools hopelessly give up.

-- among the strongest weakness of nconvert is the lack of fast AND high-quality DXT compression for ALL standard flavors, DXT1..3 and notably DXT5nm. The latter being a highly quality optimized DXT5 (RGBA) format specialized to normalmap compression, which has to be of very high smoothness. It was invented by NVIDIA.

As Joerg emphasized already, nconvert only works partially OK with STDIN, also depending on the OS. Take any .ppm RGB texture, for example

and do the simplest possible STDIN action:

nconvert -o test.png stdin < file.ppm

This works in Linux, but NOT under windows XP. In my tools I use the following code to make them work perfectly under STDIN/STDOUT

Code: Select all

   	#ifdef _WIN32
		if (_setmode(_fileno(stdin), _O_BINARY) == -1 )
    	{
    		cerr<<"Binary read mode from STDIN failed\n";
    		return 1;
    	}

		if (_setmode(_fileno(stdout), _O_BINARY) == -1 )
    	{
    		cerr<<"Binary write mode via STDOUT failed\n";
    		return 1;
    	}
   	#endif
Also I am told by my OSX-friends that nconvert is quite buggy on MACS...This I can't test myself, but since we always work totally cross-platform, we would need stable performance under MAC-universal (PPC & Intel Macs)

Bye Fridger
*bump* for +1 of this code change.
As nconvert writes unnecessary CR+LF to STDOUT now.
Post Reply