README.txt 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. PngMinus
  2. --------
  3. (copyright Willem van Schaik, 1999-2019)
  4. Some history
  5. ------------
  6. Soon after the creation of PNG in 1995, the need was felt for a set of
  7. pnmtopng / pngtopnm utilities. Independently Alexander Lehmann and I
  8. (Willem van Schaik) started such a project. Luckily we discovered this
  9. and merged the two, which later became part of NetPBM, available from
  10. SourceForge.
  11. These two utilities have many, many options and make use of most of the
  12. features of PNG, like gamma, alpha, sbit, text-chunks, etc. This makes
  13. the utilities quite complex and by now not anymore very maintainable.
  14. When we wrote these programs, libpng was still in an early stage.
  15. Therefore, lots of the functionality that we put in our software can now
  16. be done using transform-functions in libpng.
  17. Finally, to compile these programs, you need to have installed and
  18. compiled three libraries: libpng, zlib and netpbm. Especially the latter
  19. makes the whole setup a bit bulky. But that's unavoidable given the many
  20. features of pnmtopng.
  21. What now (1999)
  22. ---------------
  23. At this moment libpng is in a very stable state and can do much of the
  24. work done in pnmtopng. Also, pnmtopng needs to be upgraded to the new
  25. interface of libpng. Hence, it is time for a rewrite from the ground up
  26. of pnmtopng and pngtopnm. This will happen in the near future (stay
  27. tuned). The new package will get a different name to distinguish it from
  28. the old one: PngPlus.
  29. To experiment a bit with the new interface of libpng, I started off with
  30. a small prototype that contains only the basic functionality. It doesn't
  31. have any of the options to read or write special chunks and it will do
  32. no gamma correction. But this makes it also a simple program that is
  33. quite easy to understand and can serve well as a template for other
  34. software developments. By now there are of course a couple of programs,
  35. like Greg Roelofs' rpng/wpng, that can be used just as good.
  36. Can and can not
  37. ---------------
  38. As this is the small brother of the future PngPlus, I called this fellow
  39. PngMinus. Because I started this development in good-old Turbo-C, I
  40. avoided the use the netpbm library, which requires DOS extenders. Again,
  41. another reason to call it PngMinus (minus netpbm :-). So, part of the
  42. program are some elementary routines to read / write pgm- and ppm-files.
  43. It does not handle B&W pbm-files, but instead you could do pgm with bit-
  44. depth 1.
  45. The downside of this approach is that you can not use them on images
  46. that require blocks of memory bigger than 64k (the DOS version). For
  47. larger images you will get an out-of-memory error.
  48. As said before, PngMinus doesn't correct for gamma. When reading
  49. png-files you can do this just as well by piping the output of png2pnm
  50. to pnmgamma, one of the standard PbmPlus tools. This same scenario will
  51. most probably also be followed in the full-blown future PngPlus, with
  52. the addition of course of the possibility to create gamma-chunks when
  53. writing png-files.
  54. On the other hand it supports alpha-channels. When reading a png-image
  55. you can write the alpha-channel into a pgm-file. And when creating an
  56. RGB+A png-image, you just combine a ppm-file with a corresponding
  57. pgm-file containing the alpha-channel. When reading, transparency chunks
  58. are converted into an alpha-channel and from there on treated the same
  59. way.
  60. Finally you can opt for writing ascii or binary pgm- and ppm-files. When
  61. the bit-depth is 16, the format will always be ascii.
  62. Using it
  63. --------
  64. To distinguish them from pnmtopng and PngPlus, the utilities are named
  65. png2pnm and pnm2png (2 instead of to). The input- and output-files can
  66. be given as parameters or through redirection. Therefore the programs
  67. can be part of a pipe.
  68. To list the options type "png2pnm -h" or "pnm2png -h".
  69. Just like Scandinavian furniture
  70. --------------------------------
  71. You have to put it together yourself. I developed the software on MS-DOS
  72. with Turbo-C 3.0 and RedHat Linux 4.2 with gcc. In both cases I used
  73. libpng-1.0.4 and zlib-1.1.3. By now (2019) it is twenty years later and
  74. more current versions are OK.
  75. The makefile assumes that the libpng libraries can be found in ../.. and
  76. libz in ../../../zlib. But you can change this to for example ../libpng
  77. and ../zlib. The makefile creates two versions of each program, one with
  78. static library support and the other using shared libraries.
  79. If you create a ../pngsuite directory and then store the basn####.png
  80. files from PngSuite (http://www.schaik.com/pngsuite/) in there, you can
  81. test the proper functioning of PngMinus by running pngminus.sh.
  82. Warranty
  83. -------
  84. Please, remember that this was just a small experiment to learn a few
  85. things. It will have many unforeseen features <vbg> ... who said bugs? Use
  86. it when you are in need for something simple or when you want a starting
  87. point for developing your own stuff.
  88. The end
  89. -------
  90. Willem van Schaik
  91. mailto:willem at schaik dot com
  92. http://www.schaik.com/png/
  93. Oct 1999, Jan 2019