ppmfile is the name of the PPM file you wish to convert. ppmfile can be ’-’ to indicate that the stdin should be read in order to facilitate the use of ppmtocri as part of a UNIX pipe. crifile Is the name of the CRI file to be created. If crifile already exists ppmtocri does NOT ask for permission to overwrite it. The options all effect that way that color palettes are used in the conversion process, and are described below.
Here is the basic flow of the ppmtocri program. If no options are given, ppmtocri first tries to do the conversion using the default VVSP palette. If it cannot get an exact match for all the colors in the PPM file using the default palette, it tries to create a new palette (256 entries). If it can’t create a new palette that will fully realize the colors in PPM file (even after reducing each primary to the range 0-63), then it reverts to the default palette and uses a euclidean distance to find the closest color from the default palette for each pixel. The following options can be used:
You have 3 PPM files that you would like
to convert to CRI files, and you would like them all to use the same palette
file, colors.pal, which you have previously created with editvpal. The PPM
files are called desk.ppm, sofa.ppm, and chair.ppm. You would run ppmtocri
like this: ppmtocri desk.ppm desk.cri -usepal colors.pal
ppmtocri sofa.ppm sofa.cri -usepal colors.pal
ppmtocri chair.ppm chairdesk.cri -usepal colors.pal
You have a JPEG file called pict1.jpg that you would like to convert into
a CRI file. You want to create a palette file for the new CRI file and
call it pict1.pal. To do this, use the djpeg(1)
program to first convert
the JPEG file into a PPM file, and then convert the PPM file into a CRI
file. This can be done with a UNIX pipe. Note that the djpeg(1)
program
has an option for reducing the number of colors during the translation
to PPM format. Your command would look like this:
djpeg -colors 256 < pict1.jpg | ppmtocri - pict1.cri -palname pict1.pal