AminetAminet
Search:
84450 packages online
About
Recent
Browse
Search
Upload
Setup
Services

gfx/pbm/ppmtoinfo.lha

Mirror:Random
Showing:i386-arosgeneric
No screenshot available
Short:Utility to convert ppm images to .info files.
Author:mheinz at ssw.com (Michael Heinz)
Uploader:mheinz ssw com (Michael Heinz)
Architecture:m68k-amigaos
Keywords:amiga graphics workbench icon, info, ppm
Date:1994-02-07
Download:http://aminet.net/gfx/pbm/ppmtoinfo.lha - View contents
Readme:http://aminet.net/gfx/pbm/ppmtoinfo.readme
Downloads:3907

+ 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 <icon.ppm -map wb_map.ppm -icon DragonGlass.jpg \
                        -tool RetinaDisplay

	The result will be a new icon called "DragonGlass.jpg.info".  Note that
	the palette file used in step 4 is the same one used to re-color the
	image in step 3.  This is why ppmtoinfo doesn't provide built-in 
	recoloring or dithering capabilities - ppmquant already does an
	excellent job.

	To simplify the conversion process, you can use the following script,
	which converts iff images to icons of the same name:

	MAKEICON
	
    .key file/a,opt/f
    .bra {
    .ket }

    echo "Converting {file} to an icon.  Opts: {opt}"
    run ilbmtoppm "{file}" >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 <pipe:mi_c {opt} -map pbm:wb_map.ppm -icon "{file}" 

    You can use the "SPAT" script (found in your s: directory) to automatically
    build icons for all the images in a directory.  For example:
    
    SPAT makeicon ~(#?.info) -tool RetinaDisplay
    
DISCLAIMER

	Works on my machine!

Michael Heinz
(mheinz at ssw.com)




Contents of gfx/pbm/ppmtoinfo.lha
 PERMSSN    UID  GID    PACKED    SIZE  RATIO     CRC       STAMP          NAME
---------- ----------- ------- ------- ------ ---------- ------------ -------------
drwxr-xr-x   602/202         0       0 ****** -lhd- 0000              ppmtoinfo/
-rw-r--r--   602/202        40      40 100.0% -lh0- d30e              ppmtoinfo/.info
-rw-r--r--   602/202        56      56 100.0% -lh0- 7514              ppmtoinfo/Touch
-rw-r--r--   602/202       808    1577  51.2% -lh5- 75a6              ppmtoinfo/Touch.info
-rw-r--r--   602/202      1013    1429  70.9% -lh5- 8e3f              ppmtoinfo/build.info
-rw-r--r--   602/202      2471    3700  66.8% -lh5- ee2c              ppmtoinfo/debug
-rw-r--r--   602/202       667    1531  43.6% -lh5- 8314              ppmtoinfo/debug.info
-rw-r--r--   602/202       552    1537  35.9% -lh5- 1695              ppmtoinfo/lse.info
-rw-r--r--   602/202       171     282  60.6% -lh5- 2848              ppmtoinfo/makeicon
-rw-r--r--   602/202       496    1537  32.3% -lh5- 6c78              ppmtoinfo/makeicon.info
-rw-r--r--   602/202       369    1552  23.8% -lh5- 8e99              ppmtoinfo/options.info
-rw-r--r--   602/202     12381   21164  58.5% -lh5- 2a89              ppmtoinfo/ppmtoinfo
-rw-r--r--   602/202      2856    8196  34.8% -lh5- 32c2              ppmtoinfo/ppmtoinfo.c
-rw-r--r--   602/202       496    1537  32.3% -lh5- 5b23              ppmtoinfo/ppmtoinfo.c.info
-rw-r--r--   602/202      2030    4407  46.1% -lh5- 724c              ppmtoinfo/ppmtoinfo.doc
-rw-r--r--   602/202       495    1537  32.2% -lh5- cd8e              ppmtoinfo/ppmtoinfo.doc.info
-rw-r--r--   602/202       880    1464  60.1% -lh5- bd18              ppmtoinfo/ppmtoinfo.info
-rw-r--r--   602/202       104     135  77.0% -lh5- c88b              ppmtoinfo/ppmtoinfo.lnk
-rw-r--r--   602/202        77     100  77.0% -lh5- fe7e              ppmtoinfo/sascopts
-rw-r--r--   602/202        55     101  54.5% -lh5- 98db              ppmtoinfo/wb_map.ppm
-rw-r--r--   602/202      2177    4774  45.6% -lh5- 1212              ppmtoinfo.readme
---------- ----------- ------- ------- ------ ---------- ------------ -------------
 Total        21 files   28194   56656  49.8%            Feb  7  1994

Aminet © 1992-2024 Urban Müller and the Aminet team. Aminet contact address: <aminetaminet net>