📄 readme
字号:
PngMinus--------(copyright Willem van Schaik, 1999)License-------Permission to use, copy, modify, and distribute this software andits documentation for any purpose and without fee is hereby granted,provided that the above copyright notice appear in all copies andthat both that copyright notice and this permission notice appear insupporting documentation. This software is provided "as is" withoutexpress or implied warranty.Some history------------Soon after the creation of PNG in 1995, the need was felt for a set ofpnmtopng / pngtopnm utilities. Independantly Alexander Lehmann and I(Willem van Schaik) started such a project. Luckily we discovered thisand merged the two together into pnmtopng.tar.gz, which is availablefrom a/o ftp://ftp.simplesystems.org/pub/libpng/png/.These two utilities have many, many options and make use of most of thefeatures of PNG, like gamma, alpha, sbit, text-chunks, etc. This makesthe utilities quite complex and by now not anymore very maintainable.When we wrote these programs, libpng was still in an early stage.Therefore, lots of the functionality that we put in our software can nowbe done using transform-functions in libpng.Finally, to compile these programs, you need to have installed andcompiled three libraries: libpng, zlib and netpbm. Especially the lattermakes the whole setup a bit bulky. But that's unavoidable given the manyfeatures of pnmtopng.What now--------At this moment libpng is in a very stable state and can do much of thework done in pnmtopng. Also, pnmtopng needs to be upgraded to the newinterface of libpng. Hence, it is time for a rewrite from the ground upof pnmtopng and pngtopnm. This will happen in the near future (staytuned). The new package will get a different name to distinguish it fromthe old one: PngPlus.To experiment a bit with the new interface of libpng, I started off witha small prototype that contains only the basic functionality. It doesn'thave any of the options to read or write special chunks and it will dono gamma correction. But this makes it also a simple program that isquite easy to understand and can serve well as a template for othersoftware developments. (By now there are of course a couple of programs,like Greg Roelofs' rpng/wpng, that can be used just as good.)Can and can not---------------As this is the small brother of the future PngPlus, I called this fellowPngMinus. Because I started this development in good-old Turbo-C, Iavoided the use the netpbm library, which requires DOS extenders. Again,another reason to call it PngMinus (minus netpbm :-). So, part of theprogram are some elementary routines to read / write pgm- and ppm-files.It does not read b&w pbm-files.The downside of this approach is that you can not use them on imagesthat require blocks of memory bigger than 64k (the DOS version). Forlarger images you will get an out-of-memory error.As said before, PngMinus doesn't correct for gamma. When readingpng-files you can do this just as well by piping the output of png2pnmto pnmgamma, one of the standard PbmPlus tools. This same scenario willmost probably also be followed in the full-blown future PngPlus, withthe addition of course of the possibility to create gamma-chunks whenwriting png-files.On the other hand it supports alpha-channels. When reading a png-imageyou can write the alpha-channel into a pgm-file. And when creating anRGB+A png-image, you just combine a ppm-file with a correspondingpgm-file containing the alpha-channel. When reading, transparency chunksare converted into an alpha-channel and from there on treated the sameway.Finally you can opt for writing ascii or binary pgm- and ppm-files. Whenthe bit-depth is 16, the format will always be ascii.Using it--------To distinguish them from pnmtopng and PngPlus, the utilities are namedpng2pnm and pnm2png (2 instead of to). The input- and output-files canbe given as parameters or through redirection. Therefore the programscan be part of a pipe.To list the options type "png2pnm -h" or "pnm2png -h".Just like Scandinavian furniture--------------------------------You have to put it together yourself. I did test the software underMS-DOS with Turbo-C 3.0 and under RedHat Linux 4.2 with gcc. In bothcases I used libpng-1.0.4 and zlib-1.1.3. Later versions should be OK,however some older libpng versions have a bug in pngmem.c when usingTurbo-C 3.0 (see below).You can build it using one of the two makefiles (make -f makefile.###)or use the batch/script files pngminus.bat / pngminus.sh. This assumesthat you have built the libraries in ../libpng and ../zlib. Using Linux,make sure that you have built libpng with makefile.std and notmakefile.linux (also called .lnx in earlier versions of libpng). Thelatter creates a .so shared-library, while the PngMinus makefile assumesa normal .a static library.If you create a ../pngsuite directory and then store the basn####.pngfiles from PngSuite (http://www.schaik.com/pngsuite/) in there, you cantest in one go the proper functioning of PngMinus, see png2pnm.bat andpnm2png.bat (or the .sh versions).Warranty-------Please, remember that this was just a small experiment to learn a fewthings. It will have many unforeseen features <vbg>. Who said bugs? Useit when you are in need for something simple or when you want to startdeveloping your own stuff.The Turbo bug-------------** pngmem.old hptr = (png_byte huge *)((long)(hptr) & 0xfffffff0L); hptr += 16L;** pngmem.c hptr = (png_byte huge *)((long)(hptr) & 0xfffffff0L); hptr = hptr + 16L;**** pngmem.old png_ptr->offset_table_ptr[i] = (png_bytep)hptr; hptr += (png_uint_32)65536L;** pngmem.c png_ptr->offset_table_ptr[i] = (png_bytep)hptr; hptr = hptr + 65536L;**The end-------Willem van Schaikmailto:willem@schaik.comhttp://www.schaik.com/png/-------Oct 1999
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -