home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / clipart / gif2wp34.zip / GIF2WPG.DOC next >
Text File  |  1989-02-15  |  15KB  |  391 lines

  1.  
  2.  
  3.  
  4.  
  5.          GIF2WPG V3.4 GIF -to- Word Perfect Graphics File Translator
  6.           Copyright 1988,1989 by William J. Hinkle CIS [71121,3211]
  7.                                  15 Feb 1989
  8.  
  9.  
  10.            GIF and 'Graphics Interchange Format' are trademarks of
  11.                           CompuServe, Incorporated.
  12.                              an H&R Block Company
  13.  
  14.                             === User's Guide === 
  15.  
  16. The GIF2WPG program  was created to allow graphics files created as GIF 
  17. (Graphics Interchange Format) files to be used in Word Perfect documents. To 
  18. do this, the program translates the GIF file into a WPG bit-mapped raster 
  19. graphics file.  In the process, GIF2WPG converts the GIF image's colors into 
  20. shades of gray, which it tries to reproduce in the WPG image.
  21.  
  22. There are zillions of GIF files available on CompuServe in the QPICS and 
  23. GALLERY forum, as well in other forums, and from other sources. Generally they 
  24. are in color, which GIF2WPG changes into grayscale and then dithers (default) 
  25. or halftones.
  26.  
  27. The translator is a single file: GIF2WPG.EXE.
  28.  
  29. =========
  30. THE CATCH
  31. =========
  32.  
  33. Note that this program is being released by the author, and is NOT supported
  34. by Word Perfect Corporation, or by CompuServe Inc.
  35.  
  36. It is NOT public domain!
  37.  
  38. This utility program GIF2WPG.EXE was written by
  39.  
  40.     William J. Hinkle
  41.  
  42. who retains the copyright.  Copy and use the program freely.  Distribute
  43. it to whomever you want.  But:
  44.  
  45. === Do NOT distribute modified versions.
  46. === Do NOT remove the copyright notice.
  47. === ALWAYS distribute with the documentation.
  48.  
  49. If you feel that this program has been of some utility, please seriously 
  50. consider sending a contribution of up to $10.00 to help defray the CompuServe
  51. costs run up in developing this utility.  Please indicate if you desire a 
  52. written receipt.
  53.  
  54. William J. Hinkle
  55. 420 E.Boston Mills Rd.
  56. Hudson, OH 44236-1111
  57.  
  58.  
  59.  
  60. =========
  61. OPERATION
  62. =========
  63.  
  64. First get a GIF file contains the graphics image you want to integrate into
  65. your document.  These are usually "paint" or "screen capture" images.  See
  66. GO PICS on CompuServe.  It should  have the standard .GIF file extension
  67. (i.e., fname.GIF).
  68.  
  69. To create a .WPG file, type in:
  70.  
  71. GIF2WPG fname
  72. or
  73. GIF2WPG fname.GIF
  74. or
  75. GIF2WPG fname.GIF fname.WPG
  76.  
  77. from the DOS command prompt.  The .GIF extension is assumed if you do not
  78. specify one.  The .WPG extension is assumed whether you specify one or not.
  79. The .WPG file name is made the same as the .GIF if not otherwise specified.
  80. Full DOS pathnames can be specified.  You can specify just a directory
  81. (ending in \) or a drive (ending in :) instead of the second filename; the
  82. WPG file will use the name of the GIF file, with a WPG extension, and be
  83. placed on that path.
  84.  
  85. The .GIF file will be translated to a .WPG file.
  86. The .GIF file will not be erased.  You can also specify scaling factors, but
  87. the defaults often work the best (see below).
  88.  
  89. Some GIF files are "interlaced" -- they are specially constructed for on-line
  90. viewing.  GIF2WPG will process this type of GIF file without complaint, but
  91. it will go about it in a slightly different manner.  It's default method of 
  92. creating the grayscale in the WPG file is somewhat different.
  93.  
  94.  
  95.  
  96. ==============
  97. COMPLEAT USAGE
  98. ==============
  99.  
  100. If you invoke GIF2WPG from DOS without any other parameters, it will
  101. display the following help message.  This illustrates some of the
  102. other options:
  103.  
  104. -----
  105. GIF-to-WPG Translator: V3.4 ... Copyright 1988, 1989 by W.J.Hinkle
  106.  
  107. Press a key to get a little help...
  108.  
  109. (You press a key here!)
  110.  
  111. Usage: GIFWPG fname1 [fname2] [option] [option] ...
  112. where: fname1.GIF ... GIF format input file
  113.        fname2.WPG ... Word Perfect WPG file (default is fname1.WPG)
  114.        /iN        ... option: select sub-image N (default is 1)
  115.        /xN        ... option: x density = N pixels-per-inch
  116.        /yN        ... option: y density = N lines-per-inch
  117.        /v         ... option: reverse video
  118.        /hN        ... option: force halftone block to NxN
  119.        /dN        ... option: force dither block to NxN (<=0 =error diffused)
  120.        /cN        ... option: change contrast by N%
  121.        /bN        ... option: change brightness by +/-N% (BEFORE contrast %)
  122.        /l         ... option: linearize colors (ignore color maps)
  123.        /g         ... option: equal color weighting for grayscale GIF
  124.        /wN        ... option: index of color to change into "white"
  125.        /p         ... option: print pixel histogram data
  126.  
  127. GIFWPG is a translator from CompuServe GIF files to Word Perfect WPG
  128. graphics files for use in printed documents.
  129.  
  130. Press a key to continue...
  131.  
  132.  
  133. The GIF colors are converted to grayscale intensity using the weighting:
  134. Red 30%, Green 59%, Blue 11%.  You can specify that the GIF uses only gray
  135. tones with the /g flag; equal color weighting will then be used.
  136.  
  137. The grayscale is dithered error diffused, by default.  A pattern block
  138. size can be used instead: select with /dN, N=1,2,4 or 8 for pattern dither
  139. or with /hN, N=1,2,3 or 4 for pattern halftone.
  140.  
  141. The X density defaults to 100 pixels-per-inch times the halftone block
  142. size (if any).  The Y density is set for 4/3 aspect ratio, unless set by
  143. use of the /xN and /yN options.
  144.  
  145. The /p option will print on-screen a histogram of the colors used in the GIF,
  146. their RGB color components, and their brightness.  You can adjust the overall
  147. brightness with the /bN option (-100 <= N <= +100, in percentage brightness)
  148. and the contrast with the /cN option (N is a percentage multiplier).
  149.  
  150. Eliminate a pesky background color by specifying /wN, where N is the index
  151. number of that color.  All the pixels in that color are turned pure white.
  152.  
  153. Press a key to continue...
  154.  
  155.  
  156.  
  157. GIF and 'Graphics Interchange Format' are trademarks of CompuServe Inc.
  158. an H & R Block company.
  159.  
  160. Word Perfect is a trademark of the Word Perfect Corporation.
  161.  
  162. (followed by some shareware info you should read... )
  163.  
  164. -----
  165.  
  166. ==========
  167. SUB-IMAGES
  168. ==========
  169.  
  170. If your GIF file contains multiple sub-images, you can specify which one
  171. to extract and translate by specifying the /iN option, where N is the sub-
  172. image number 1,2,3... etc.  Normally, you can ignore this option; the 1st
  173. (or only!) image will be translated.  If there are additional sub-images
  174. beyond the one selected, a warning is issued and they are ignored.
  175.  
  176. =============================
  177. ASPECT RATIO AND PICTURE SIZE
  178. =============================
  179.  
  180. Normally GIF2WPG decides that the image's X density (for width) is
  181. 100 pixels (or lines) per inch, times the halftone block size (see below).
  182. The Y density (for height) is set by by computing the density required to
  183. create a 4/3 aspect ratio in order to simulate a CRT screen.  This is done
  184. because most GIF images are a single full screen image.  This allows
  185. computation of a "natural" size for the graphics image.
  186.  
  187. You can specify a different density by specifying the /xN option switch (e.g.
  188. /x300 is 300 pixels per inch horizontally).  The corresponding Y density is
  189. computed as above.  You can also alter the aspect ratio by specifying both
  190. the /x and /y option switches, with different density values.  The overrides
  191. are NOT further adjusted for halftoning or error-diffused multiplication!
  192.  
  193. ====================
  194. COLORS AND GRAYSCALE
  195. ====================
  196.  
  197. Most GIF files are in color.  GIF2WPG transforms the color mapping into
  198. intensity of grayscale using the above mentioned weights.  If you know for
  199. a fact that the GIF uses gray tones only, you can specify the /g option to
  200. use equal color weights.
  201.  
  202. Once in grayscale, the image can be either dithered (the default) or
  203. halftoned.  Normally, you don't have to even think about this, but if you want 
  204. to tweak things, and possibly improve your results, read on...
  205.  
  206. Dithering tries to average the image brightness over a small area of the
  207. image.  The default is to use double the size of the image in both axes,
  208. and use error-diffused dithering.  You can vary the multiplication factor
  209. by specifying the /dN option with a negative N, where N is the size multiplier.
  210. In other words, the default dithering is equivalent to /d-2.  This type of
  211. dithering tends to ease problems image artifacts if you later scale the image.
  212.  
  213.  
  214.  
  215. If you specify the /dN option with positive N (/d1, /d2, /d4, or /d8), the
  216. image size is not multiplied and a patterned dither is used with an NxN
  217. dither block.  This can give smaller WPG files, but not very good visual
  218. results.
  219.  
  220. Better that pattern dither is (simulated) halftoning, which replaces each GIF 
  221. pixel with a block of on/off pixels that have a corresponding optical density.  
  222. Halftoning will be done instead of dithering if you specify the /hN option 
  223. (which will halftone with an NxN block).  For example: /h1, /h2, /h3, or /h4.
  224.  
  225. =============
  226. REVERSE VIDEO
  227. =============
  228.  
  229. Normally GIF2WPG flips the photometric interpretation of the GIF file colors:
  230. the brightest colors have the fewest pixels in the WPG file.  This is because
  231. GIF files are generally optimized for screen viewing, but Word Perfect will
  232. (eventually) put the image on paper.  However, if you WANT a reverse video
  233. effect, use the /v option switch.
  234.  
  235. ==========================
  236. KILLING THE COLOR MAPPING
  237. ==========================
  238.  
  239. You can override the GIF file's color map by specifying the /l option (that's
  240. an "el", not a "one").  This "linearizes" the color mapping: color indices
  241. will be transformed directly into grayscale without worrying about how
  242. bright the colors really ought to be.  This sometimes gives a more detailed,
  243. though probably less accurate, image.  It may be most useful for charts
  244. and such.
  245.  
  246. =======================
  247. BRIGHTNESS AND CONTRAST
  248. =======================
  249.  
  250. The /bN option can be specified to adjust the brightness the image.  The 
  251. effect is to add N percent of maximum brightness to the image.
  252. The factor N can range from -100 to +100 percent.  If not specified, no change
  253. in the brightness is made.  For example: /b-25 lowers the brightness by 25%.
  254.  
  255. The /cN option can be specified to adjust the contrast of the image.  The 
  256. effect is to multiply each grayscale intensity value by N%.  The factor N can 
  257. be greater or less than 100.  If not specified, the contrast is left at 100%.  
  258. For example: /c85 give 85% contrast.
  259.  
  260. The contrast adjustment is applied AFTER the brightness adjustment.  The 
  261. histogram option can give you an idea of what kind of adjustments to make to 
  262. the brightness and contrast; see below.
  263.  
  264.  
  265.  
  266. ===================
  267. WHITEOUT BACKGROUND
  268. ===================
  269.  
  270. Simple GIFs (as found in QPICS, for example) often have a solid color 
  271. background that will just clutter things up when printed in black-and-white.
  272. You can eliminate that color by specifying its color index as N in the /wN
  273. option.  This will yield a nice clear background in the WPG image.
  274.  
  275. But, how to find out the background color?  Print out the histogram (see 
  276. below) and look for a color that is used FAR more often than the rest.  That 
  277. is probably the background color.  Or simply experiment.
  278.  
  279. ===============
  280. PRINT HISTOGRAM
  281. ===============
  282.  
  283. The /p option causes a histogram to be kept on the distribution of color
  284. indices in the GIF image.  The RGB levels and relative brightness of each
  285. color, as well as the number of occurences of each value, are printed on
  286. the screen when the translation is complete.
  287.  
  288. Here's a technique that is often helpful in improving the resulting WPG image:
  289.  
  290. Translate your GIF file, using the /p option to get a histogram.  You can 
  291. re-direct the histogram printout to a file or the printer with DOS file
  292. redirection, e.g.:
  293.  
  294. GIF2WPG YERGIF /p >lpt1
  295.  
  296. If you like the resulting WPG file, you're done!  But if not, take a look at 
  297. the histogram.  See if the lowest brightness actually used in the picture is 
  298. well above 0%.  If so, you might want to adjust the brightness downward.  See 
  299. also if the total range of brightness is well under 100%.  If so, you might 
  300. want to adjust the contrast upward to avoid a washed-out look (especially if 
  301. you adjust the brightness downward).
  302.  
  303.  
  304.  
  305. ========
  306. EXAMPLES
  307. ========
  308.  
  309. 1) Suppose you have a GIF file called "earthm.gif".  You want to create a WPG
  310. file version of this image without worrying about the details.  You can
  311. translate this to a WPG file by typing (at the DOS prompt):
  312.  
  313. GIF2WPG earthm
  314.  
  315. and you will see something like:
  316. -----
  317. GIF-to-WPG Translator: V3.4 ... Copyright 1988, 1989 by W.J.Hinkle
  318.  
  319. From GIF 640x350x16 file: earthm.gif
  320.   to WPG 1280x700 file: earthm.WPG
  321.   dithered error diffused with +0% brightness, 100% contrast.
  322. "Natural" picture size is 6.400W x 4.800H inches.
  323. -----
  324. Note that both the GIF image resolution and color range are shown:
  325. GIF Width x Height x # of Colors
  326.  
  327. Also shown is the final WPG image resolution:
  328. WPG Width x Height
  329.  
  330. Also shown are the "natural" size of the final image, and the file names.
  331.  
  332.  
  333.  
  334.  
  335. 2) Suppose you have a GIF file called "yikes.gif".  You can translate
  336. this to a WPG file by typing (at the DOS prompt):
  337.  
  338. GIF2WPG yikes /h4
  339.  
  340. and you will see something like:
  341. -----
  342. GIF-to-WPG Translator: V3.4 ... Copyright 1988, 1989 by W.J.Hinkle
  343.  
  344. From GIF 156x131x16 file: yikes.gif
  345.   to WPG 624x524 file: yikes.WPG
  346.   halftoned into a 4x4 pixel matrix with +0% brightness, 100% contrast.
  347. "Natural" picture size is 1.560W x 1.170H inches.
  348. -----
  349.  
  350.  
  351.  
  352. ======
  353. HELP!?
  354. ======
  355.  
  356. Should you have any difficulties using this program, you can contact me (Bill 
  357. Hinhle) through CompuServe EMAIL to [71121,3211], if you like, or at the 
  358. address below.  General feedback is welcome, especially on better methods of 
  359. color reduction, grayscale halftoning and dithering, and problem GIF files.
  360.  
  361. Thanks to Bob Cancilla [76077,354] for his prototype testing & help on
  362. the original GIF2BIT for Lotus Manuscript.
  363. Thanks to Jeff Lewis [72717,1033] for ideas on halftoning and dithering.
  364. Thanks to Kyle Powell [76044,2215] for his public domain LZW decoder 85GIF.
  365. Thanks to Floyd & Steinberg for the error diffused dither algorithm.
  366.  
  367. Thanks to the many CIS beta testers and folks who reported problems.
  368.  
  369. =============
  370. REVISION INFO
  371. =============
  372.  
  373. *    Version number    Date        Explanation                                *
  374. *    --------------    ------        --------------------------                *
  375. *        3.0            14 Oct 88    Original Release, based on GIF2BIT V3.0    *
  376. *         3.1            21 Nov 88    Added color map & output attributes     *
  377. *        3.2            13 Dec 88    fixed row decoding problem where there    *
  378. *                                 was more rows encoded than the GIF        *
  379. *                                 header indicated.                        *
  380. *                                Also added /g option (grayscale weight)    *
  381. *        3.3            25 Jan 88    (unreleased)                            *
  382. *                                Fixed the reverse video problem            *
  383. *                                 and added /b brightness switch            *
  384. *                                 and fixed density set to use screen    *
  385. *                                 dimensions, not image dimensions        *
  386. *                                 and added /w color-to-white conversion    *
  387. *                                 and the blank box problem                *
  388. *        3.4            15 Feb 88    Fixed the brightness overflow problem    *
  389. *                                 and forced halftone for interlace GIF    *
  390. *                                 and cleaned up the help messages        *
  391.