PhotoPnMTools - Toolset for postprocessing photographic images, based on PPM. Release $Name: rel-1-3-0 $, Version 1.3 Copyright (c) 2002, 2003 by B.W. van Schooten. All rights reserved. This software is distributed under the Perl Artistic License. No warranty. See file 'artistic.license' for more details. Email: boris@13thmonkey.org WWW: www.13thmonkey.org/~boris/photopnmtools/ ------------------------- The tools in this package ------------------------- The tools give help information and a list of switches when poked. You can find some theory and test images on the Web site. When you want increased numerical precision, convert images to 16 bits using pnmdepth before doing operations on them, and preferably use a depth-decreasing tool that dithers to convert them back to 8 bits, such as pnmdither. Unfortunately, pnmdither is not very suitable for very large images, then you can use pnmdepth instead. pnmconvolve - blur and sharpen images Supports convolution blurring and sharpening, including some special noise and artifact reduction switches. Also supports unsharp mask sharpening. ppmhsy - do colour editing operations Has a bunch of switches for changing the colour characteristics of an image. The options are similar to other image processing tools, but, instead of the usual HLS model, it uses a new model, the HSY model, which gives better colours and less noise. A few options need some explanation. Noise dampening is useful when brightening near-black areas. Here, you will see saturated colour patches appear in the blacks: an amplification of noise in the picture. You can reduce this noise by using a little noise dampening, which makes the near-black areas greyish. Whitening adds extra white in case the R, G, or B value of a pixel is amplified beyond the maximum value, emulating overexposure. While the default of 1 is the most mathematically sound, values less than 1 may be used as a cheap kind of highlights compression. If you get white areas, tweaking this may help some. Highlights expansion is meant for restoring overexposed areas. What it does is increase contrast in the brightest 10% of the image, so that any details that may still be there are emphasised, and the highlights look less `blown out'. pnmresample - shrink or enlarge image Uses anti-aliasing for shrinking, and sync interpolation for enlarging. pnmdiff - calculate difference between images Can be used to calculate changes made by a filter, or errors (such as jpeg error). pnmdft - transform to and from Discrete Fourier Transform A little experiment, because I wanted to see what the DFT of an image looks like. It may be useful if you want to do operations in the DFT space. The real value is stored in the red channel, and the imaginary in the green channel. If you use 16-bits logarithmic output, you can transform the DFT back to the original image with (almost) no loss. hsyfringes - remove blue/purple fringes from photo In a digital camera image, you typically find blue or purple fringes around contrasty areas. Particularly critical areas are tree tops against the sky. With this tool, you select a rectangular area in which a colour of your choice will be reduced, given certain conditions. This tool has only been used on a few images and needs further tweaking. It may be useful to some though. ppmtestimage - generate test image for printing Since different printers give different results, you may want to find out what your favourite print service does so you can preprocess your images appropriately. Colours are often subtly different, but there are some other things I ran into: - brightness clipping. The luminance range of paper is considered less than that of the screen. So, the brightest areas in your picture are likely to be made white. So, in your print you may lose some highlights and get overexposed areas instead! Some printers are even more simplistic, and just clip the individual R, G, and B values above a certain maximum value. Ensure that your image does not contain such areas. The test image contains colour patches with sine patterns in them, which can be used to detect brightness clipping behaviour. If brightness or the R,G,B values are clipped, you will see the sine patterns disappear. - interpolation. Even while your print service may specify ideal image sizes, some printers do interpolate even those images (using bilinear or similar interpolation). The test image contains striped patterns in different resolutions which will easily show if the finest details come out well, and if moire and other effects occur. - cropping. Typical printers crop your images, even if they say they don't. The rectangles surrounding the test patterns can be used to measure cropping behaviour. The rectangles are spaced 20 pixels apart. pnmnormalise - normalise picture for making photographed text printable. Use to convert photos of printed text and other stuff to appropriately thresholded postscript files. It is still a bit rough, as plain areas may turn out as patches of noise. After this normalisation, set brightness and contrast to ensure that the paper is white and the text is black. I used it in combinations with some manual editing with good results. ppmlevels - levels tool for renormalising brightness. Can be used to scale the red, green, and blue channels to fit the entire range. Default is automatic. The upper and lower percentiles that should become the black and bright ends of R, G, and B can be set. In manual mode, the upper and lower pixel value of R, G, and B can be set directly. pnmsharpness - check sharpness of a picture. Can be used to determine relative sharpness of near-identical pictures. Can produce either a summary value or a map showing local sharpness for each pixel. comparesharpness.pl - compare sharpness of multiple pictures. PhotoProc - interactive photo editing. Requires Java 1.2. This program is still a bit primitive, but it works for me. You can crop and colour-edit your image using the sliders and buttons. There are two preview windows: one for cropping and one for colour editing. You can crop by using the sliders or by selecting the top left or bottom right corner of the crop by resp. the left and right mouse button. In the colour edit window, you can view the pixel value of a pixel by clicking on it. The colour edit settings are inherited from ppmhsy and pnmlevels, see the documentation above. When you are finished, click DONE, and your settings will be saved in a .sh script, which can then be executed to generate the image. This means no disk space is needed to store the manipulated image. Before running this program, ensure that the photopnmtools are in your path (i.e. export PATH=$PATH:`pwd` when in photopnmtools directory). makephotoalbum.pl - generate HTML photo album from a set of .sh scripts. Requires perl5, and the jhead EXIF-reader tool in case EXIF JPEGs are used as input. It can be used to quickly generate a photo album from raw camera output, or generate a photo album of postprocessed images. Usage: Make a new directory, copy your image-generating .sh scripts there (typically these are the .sh scripts generated by PhotoProc), and then run makephotoalbum with as arguments the .sh files plus any JPEGs. The .sh output, plus the JPEGs, rotated according to the EXIF rotation field, form the material for the album. A number of thumbnail indexes named `album-.html' are created, along with screen-sized images. The screen-sized images are wrapped in HTML pages, creating an appropriate frame around them. The program uses defaults that work for me, edit the source to change the settings. A nice scheme is to copy the program into the album directory and then edit it to obtain proper settings with that particular album. getexifrotation.pl - read rotation value from EXIF field. A little wrapper that is useful for some other programs. Requires jhead (http://www.sentex.net/~mwandel/jhead/).