home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / windows / picl182.zip / PICLAB.DOC next >
Text File  |  1990-03-26  |  39KB  |  1,077 lines

  1. PICLAB.DOC
  2. March 23, 1990
  3.  
  4. Piclab 1.81 is a public domain image processing program by Lee
  5. Daniel Crocker and the Stone Soup Group.  It should be distributed
  6. with the following files:
  7.  
  8. PL.EXE          The program itself.
  9. PL286.EXE        Faster, smaller version for 286 (and up) machines.
  10. PL.HLP          Text file for the HELP command.
  11. PICLAB.DOC      This file.
  12. V2E             VGA-to-EGA conversion program.
  13.  
  14. If you are missing one or more of these files, contact the author
  15. at one of the addresses listed at the end of this document.
  16.  
  17.  
  18.  
  19. Overview
  20. ========
  21.  
  22. Piclab operates on "images", so I will begin by explaining exactly
  23. what an image is and how Piclab classifies them.
  24.  
  25. For our purposes, an image is a data set that describes
  26. the reflectance of a 2-dimensional surface such as a photograph.  In
  27. particular, an image is a 2-dimensional array of "pixels" (a short
  28. form of "picture elements"), each of which contains data for the
  29. small rectangular area of the image it represents.
  30.  
  31. There are many systems in which image data represents "objects"
  32. rather than pixels.  PostScript is probably the most notable example. 
  33. The commands sent to a PostScript device tell it to draw lines or
  34. boxes or characters and let the device decide how it will perform the
  35. commands it gets.  Piclab does not deal with object-based images or
  36. devices.
  37.  
  38. Image data comes in several flavors, and while all are related in
  39. many ways, there are distinctions important to keep in mind.  I will
  40. divide image data into four classes: bitmapped, grayscale,
  41. golor-mapped, and true-color.  In all of these formats an image is
  42. represented as a rectangular array of pixels, each of which may
  43. contain some value.
  44.  
  45. Bitmapped images are collections of on/off dots.  That is, each pixel
  46. can be either "on" or "off", with no states in between.  This type of
  47. image can be displayed on just about any type of computer and is
  48. especially suited to printer output.  The disadvantages are the
  49. inability to represent color, and the lack of detail.  With large
  50. bitmapped images, one can get a surprising amount of detail by
  51. simulating shades of gray by dot patterns.  This process, called
  52. halftoning, is used by newspapers to print photographs.
  53.  
  54. At this time, Piclab does not deal directly with bitmapped images,
  55. although it can treat them as grayscale and can output images to
  56. bitmapped devices.
  57.  
  58. Grayscale images represent images by storing the intensity of light
  59. for each pixel on a scale of more than just on/off.  Typically, a
  60. grayscale image will allow 64 to 256 shades of gray at each pixel. 
  61. Very high quality renderings of black and white photographs can be
  62. stored in this format.
  63.  
  64. As an aside, the term "black and white" is often used to describe
  65. both bitmapped images and grayscale images.  For this reason, I will
  66. not use the term in this document.  Another common term for grayscale
  67. is "monochrome", which is often used to describe monitors that can
  68. display only shades of one color (often green or amber).
  69.  
  70. Color-mapped images are the ones most common on personal computers.
  71. Each pixel in an image is represented by a number (called an index)
  72. that is used to look up the pixel's actual color in a table (called
  73. the palette, much like an artist's palette).  These images are
  74. popular because they can be very colorful, yet take up less memory
  75. than full-color images (described next).  The size of the color
  76. palette varies among formats, but is typically 16 to 256.
  77.  
  78. True-color images are the highest quality representation, and the
  79. largest files as well.  Each pixel contains the complete color
  80. information for that pixel, usually expressed as the intensity of the
  81. red, green, and blue color components of the light at that location.
  82.  
  83. Piclab deals directly with grayscale, color-mapped and true-color
  84. images, regardless of the display capabilities of the hardware on
  85. which it is running.  In fact, Piclab can be used to enhance and
  86. print images on machines with no display at all.
  87.  
  88. I must stress that there is no connection between the images
  89. Piclab deals with and the type of display on your computer.  Piclab
  90. has a SHOW command that displays the image it is working with, but if
  91. the image is more detailed than your display can handle, Piclab will
  92. do its best to approximate the image on your display.  Regardless of
  93. what the display looks like, the image itself is always stored and
  94. operated upon in full detail.
  95.  
  96. So what's the point?  You might think that having image data more
  97. accurate than your computer can display is wasteful, but it is not. 
  98. One reason is that images get passed around to users of different
  99. machines, and the more accurate the image data, the better each
  100. machine will be able to display it.  You can also do things like
  101. print color images to a color printer even though you have no color
  102. display on your computer.  Lastly, hardware to display images as
  103. accurately as Piclab stores them does exist, and is becoming more
  104. affordable every day.  If you keep your images stored in their full
  105. accuracy, you will be better able to take advantage of any new
  106. hardware you may get.
  107.  
  108.  
  109.  
  110. General Operation
  111. =================
  112.  
  113. After starting Piclab by typing "PL" at the system command line, the
  114. user may enter any of a number of commands, each of which is
  115. performed immediately.
  116.  
  117. If you give arguments to the PL command, the first is taken as the
  118. name of a file containing Piclab commands, and the rest are treated
  119. as arguments to that program, accessed as %1, %2, etc., much like DOS
  120. batch file arguments.  This feature can be used to create programs
  121. for specific tasks.
  122.  
  123. Commands generally operate on two internal picture buffers called OLD
  124. and NEW.  Most commands start by deleting OLD and renaming NEW to
  125. OLD.  They then perform some transformation on OLD storing the result
  126. in NEW.  The command UNDO swaps NEW and OLD--effectively reversing
  127. the last operation.
  128.  
  129. OLD and NEW are stored on disk.  This decision was made primarily
  130. because my taste in pictures is better than my budget for RAM.  If
  131. you are dealing with simpler pictures, or if you have RAM to burn,
  132. you can direct Piclab to store OLD and NEW on a RAMdisk.  In MSDOS
  133. and similar operating systems, this is done by typing "SET TMP=D:" at
  134. the system command line before running Piclab, where D: is the drive
  135. or directory specification of the RAMdisk.
  136.  
  137. Piclab can read and write images in different file formats.  The LOAD
  138. command is used to read an image in one of these formats into the
  139. edit buffers.  The SAVE is used to write the contents of the edit
  140. buffers into one of these formats.  Every session with Piclab will
  141. generally begin with a LOAD, and end with a SAVE (or perhaps a PRINT)
  142. with some processing in between.  A file may be loaded from one file
  143. format and saved in a different one, thereby converting among formats.
  144.  
  145. Command parsing in Piclab is roughly like that of the system command
  146. line.  The line is broken into words that must be separated by
  147. spaces; the first word specifies the actual command and the remaining
  148. words are passed to the command handler as arguments.  The individual
  149. command-handling routines are responsible for interpreting their
  150. arguments.  Generally, a word may be shortened as long as it does not
  151. conflict with any other word in the same context. For example, the
  152. LIST COMMANDS command may be abbreviated LIS COM.
  153.  
  154. Any words in the command line that begin with the '%' character are
  155. replaced as follows: if the remainder of the word is a number, the
  156. word is replaced with the argument to the PL command in that position
  157. (starting with 0).  Otherwise, the word is replaced with the value of
  158. the DOS environment variable named by the word.  For example, here is
  159. a short Piclab program (named V2E) to convert a VGA 256-color image
  160. into an EGA 16-color image:
  161.  
  162. GLOAD %1
  163. UNMAP
  164. RESCALE 640 350
  165. EGAPAL
  166. MAP
  167. GSAVE %2
  168.  
  169. With this program in the current directory, typing "PL V2E IMG1 IMG2"
  170. will load IMG1.GIF, convert it to 16-color ega, and save that to
  171. IMG2.GIF.
  172.  
  173. Piclab has many settings that can be changed to accommodate the
  174. user's needs or environment.  From within Piclab, these are set with
  175. the SET command.  Because many of these will need to be set
  176. identically each time Piclab is run, a mechanism is proved for
  177. putting initial settings into a startup file.
  178.  
  179. This file, called SSTOOLS.INI, must be in a directory pointed to by
  180. the environment variables INIT or PATH.  It is a plain text file that
  181. contains initial settings and preferences for many of the Stone Soup
  182. tools.  Here is a sample of a typical SSTOOLS.INI file:
  183.  
  184.     [fractint]
  185.  
  186.     logmap=yes
  187.     sound=off
  188.     warn=yes
  189.  
  190.     [piclab]
  191.  
  192.     display=vga1
  193.     fileformat=gif
  194.     picdir=e:/gallery
  195.     multiimage=off
  196.     multimap=off
  197.     printfile=pd
  198.     printer=paintjet
  199.     helpfile=c:/etc/pl.hlp
  200.  
  201. Note that sections for each tool are marked by a line containing only
  202. the tool's name in square brackets.  The lines in the Piclab section
  203. can contain any variable normally set by the SET command, but note
  204. the different syntax: there is no SET, and the variable name and
  205. value are separated by an = sign rather than a space.
  206.  
  207.  
  208.  
  209. Commands
  210. ========
  211.  
  212. MAKEPAL
  213.  
  214. Syntax: MAKEPAL
  215.  
  216. Makes a palette appropriate for the NEW buffer.  Operates on only
  217. true-color images.  The variable PALETTE determines the number of
  218. colors in the new map, and the MAKEPAL command picks that many colors
  219. to best fit those in the image.
  220.  
  221. The MAP command must be used to map the image onto the palette.
  222.  
  223.  
  224. EGAPAL
  225.  
  226. Syntax: EGAPAL
  227.  
  228. Makes a 16-of-64-color palette appropriate for the NEW buffer.
  229. Operates on only true-color images.  This is designed primarily for
  230. reducing full-color images to a form better suited for display on
  231. an IBM EGA or similar device.
  232.  
  233. The MAP command must be used to map the image onto the palette.
  234.  
  235.  
  236. MAP
  237.  
  238. Syntax: MAP
  239.  
  240. Maps NEW buffer onto the current palette.  Operates only on true-color
  241. images, and produces a color-mapped image.  The variable DITHER
  242. determines whether each pixel is simply mapped onto the nearest color
  243. in the map, or whether dithering is used to achieve a more accurate
  244. mapping.  DITHER defaults to ON, and is recommended for most uses.
  245.  
  246. The MAKEPAL command should be used to create the best possible palette
  247. for the image before mapping, but any palette may be used for special
  248. purposes such as mapping several images to the same palette.
  249.  
  250.  
  251. PLOAD
  252.  
  253. Syntax: PLOAD file [offset [count]]
  254.  
  255. Loads a MAP file into the current palette.  First argument is the name
  256. of the MAP file which is assumed to be in the PICDIR directory.  If a
  257. second argument is given, the palette is loaded starting at that index.
  258. If a third argument is given, only that many colors are loaded.
  259.  
  260. MAP files are plain text files that contain the RGB values for each
  261. palette index on one line.
  262.  
  263.  
  264. PSAVE
  265.  
  266. Syntax: PSAVE file [offset [count]]
  267.  
  268. Saves a MAP file from the current palette.  First argument is the name
  269. of the MAP file which is assumed to be in the PICDIR directory.  If a
  270. second argument is given, the palette is loaded starting at that index.
  271. If a third argument is given, only that many colors are loaded.
  272.  
  273. This can be used to save a palette created with MAKEPAL so that it need
  274. not be calculated again, or so that it can be used with other images.
  275.  
  276. MAP files are plain text files that contain the RGB values for each
  277. palette index on one line.
  278.  
  279.  
  280. UNMAP
  281.  
  282. Syntax: UNMAP
  283.  
  284. Produces a true-color image from a color-mapped one.  This must be done
  285. before applying true-color transformations such as rescaling.  After
  286. transformations have been performed in true-color, the image may be
  287. reduced to a color-mapped one again with the MAKEPAL and MAP commands.
  288.  
  289.  
  290. HELP
  291.  
  292. Syntax: HELP [subject]
  293.  
  294. Looks like you have figured this one out already.
  295.  
  296.  
  297. CALL
  298.  
  299. Syntax: CALL program [args]...
  300.  
  301. Calls the external program named by its first argument passing along
  302. any subsequent arguments to that program.  Many programs do not
  303. release all of the memory given to them when they terminate, so
  304. Piclab will reserve a large portion of memory for itself before
  305. calling a program.  If you do not have much more memory than Piclab
  306. reserves, this may result in the program not being able to run in the
  307. memory left.
  308.  
  309. If this is a problem, you can use the DOS or SHELL commands to exit
  310. to DOS with all of the free memory available.
  311.  
  312.  
  313. CANCEL
  314.  
  315. Syntax: CANCEL
  316.  
  317. Cancels the most recent operation.  If there are point
  318. transformations pending that have not yet been saved with the
  319. TRANSFORM command, these are cancelled and no changes are made to the
  320. edit buffers.  Otherwise, the NEW and OLD buffers are exchanged.
  321.  
  322. There are some operations (like SAVE) that do not alter the edit
  323. buffers.  If one of these operations was the last one performed, UNDO
  324. will undo the operation before that.  No arguments.
  325.  
  326.  
  327. UNDO
  328.  
  329. Syntax: UNDO
  330.  
  331. Cancels the most recent operation.  If there are point
  332. transformations pending that have not yet been saved with the
  333. TRANSFORM command, these are cancelled and no changes are made to the
  334. edit buffers.  Otherwise, the NEW and OLD buffers are exchanged.
  335.  
  336. There are some operations (like SAVE) that do not alter the edit
  337. buffers.  If one of these operations was the last one performed, UNDO
  338. will undo the operation before that.  No arguments.
  339.  
  340.  
  341. SHELL
  342.  
  343. Syntax: SHELL [command]
  344.  
  345. Calls up the DOS command line.  All available memory is released to
  346. DOS when this command is given, and is reclaimed when DOS is exited.
  347. For this reason, some programs that cannot be CALLed may be run from
  348. with DOS.
  349.  
  350. Any arguments to this command will be passed to the system as a
  351. command line, and will cause it to return immediately after the
  352. command is done.  One particularly useful action of this program is
  353. "SHELL COPY /B PDAT PRN", which copies the print file to the printer.
  354. "SHELL DIR" can be used to view file directories when you want to see
  355. all files, not just pictures.
  356.  
  357.  
  358. DOS
  359.  
  360. Syntax: DOS [command]
  361.  
  362. Calls up the DOS command line.  All available memory is released to
  363. DOS when this command is given, and is reclaimed when DOS is exited.
  364. For this reason, some programs that cannot be CALLed may be run from
  365. with DOS.
  366.  
  367. Any arguments to this command will be passed to the system as a
  368. command line, and will cause it to return immediately after the
  369. command is done.  One particularly useful action of this program is
  370. "DOS COPY /B PDAT PRN", which copies the print file to the printer.
  371. "DOS DIR" can be used to view file directories when you want to see
  372. all files, not just pictures.
  373.  
  374.  
  375. QUIT
  376.  
  377. Syntax: QUIT [flag]
  378.  
  379. Exits Piclab.  If there is a point transformation pending, it must be
  380. cancelled or saved before exiting.  If the exit command is given any
  381. arguments, it exits immediately regardless of pending transformations.
  382.  
  383. Inside a program, QUIT merely sets a flag so that Piclab will exit after
  384. the program is complete.
  385.  
  386.  
  387. EXIT
  388.  
  389. Syntax: EXIT [flag]
  390.  
  391. Exits Piclab.  If there is a point transformation pending, it must be
  392. cancelled or saved before exiting.  If the exit command is given any
  393. arguments, it exits immediately regardless of pending transformations.
  394.  
  395. Inside a program, EXIT merely sets a flag so that Piclab will exit after
  396. the program is complete.
  397.  
  398.  
  399. LIST
  400.  
  401. Syntax: LIST [item]
  402.  
  403. If given without an argument, shows what things may can be listed.
  404. If one of these things (e.g. FORMATS, COMMANDS, BUFFERS) is given as
  405. an argument, the appropriate items are listed.  Especially useful are
  406. LIST COMMANDS if you forget the name of a command you are looking for
  407. and LIST BUFFERS to check the size and format of the image in the OLD
  408. and NEW edit buffers.
  409.  
  410.  
  411. PAUSE
  412.  
  413. Syntax: PAUSE [time]
  414.  
  415. With no arguments, Piclab waits for a key to be pressed before
  416. continuing.  If one argument is given, Piclab waits for that number
  417. of seconds (but will break early if a key is pressed).  This is for
  418. use within programs.
  419.  
  420.  
  421. PRINT
  422.  
  423. Syntax: PRINT [x-offset [y-offset]]
  424.  
  425. Prints the image in the NEW buffer into the file specified by the
  426. PRINTFILE variable.  The current setting of the PRINTER variable
  427. determines what codes are sent to the file.
  428.  
  429. For hard-to-explain reasons, the current release of Piclab does not
  430. allow the use of a device name such as PRN in the PRINTFILE
  431. variable.  Images must therefore be printed to disk and copied to the
  432. printer with DOS.
  433.  
  434. If arguments are given, the first two are used as the X and Y offsets
  435. of the first dot to print on the first page of output.
  436.  
  437.  
  438. RUN
  439.  
  440. Syntax: RUN program [args...]
  441.  
  442. Takes one argument--the name of a text file containing Piclab
  443. commands.  These are interpreted as if they had been typed from the
  444. command line, but they are not echoed, and messages are turned off
  445. while a program runs.  Subsequent arguments are passed along to the
  446. program as %1, etc.
  447.  
  448. A program can also be run by giving its name as an argument to the PL
  449. command when starting Piclab.
  450.  
  451.  
  452. SHOW
  453.  
  454. Syntax: SHOW [x-offset [y-offset]]
  455.  
  456. Used to display as much of the image in the NEW buffer as will fit on
  457. the computer's display screen.  If arguments are given, the first is
  458. used as a horizontal offset into the image buffer and the second as a
  459. vertical offset.  This can be used to look at different parts of an
  460. image too big for the screen.  Certain video modes allow scrolling
  461. with the arrow keys, but not all.  If no arguments are given, the
  462. current values of the XORIGIN and YORIGIN variables are used.
  463.  
  464. If any point transformations are pending, the image you see on screen
  465. reflects the image as it would be AFTER the pending transformation.
  466. This can be used to look at the effect of a transformation before
  467. saving or cancelling it.
  468.  
  469. Because Piclab often stores data more accurately than the display can
  470. render it, what you see on the screen is only an approximation of the
  471. actual image.  In particular, because Piclab does not yet support any
  472. true-color display hardware, true-color images will be shown in grayscale
  473. on displays capable of it, or in 8-color dither on others.
  474.  
  475.  
  476. SET
  477.  
  478. Syntax: SET [variable [value]]
  479.  
  480. Without any arguments, lists all Piclab variables and their current
  481. values.  Variables can be numbers, character strings, or TRUE/
  482. FALSE.  Variables set system defaults and control the specifics of
  483. how many commands perform.
  484.  
  485. If the set command is given one argument, the variable named is
  486. cleared.  That is, set to 0 if it is numeric, to "" if it is a
  487. string, and to FALSE if it is TRUE/FALSE.
  488.  
  489. If SET is given with two arguments, the variable named by the first
  490. is set to the value specified by the second.  If a numeric variable
  491. is given a string value, it is set to 0.  String values should not be
  492. put in quotes.  TRUE/FALSE values may be set by the keywords
  493. TRUE/FALSE, YES/NO, ON/OFF, or by the numeric values 1/0.
  494.  
  495. Within the SSTOOLS.INI file, the syntax is <variable>=<value>.
  496.  
  497. Help on individual variables is available by typing HELP <variable>.
  498.  
  499.  
  500. HISTOGRAM
  501.  
  502. Syntax: HISTOGRAM [RED | GREEN | BLUE]...
  503.  
  504. If no arguments are given, plots histograms for all planes; if one or
  505. more arguments are given, a histogram is plotted for each plane
  506. specified as an argument.  The histograms plotted reflect the image
  507. as it would be after any pending transformations, so you can look at
  508. the results of many processes before saving or cancelling them.
  509.  
  510. Each vertical bar of the histogram represents the total number of
  511. pixels in the image with values in the range beginning with the value
  512. listed below the histogram in hexadecimal.  Each bar covers a range
  513. of four values and there are 64 bars.  The height of each bar is in
  514. logarithmic proportion to the frequency of occurrence of values in
  515. the range it represents.  The bars are automatically scaled so that
  516. the tallest one is made 20 characters high.
  517.  
  518.  
  519. NEGATE
  520.  
  521. Syntax: NEGATE [RED | GREEN | BLUE]...
  522.  
  523. Arguments are handled as in HISTOGRAM.  Inverts each value in the
  524. lookup table for the planes specified.  This can be used after
  525. digitizing a negative or for special effects.
  526.  
  527.  
  528. DARKEN
  529.  
  530. Syntax: DARKEN [[RED | GREEN | BLUE] value]...
  531.  
  532. Subtracts a constant value to each point in the planes specified.  If
  533. only one argument is given, all planes are brightened by that amount.
  534. Otherwise, arguments are interpreted in order, and any arguments that
  535. specify planes determine which plane the next numerical argument will
  536. affect.  For example, DARKEN RED 10 BLUE 15 would subtract 10 from
  537. the values in the red plane and 15 from those in the blue.  Any
  538. values that would be taken out of the 0..255 range by the transform
  539. are clamped.
  540.  
  541. Because this darkening is a linear operation, the image to be
  542. brightened or darkened should be encoded with a gamma of 1.0.  That
  543. is, there should be a linear relationship between values in the image
  544. and intensities on the display.  If this is not the case, gamma
  545. correction may be applied with the GAMMA command before adjusting
  546. brightness.
  547.  
  548.  
  549. BRIGHTEN
  550.  
  551. Syntax: BRIGHTEN [[RED | GREEN | BLUE] value]...
  552.  
  553. Adds a constant value to each point in the planes specified.  If only
  554. one argument is given, all planes are brightened by that amount.
  555. Otherwise, arguments are interpreted in order, and any arguments that
  556. specify planes determine which plane the next numerical argument will
  557. affect.  For example, BRIGHTEN RED 10 BLUE 15 would add 10 to the
  558. values in the red plane and 15 to those in the blue.  Any values that
  559. would be taken out of the 0..255 range by the transform are clamped.
  560.  
  561. Because this brightening is a linear operation, the image to be
  562. brightened or darkened should be encoded with a gamma of 1.0.  That
  563. is, there should be a linear relationship between values in the image
  564. and intensities on the display.  If this is not the case, gamma
  565. correction may be applied with the GAMMA command before adjusting
  566. brightness.
  567.  
  568.  
  569. CONTRAST
  570.  
  571. Syntax: CONTRAST [[RED | GREEN | BLUE] value]...
  572.  
  573. This stretches or squeezes the contrast of an image.  Arguments are
  574. interpreted like those in BRIGHTEN.  If a given value is positive,
  575. the image contrast is stretched so that values that were equal to the
  576. given value become 0, and those that were equal to (255-value) become
  577. 255.  If the given value is negative, the inverse operation is
  578. performed.  Because contrast is always stretched equally around the
  579. midpoint of the range, it is a good idea to brighten or darken an
  580. image as necessary to center its histogram before performing a
  581. contrast stretch.
  582.  
  583. Also, the contrast stretching formula operates on color values
  584. assuming a linear relationship between these values and the
  585. intensities they represent (as do the BRIGHTEN and DARKEN commands). 
  586. Therefore, if an image has been scanned with a device with a gamma
  587. value not equal to 1.0, the image should be gamma corrected before
  588. contrast stretching.
  589.  
  590.  
  591. GAMMA
  592.  
  593. Syntax: GAMMA [[RED | GREEN | BLUE] value]...
  594.  
  595. The color values of the specified planes are adjusted so that values
  596. encoded for display on a monitor with a gamma value equal to the
  597. argument become linear.
  598.  
  599. For example, images encoded for display on PCs usually expect a
  600. monitor with a gamma near 2.0.  The GAMMA 2.0 command will convert
  601. these values to a linear scale.
  602.  
  603. Images encoded on Macintoshes and similar equipment have linear
  604. values already.  Such images can be adjusted for display on PCs with
  605. the inverse transformation, i.e. GAMMA 0.5.
  606.  
  607. See Piclab.DOC for more background on gamma correction.
  608.  
  609.  
  610. COLOR
  611.  
  612. Syntax: COLOR [mapfile]
  613.  
  614. Converts a grayscale image into a color-mapped image.  If the first
  615. argument is the name of a MAP file, the image is pseudo-colored with
  616. that map, otherwise the color map will contain the original grays.
  617.  
  618.  
  619. GRAY
  620.  
  621. Syntax: GRAY
  622.  
  623. Converts true-color or color-mapped image to grayscale.  The formula
  624. used for conversion to grayscale is the same as used by black and
  625. white televisions and is designed to mimic the eye's response: gray =
  626. (.287 * red) + (.589 * green) + (.114 * blue).
  627.  
  628.  
  629. TRANSFORM
  630.  
  631. Syntax: TRANSFORM
  632.  
  633. Saves the result of a series of point-process transformations to the
  634. edit buffer.  This must be done before any other transformation may
  635. be performed on the image.  If you wish to cancel the pending
  636. transformations without saving them, use UNDO or CANCEL.
  637.  
  638.  
  639. MEDIAN
  640.  
  641. Syntax: MEDIAN [WEIGHTED]
  642.  
  643. Reduces spot noise in an image.  Each point is replaced by the median
  644. of the points in its 3 x 3 area.  That is, the nine points in this
  645. area are sorted and the fifth one is taken.  If the one argument to
  646. this routine is WEIGHTED, then the center point is added twice more
  647. to the list and the sixth of the 11 points is taken.
  648.  
  649. The median filter results in some smoothing, but not as much as with
  650. the SMOOTH command.  This effect is a little less drastic with the
  651. weighted median filter.  Repeated application of this operation will
  652. result in an oil-paint texture appearing on the image.
  653.  
  654. This filter will not help reduce periodic or other noise--only small
  655. spot noise such as from dust on a lens.
  656.  
  657.  
  658. SHARPEN
  659.  
  660. Syntax: SHARPEN [value]
  661.  
  662. Applies what is called (somewhat inaccurately) a LaPlace transform to
  663. the image.  The effect is that edges in the image are sharpened as if
  664. the image had been re-focused.  Unfortunately, it also increases the
  665. amount of noise in the image, making it appear more grainy.
  666.  
  667. The command can be given a single numerical argument, which specifies
  668. the severity of the transform.  It is basically a tradeoff between
  669. sharpness and noise, and defaults to 1.0.  This value provides a
  670. noticeable increase in both sharpness and noise, and is about the
  671. best value for sharpening when the purpose is to bring out
  672. information.  When applying to a real image, a less severe value of
  673. .2 to .5 is often better.  Values greater than 1.0 should be used
  674. only when trying to locate specific objects in an image.  They
  675. produce too much noise for accurate reproduction.
  676.  
  677. This function works by amplifying the differences between each point
  678. and its neighbors.  This has the effect of amplifying high spatial
  679. frequency details such as edges and noise.
  680.  
  681.  
  682. SMOOTH
  683.  
  684. Syntax: SMOOTH [value]
  685.  
  686. Replaces each point with the average of the values of the nine points
  687. in its neighborhood.  This has the effect of smoothing the image and
  688. reducing high frequency effects like aliasing and noise, as well as
  689. high frequency details.  If an argument is given, it is taken as a
  690. value of the severity of the transform as with the SHARPEN command. A
  691. value of 1.0 is exactly as described.  Values less than 1.0 change
  692. the center value less than if a straight average had been done. 
  693. Values greater than 1.0 are not recommended.  If more smoothing is
  694. desired, perform SMOOTH more than once rather than with a high value.
  695.  
  696.  
  697. ADD
  698.  
  699. Syntax: ADD [WRAP]
  700.  
  701. Adds the OLD and NEW edit buffers storing the result in the NEW
  702. buffer.  If the only argument to the command is WRAP, then values
  703. that are taken out of the 0..255 range by the addition are taken mod
  704. 255; otherwise, values are clamped.
  705.  
  706.  
  707. SUBTRACT
  708.  
  709. Syntax: SUBTRACT [WRAP]
  710.  
  711. Subtracts the NEW edit buffers from the OLD buffer storing the result
  712. in the NEW buffer.  If the only argument to the command is WRAP, then
  713. values that are taken out of the 0..255 range by the addition are
  714. taken mod 255; otherwise, values are clamped.
  715.  
  716.  
  717. AVERAGE
  718.  
  719. Syntax: AVERAGE
  720.  
  721. Averages the OLD and NEW buffers, storing the result in NEW.  This
  722. can be used to reduce random digitizer noise by averaging the results
  723. of different samplings.  Can also be used to produce a double exposure
  724. effect when two different images are averaged.  No arguments.
  725.  
  726.  
  727. CLIP
  728.  
  729. Syntax: CLIP [x-size y-size]
  730.  
  731. If no arguments are given, image is clipped from (XORIGIN,YORIGIN) to
  732. lower right corner (upper right for bottom-up images).  If two
  733. arguments are given, the image is clipped from (XORIGIN,YORIGIN) to
  734. the horizontal and vertical size specified by the arguments.  XORIGIN
  735. and YORIGIN are set to 0 after this operation.  One argument is an
  736. error; more than two are ignored.
  737.  
  738.  
  739. EXPAND
  740.  
  741. Syntax: EXPAND x-size y-size [(BLACK | WHITE | value) [value]...]
  742.  
  743. This command increases the size of the image to the width and height
  744. specified by its first two arguments by adding extra rows and columns
  745. of pixels.  If a third argument is given, it can be either BLACK or
  746. WHITE to indicate what color the extra pixels should be.  If three
  747. numeric arguments are given after the bounds arguments, they are
  748. taken as the red, green, and blue value of the extra pixels. 
  749.  
  750. Multiple images can be placed in a montage by using EXPAND and
  751. OVERLAY.  Parts of an image may be joined with these functions as
  752. well, but it is not recommended for separately digitized image
  753. pieces, as no mosaicking is performed.
  754.  
  755. For color-mapped images, the third argument is treated as a color map
  756. index rather than a color value.
  757.  
  758.  
  759. MIRROR
  760.  
  761. Syntax: MIRROR
  762.  
  763. Flips the image horizontally.  No Arguments.
  764.  
  765.  
  766. OVERLAY
  767.  
  768. Syntax: OVERLAY [x-offset y-offset]
  769.  
  770. Overlays the image in the NEW buffer on top of the OLD buffer.  The
  771. image in the NEW buffer must not be larger than the image it is to
  772. overlay.  If two arguments are given, they are used as the horizontal
  773. and vertical offsets into the base image at which the overlay image
  774. is to be placed.  Otherwise, XORIGIN and YORIGIN are used.
  775.  
  776.  
  777. RESCALE
  778.  
  779. Syntax: RESCALE value | (x-size y-size)
  780.  
  781. Resamples the image at a different resolution.  This is useful for
  782. scaling images up to a larger size for printing, or for scaling them
  783. down for display.  It is recommended that image data always be saved
  784. at its original sampling resolution to preserve as much data as
  785. possible and only scaled when necessary to conform to hardware.
  786.  
  787. If only one argument is given, horizontal and vertical resolution are
  788. both increased in the given proportion.  For example, if a 320 x 240
  789. image is in the NEW buffer when the command RESCALE 1.5 is given, the
  790. NEW buffer will contain the same image at 480 x 360.
  791.  
  792. More useful, though, is the case where two arguments are present.  In
  793. this case, the arguments are treated directly as the new horizontal
  794. and vertical resolution of the image.  The transformation above could
  795. be expressed as RESCALE 360 480.  This is most often used to
  796. compensate for differing aspect ratios.  For example, a 320 x 400
  797. from an Amiga can be rescaled to 320 x 200 to be viewed on a VGA, or
  798. to 720 x 540 for printing on the HP PaintJet.
  799.  
  800. Because RESCALE interpolates color values, it cannot be used on
  801. color-mapped images.
  802.  
  803.  
  804. REVERSE
  805.  
  806. Syntax: REVERSE
  807.  
  808. Changes the storage order of an image from top-down to bottom-up or
  809. vice versa.  This is used primarily to save an image loaded from a
  810. file in one format (like PCX) to a format requiring the opposite
  811. order (like GIF).
  812.  
  813. Targa files can be stored either way, and contain information in the
  814. header specifying which way they are stored.  Thus, any image can be
  815. saved in Targa format at any time with minimal memory usage.
  816.  
  817.  
  818. ROTATE
  819.  
  820. Syntax: ROTATE value
  821.  
  822. Rotates image in 90-degree increments.  The single argument may
  823. specify 1, 2, or 3, in which case that number of clockwise 90-degree
  824. rotations are performed.  If a number >= 90 is given as the argument,
  825. the image is rotated that number of degrees (truncated to the nearest
  826. 90-degree increment).
  827.  
  828. This is very useful for rotating screen-oriented images for printing
  829. on paper.  Because this operation requires large amounts of memory
  830. for large images, it is recommended in this case to rotate the image
  831. before scaling it up to size for printing.
  832.  
  833.  
  834. DIR
  835.  
  836. Syntax: DIR [directory]
  837.  
  838. Lists all files in the PICDIR directory in the current file format.  If
  839. an argument is given, files in that directory are listed.  No other
  840. file specifications can be given.  If FILEFORMAT is set to GIF or
  841. TARGA, statistics on the files will be listed as well.
  842.  
  843.  
  844. GDIR
  845.  
  846. Syntax: GDIR [directory]
  847.  
  848. Lists only GIF files from PICDIR or from the directory given as sole
  849. argument.  Statistics are listed from each file as well.
  850.  
  851.  
  852. TDIR
  853.  
  854. Syntax: TDIR [directory]
  855.  
  856. Lists only Targa files from PICDIR or from the directory given as
  857. sole argument.  Statistics are listed from each file as well.
  858.  
  859.  
  860. LOAD
  861.  
  862. Syntax: LOAD file [args]...
  863.  
  864. Loads a file in the current file format into the NEW buffer, moving
  865. the current contents of the NEW buffer to OLD.  Any arguments are
  866. passed along to the function that handles loading for the current
  867. format and are interpreted by that routine.  The first argument is
  868. always the file to be loaded, but other arguments vary with the format.
  869.  
  870. LIST FORMATS will give you a list of all the available file formats,
  871. and HELP is available for each.
  872.  
  873.  
  874. GLOAD
  875.  
  876. Syntax: GLOAD file
  877.  
  878. Loads image in GIF format regardless of the current setting of
  879. variable FILEFORMAT.  Sole argument is filename.
  880.  
  881.  
  882. TLOAD
  883.  
  884. Syntax: TLOAD file
  885.  
  886. Loads image in Targa format regardless of the current setting of
  887. variable FILEFORMAT.  Sole argument is filename.
  888.  
  889.  
  890. RLOAD
  891.  
  892. Syntax: RLOAD file x-size y-size [COLOR | MONO]
  893.  
  894. Loads image in RAW format regardless of the current setting of
  895. variable FILEFORMAT.  The width and height of the image must be
  896. specified as the second and third arguments to RLOAD.  A fourth
  897. argument may be either of the words COLOR or MONO to specify the
  898. number of planes.  COLOR is default.
  899.  
  900. Color-mapped RAW files must be loaded as MONO, then colored with the
  901. COLOR command after the palette is loaded with PLOAD.
  902.  
  903.  
  904. SAVE
  905.  
  906. Syntax: SAVE file [args]...
  907.  
  908. Saves the image in the NEW buffer to the file specified by the first
  909. argument.  Subsequent arguments are passed along to the file save
  910. routine of the current file format.
  911.  
  912. LIST FORMATS will give you a list of all the available file formats,
  913. and HELP is available for each.
  914.  
  915.  
  916. GSAVE
  917.  
  918. Syntax: GSAVE file [INTERLACE]
  919.  
  920. Saves the NEW buffer to the file named by the first argument in GIF
  921. format regardless of the current setting of variable FILEFORMAT.  If
  922. the second argument is the word INTERLACE, image is interlaced.
  923.  
  924.  
  925. TSAVE
  926.  
  927. Syntax: TSAVE file [bits]
  928.  
  929. Saves the NEW buffer to the file named by the first argument in Targa
  930. format regardless of the current setting of variable FILEFORMAT.  If
  931. the second argument is 16, 24, or 32, it is used as the number of
  932. bits per pixel stored in the file.
  933.  
  934.  
  935. RSAVE
  936.  
  937. Syntax: RSAVE file
  938.  
  939. Saves image in RAW format regardless of the current setting of
  940. variable FILEFORMAT.  No arguments.
  941.  
  942.  
  943.  
  944. Warnings and Errors
  945. ===================
  946.  
  947. "Command arguments ignored"
  948.  
  949.     This warning occurs when you give a command more arguments than it
  950.     needs.  Review the syntax of the command for an explanation.
  951.  
  952. "Open files were closed"
  953.  
  954.     This indicates that a command halted for some reason while files
  955.     were open.  Piclab has closed the files but data may be lost.
  956.  
  957. "Probable information loss"
  958.  
  959.     This warning is very common and should be taken lightly.  It
  960.     indicates that some transformation has been performed that is not
  961.     reversible.  Most of the time, the initial image will be safely
  962.     stored in a disk file, or recoverable with UNDO, so this is
  963.     unimportant.
  964.  
  965. "Assertion failure; contact author"
  966.  
  967.     The is printed only in places I think are unreachable.  This
  968.     message indicates a serious error, and action (such as saving the
  969.     working file and exiting the program) should be taken immediately.
  970.  
  971. "Insufficient memory"
  972.  
  973.     There is not enough memory to perform the command issued with the
  974.     current environment.  This is most common in frame processes like
  975.     ROTATE, and with GIF loading with MULTIIMAGE and MULTIMAP set ON. 
  976.     In the latter case, those variables can be set to OFF before
  977.     loading.  In the former, there is not much alternative but to clip
  978.     the image to a smaller size or try to provide more memory.
  979.  
  980. "Miscellaneous file I/O"
  981.  
  982.     File open or write failed.  Could be bad or full disk.  Retrying
  983.     may help.
  984.  
  985. "Unexpected end of file"
  986.  
  987.     File read failed.  This may occur when loading a file that is not
  988.     encoded in the correct format, or when loading a RAW or IP file
  989.     when the size is specified incorrectly.  CLIP may sometimes be used
  990.     to recover.
  991.  
  992. "LZW compression/decompression"
  993.  
  994.     Usually the result of a bad GIF file.
  995.  
  996. "Unrecognized file format or bad file"
  997.  
  998.     The LOAD command encountered something in the file not consistent
  999.     with the file format being loaded.  Usually this is because you
  1000.     specified the wrong format, but may also occur on a bad or
  1001.     incorrectly encoded file.
  1002.  
  1003. "Image buffer empty"
  1004.  
  1005.     You attempted a transformation when no image is in the edit
  1006.     buffers.
  1007.  
  1008. "Point transform pending; issue TRANSFORM command"
  1009.  
  1010.     The command you issued cannot be performed until any pending point
  1011.     transformations are either saved with the TRANSFORM command or
  1012.     cancelled with the UNDO command.
  1013.  
  1014. "Illegal parameter values"
  1015.  
  1016.     This is a catch-all command syntax error.  Review the syntax of
  1017.     the command you are issuing.
  1018.  
  1019. "File not found"
  1020.  
  1021.     File open in LOAD command failed.  Check that the file is in the
  1022.     proper directory by issuing a DIR command.  Also check for correct
  1023.     spelling.
  1024.  
  1025.  
  1026.  
  1027. Acknowledgements
  1028. ================
  1029.  
  1030. Though I wrote 90% of the code, this project was definitely a group
  1031. effort.  The Graphics Support Forum Developer's Group on CompuServe
  1032. was instrumental in helping to inspire, create, optimize and test
  1033. this program.  I cannot acknowledge them all (or even name them all)
  1034. but a few deserve special mention:
  1035.  
  1036. John Bridges' Image Tools package served as an inspiration and a
  1037. performance yardstick for many of this program's functions, and some
  1038. of his generously donated code appears in the VGA2 display mode. 
  1039. John is the author of the GRASP animation package.
  1040.  
  1041. Bert Tyler, Timothy Wegner, and the rest of the Stone Soup Group
  1042. inspired several features and did some testing as well.
  1043.  
  1044.  
  1045.  
  1046. Legal Stuff
  1047. ===========
  1048.  
  1049. Below are listed the owners of various trademarks that are either
  1050. mentioned in this document or are likely to be mentioned in it in the
  1051. future:
  1052.  
  1053. 'DigiView' is a trademark of NewTek Incorporated.
  1054.  
  1055. 'GIF' and 'Graphics Interchange Format' are trademarks of CompuServe
  1056. Incorporated, an H&R Block company.
  1057.  
  1058. 'PaintJet' and 'LaserJet' are trademarks of Hewlett Packard
  1059. Corporation.
  1060.  
  1061.  
  1062.  
  1063. Author
  1064. ======
  1065.  
  1066. Lee Daniel Crocker
  1067. 1380 Jewett Ave
  1068. Pittsburg, CA  94565
  1069. (408) 354-8001
  1070.  
  1071. The best way to reach me is to type GO PICS on CompuServe and leave
  1072. mail to user ID [73407,2030].  I read these messages two or three
  1073. times a week.
  1074.  
  1075. I am also reachable on BIX as "lcrocker", and Usenet as "lee@siva",
  1076. but I do not visit those accounts as often.
  1077.