|PNM/PAM to PNG image converter|
|Pnmtopng / Pngtopnm|
|Pnmtopng / pngtopnm was what everything started with. Co-developed by Alex Lehmann and Willem van Schaik (me :-) in 1995, it enables, through the conversion to/from PbmPlus files, the support of nearly any graphics format on the planet. At the same time, pnmtopng was in the early days of PNG one of the better optimized converters, resulting in well compressed PNG files. Originally developed on Unix, it requires netpbm, libpng and zlib to be built.|
After the development of the initial pnmtopng/pngtopnm programs, twenty plus years ago by Alex
and myself, many people contributed to the code of the two programs.
Which resulted in doubling the code base and a substantial increase in complexity of the software.
When pnmtopng/pngtopnm was written, NetPBM didn't have a format to support alpha channel transparency. Since then that has changed, it's called the PAM format. Which supports any number of channels, not necessarily only alpha, but RGBA is most common. So pnmtopng had to make place for a new pamtopng. I hesitated for years to bite that bullet, but in 2015 I took it on. In the end it was easier than expected.
The original pnmtopng was very focussed on reducing the file-size of the resulting PNG image. Lots of clever tricks to compress the image further. Today, CPUs are fast and there is plenty of memory. Therefore 60% of the command-line options could be dropped. And the codebase went back to a quarter of what it had become. Check out Source Forge for the man-page showing the reduced feature set.
The new pamtopng tool will slowly become part of standard Linux distro's. It is included in Fedora, but not yet in RedHat/CentOS or Ubuntu. So depending on your distro, you'll maybe have to download the source code and compile it yourself.
Before I developed the new pamtopng, I was in an urgent need for a tool that supported pam images.
Because of that, I wrote a quick and dirty pam2png tool, using the sources from pnm2png in PngMinus.
This was a stop-gap solution, but if you simply wanted to convert RGBA or GrayAlpha pam images to PNG it did the job.
Download the pam2png tar-ball, which contains both source code and a Linux binary.
|Windows / MS-DOS executables|
For those of you that run on Windows/DOS, problem with the PbmPlus tools has always been that netpbm
never got ported to DOS, Windows or NT. So, you can not build the program using Borland's
compiler or Visual-C.
However, using the gnuwin libraries, you can now compile pnmtopng and pngtopnm to a
Windows command-line utility. If you just want the executables, download the
zip-file and you are ready to go.
An older variant was the built Alex did with DJGPP, relying on DPMI as a DOS extender. Just grab the package and unzip it. Notice the cwsdmpi.exe executable, which must be in the current directory or in your PATH. Run pnmtopng.exe / pngtopnm.exe in an MS-DOS box or after rebooting in DOS.
|Pnm2png / Png2pnm|
As said, pnmtopng requires PbmPlus / Netpbm to be built. And not everybody wants to or is able to
get that library in shape.
Also, libpng and zlib are available on more platforms than netpbm.
Therefore I wrote PngMinus, with the pnm2png and png2pnm converter utilities,
that has built-in functions to read ppm/pgm/pbm files.
But it is more limited related to the size of the files it can handle.
The package comes with build scripts to compile PngMinus on Linux using gcc or on MS-DOS using Borland's Turbo-C 3.0. And on Windows you can compile it using Visual-C. You can download the sources from this site, but the package is also included with libpng, where you will find it in the "contrib" folder.
For those who just want some MS-DOS binaries, this zip-file contains two executables that also run fine in a Windows DOS-box. I have also included two libpng and zlib library files, precompiled for the MS-DOS platform. With the two zip-files together, you are all set to go without the need for any other packages.