Short: Utility to convert ppm images to .info files. Author: mheinz@ssw.com (Michael Heinz) Uploader: mheinz ssw com (Michael Heinz) Architecture: m68k-amigaos Keywords: amiga graphics workbench icon, info, ppm + This utility converts ppm images to .info files. COPYRIGHT COPYRIGHT 1994 Michael W. Heinz, Sr. All Rights Reserved. This application is freely distributable, provided that all documentation is included. NOTES Introduction: One of my all time favorite utilities was "iconize". Written in 1990, iconize would read an ILBM image and scale it into an Amiga WB icon. Unfortunately, it only used one palette - and if your WB didn't use it, the icons would look very strange. I'm also a big fan of the PBM/PPM set of tools. These tools, written for UNIX systems are easily ported to the Amiga and provide some powerful image conversion and processing tools, even if they have absolutely no user interface. Combining these two ideas, I came up with PPMTOINFO. PPMTOINFO converts a PPM formatted image into a WorkBench icon file. For it to be useful, you will also need the ppm tools (the latest version is called "netpbm" and can be found on the aminet.) Usage: ppmtoinfo [-tool {default tool}] 0[-tooltype {tool type}]10 -map {mapfile} -icon {iconfile} [{ppmfile}] In it's simplest form, ppmtoinfo takes three arguments - the name of the ppm file to convert, the name of the ppm file holding the palette and the name of the icon to create. (.info will be added to the name automagically.) If -tool is provided, it will be used to set the default tool of the icon. If one or more -tooltype records are provided, they can be used to set the tool types of the icon. Up to 10 -tooltype records are supported. The ppmfile (the image to be converted) should be in the P6 format used by standard ppm commands. It should be scaled to the desired size of the icon, because the icon will be the same size as the original image. If the ppmfile is not specified in the command line, it will be read from the standard input. This conforms to the usual operation of a PPM utility. The map file is needed because all PPM images are "true color" - they don't use palettes. The map file is defined in the P3 format and shows the palette, 1 pixel per color. For example, here is the palette for a standard MagicWB arrangement: P3 8 1 255 144 144 144 0 0 0 240 240 240 80 112 160 128 128 128 160 160 160 160 144 128 224 160 144 Notice that the colors go from 0 to 255, rather than from 0 to 16. Just multiply your regular palette by 16. Note also that the palette must include every color present in the original image. ppmtoinfo makes no attempt to dither or remap the original image - it just translates it into a .info file. (You'll see why in a minute.) Typically, you will use this tool in combination with other ppm utilities and tools (For example, djpeg converts jpg images to ppm format.) So say I wanted to create an icon for a jpg file called "dragonglass". I would perform the following steps: 1. Convert the jpg to a ppm file: djpeg dragonglass.jpg dg.ppm 2. Scale the ppm file to icon size: pnmsize -xsize 64 dg.ppm >small.ppm (note that I only specify the size in the x axis. This allows pnmsize to scale the y axis mathematically to give the icon the same appearance as the original image.) 3. Recolor the ppm file to match your WorkBench: ppmquant -fs -map wb_map.ppm small.ppm >icon.ppm 4. Convert the ppm file to an icon: ppmtoinfo pipe:mi_a run pnmscale >pipe:mi_b -xsize 64 pipe:mi_a run ppmquant >pipe:mi_c -fs -map pbm:wb_map.ppm pipe:mi_b ppmtoinfo