This tool is built to extract a rectangle region of png file. I want to publish iphone apps, and appstore asks developer to provide 320x460 screenshots, but my hand can not be always so precise, so my method is, use command-shift-4 to grab a region that is bigger than the screen of iphone simulator, then use pngcrop to help me generate the desired image. For example,
./pngcrop Default.png 0 20 320 460 out.png
To compile this program, you need to make sure your system have libpng installed. If you are using linux or Mac OS X, then it is probably already installed.
This program is also a good example of how to use libpng to read and write png files.
Any bugs or code defects, please feel free to let me know.