home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / compsrcs / misc / volume06 / tif2rast < prev    next >
Encoding:
Internet Message Format  |  1991-08-27  |  34.2 KB

  1. From decwrl!ucbvax!tut.cis.ohio-state.edu!mailrus!cornell!batcomputer!itsgw!steinmetz!uunet!allbery Fri Mar 24 22:23:34 PST 1989
  2. Article 814 of comp.sources.misc:
  3. Path: decwrl!ucbvax!tut.cis.ohio-state.edu!mailrus!cornell!batcomputer!itsgw!steinmetz!uunet!allbery
  4. From: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  5. Newsgroups: comp.sources.misc
  6. Subject: v06i049: Source Code for TIFF->SunRaster
  7. Message-ID: <50590@uunet.UU.NET>
  8. Date: 7 Mar 89 02:25:54 GMT
  9. Sender: allbery@uunet.UU.NET
  10. Reply-To: nobody@cs.buffalo.edu
  11. Organization: SUNY/Buffalo Computer Science
  12. Lines: 1195
  13. Approved: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  14.  
  15. Posting-number: Volume 6, Issue 49
  16. Submitted-by: nobody@cs.buffalo.edu
  17. Archive-name: tif2rast
  18.  
  19. [Be nice if this came with a description in the place of this remark.  ++bsa]
  20.  
  21. # This is a shell archive.  Remove anything before this line, then
  22. # unpack it by saving it in a file and typing "sh file".  (Files
  23. # unpacked will be owned by you and have default permissions.)
  24. #
  25. # This archive contains:
  26. # tiff.mail README.tif2rast Makefile.rast defs.h tif2rast.c scantif.c genrast.c getopt.c version.c tif2rast.1
  27.  
  28. echo x - tiff.mail
  29. sed -e 's/^X//' > "tiff.mail" << '//E*O*F tiff.mail//'
  30. XHi, dear,
  31. X
  32. X    I am sorry that nobody sent me a single mail except you.
  33. X
  34. X    BUT fortunately, I finally found some nice source codes from the
  35. X   'comp.sources.misc' newgroup.  If you subscribe that newsgroup, try to
  36. X   find 2 lovely programs posted by Andreas Lampen on Feb. 1.  Those 2 
  37. X   programs are used to convert TIFF file to PostScript file.  It will
  38. X   give enough information for reading TIFF file.  I actually modified
  39. X   his programs and rewrote 2 modules to get my TIFF->Sunraster converter
  40. X   works for my university.
  41. X
  42. X        Following is my own copy, please feel free to make modification
  43. X   to fit your own usage.
  44. X
  45. X        BTW, I will soon graduate with a master's degree in Computer 
  46. X   Science.  If you happen to know any graphics/image-processing related
  47. X   job openings in your company, please let me know.  Thanks in advance.
  48. X
  49. X
  50. X   ====================================================================
  51. X
  52. X    wu@cs.buffalo.edu
  53. X    wu@sunybcs.bitnet
  54. X    ..!{boulder,decvax,rutgers}!sunybcs!wu
  55. X
  56. //E*O*F tiff.mail//
  57.  
  58. echo x - README.tif2rast
  59. sed -e 's/^X//' > "README.tif2rast" << '//E*O*F README.tif2rast//'
  60. XThis is version 1.0 of tif2rast/tifdump, a program that converts
  61. XTIFF-files to Sun Raster files.
  62. X
  63. XThe tiff processing part is written by:
  64. X                  Andreas Lampen
  65. X          Tech. Univ. Berlin, FR 5-6
  66. X          Franklinstr. 28/29
  67. X          D-1000 Berlin 10, West Germany
  68. X          Tel: +49-30-314-73496
  69. X          E-mail: andy@coma.uucp (from US: pyramid!tub!coma!andy) or
  70. X              andy@db0tui62.bitnet
  71. X
  72. Xand the Sun Raster proccessing part is written by
  73. X                  William W.C. Wu
  74. X                  University Computing Services
  75. X                  State University of New York at Buffalo
  76. X                  E-Mail: wu@sunybcs.bitnet
  77. X                          wu@cs.buffalo.edu
  78. X                          ..!{boulder,decvax,rutgers}!sunybcs!wu
  79. X
  80. X-------------------------------------------------------------------
  81. XCopyright (C) 1988 by the author.
  82. XPermission is granted to copy and distribute this program
  83. Xwithout charge, provided this copyright notice is included
  84. Xin the copy.
  85. XThis Software is distributed on an as-is basis. There will be
  86. XABSOLUTELY NO WARRANTY for any part of this software to work
  87. Xcorrect. In no case will the author be liable to you for damages
  88. Xcaused by the usage of this software.
  89. X-------------------------------------------------------------------
  90. X
  91. XThis Distribution contains the files
  92. X    README.tif2rast -- The file you are actually reading.
  93. X    Makefile.rast   -- The Makefile for building and installing
  94. X               the programs "tif2rast" and "tifdump"
  95. X    defs.h             -- general definitions
  96. X    tif.h             -- TIFF specific definitions
  97. X    tif2rast.c         -- The source file containing the main program.
  98. X    scantif.c       -- The front end of the converter.
  99. X    genrast.c    -- The back end of the converter.
  100. X    getopt.c         -- A public domain getopt implementation.
  101. X                Only needed for the PC version.
  102. X    version.c        -- A source file containing a routine that returns
  103. X               the actual version number.
  104. X    tif2rast.1      -- The manual page for "tif2rast" and "tifdump"
  105. X    
  106. XThe program has been tested only with TIFF-files generated by a
  107. XHP Scanjet up to now.
  108. XIt was developed on a
  109. X    Sun3 with SunOS 4.0 and on
  110. XIt should be easy portable to other machines.
  111. X
  112. XFeel free to do any modifications or improvements to the code.
  113. XIf you do so, please send me your patches. I will try to introduce
  114. Xyour patches into further releases.
  115. X
  116. XHave fun,
  117. X      William W.C. Wu
  118. X
  119. X
  120. X
  121. X
  122. X
  123. X
  124. //E*O*F README.tif2rast//
  125.  
  126. echo x - Makefile.rast
  127. sed -e 's/^X//' > "Makefile.rast" << '//E*O*F Makefile.rast//'
  128. X#
  129. X# Makefile for tif2rast
  130. X#
  131. X# The installation procedure for tif2rast is faily simple.
  132. X#
  133. X# Where and by whom shall tif2rast and it's manual be installed ?
  134. X# (change the following 4 macro definitions if necessary)
  135. X
  136. XINSTALDIR = /usr/local
  137. XMANINSTALDIR = /usr/localman/man1
  138. XINSTALNAME = bin
  139. XINSTALGROUP = bin
  140. X
  141. X#
  142. X# If you are on a Motorola 68k based machine (eg. Sun3), replace the
  143. X# "CFLAGS" definition by:
  144. X#
  145. XCFLAGS = -O -DUNIX -DMOTOROLA
  146. X
  147. X# CFLAGS = -O -DUNIX
  148. XLDFLAGS = -s
  149. X
  150. X#
  151. X# Ready!
  152. X# Now save the Makefile and type "make" to build the system and
  153. X# or "make install" to build and install it.
  154. X#
  155. X
  156. XSOURCE = tif2rast.c scantif.c genrast.c
  157. XINCLUDE = tif.h defs.h
  158. XVERSION = version
  159. XOBJECTS = tif2rast.o scantif.o genrast.o $(VERSION).o
  160. X
  161. Xtif2rast: $(OBJECTS)
  162. X    $(CC) -o tif2rast $(LDFLAGS) $(OBJECTS) -lm
  163. X    rm -f tifdump
  164. X    ln tif2rast tifdump
  165. X
  166. X$(OBJECTS): $(INCLUDE)
  167. X
  168. Xclean :
  169. X    rm $(OBJECTS)
  170. X
  171. X
  172. X
  173. //E*O*F Makefile.rast//
  174.  
  175. echo x - defs.h
  176. sed -e 's/^X//' > "defs.h" << '//E*O*F defs.h//'
  177. X/*
  178. X * tif2ps/tifdump -- convert TIFF to PostScript
  179. X *
  180. X * written by:
  181. X * Andreas Lampen, TU-Berlin (andy@coma.UUCP)
  182. X *                 (andy@db0tui62.BITNET)
  183. X *
  184. X * Copyright (C) 1988 by the author.
  185. X * Permission is granted to copy and distribute this program
  186. X * without charge, provided this copyright notice is included
  187. X * in the copy.
  188. X * This Software is distributed on an as-is basis. There will be
  189. X * ABSOLUTELY NO WARRANTY for any part of this software to work
  190. X * correct. In no case will the author be liable to you for damages
  191. X * caused by the usage of this software.
  192. X */
  193. X
  194. X/*
  195. X * defs.h -- general type and constant definitions
  196. X * 
  197. X * $Header: defs.h[1.0] Thu Dec 29 20:10:13 1988 andy@coma published $
  198. X */
  199. X
  200. Xtypedef char           CHAR;
  201. Xtypedef int            INT;
  202. Xtypedef unsigned int   UINT;
  203. Xtypedef short          SHORT;
  204. Xtypedef unsigned short USHORT;
  205. Xtypedef long           LONG;
  206. Xtypedef unsigned long  ULONG;
  207. Xtypedef double         DOUBLE;
  208. X
  209. X#define ERROR -1
  210. X#define OK     0
  211. X
  212. X#define VOID   void
  213. X#define LOCAL  static
  214. X#define STATIC static
  215. X#define EXPORT
  216. //E*O*F defs.h//
  217.  
  218. echo x - tif2rast.c
  219. sed -e 's/^X//' > "tif2rast.c" << '//E*O*F tif2rast.c//'
  220. X
  221. X#include <stdio.h>
  222. X#include <strings.h>
  223. X#include <sys/time.h>
  224. X#include <setjmp.h>
  225. X#include <signal.h>
  226. X#include "defs.h"
  227. X#include "tif.h"
  228. X
  229. Xextern CHAR *optarg;
  230. Xextern INT  optind;
  231. X
  232. XCHAR    *progname, *version();
  233. X
  234. Xmain (ac, av)
  235. X     INT   ac;
  236. X     CHAR  **av;
  237. X{
  238. X  INT     getopt(), c, nfiles, i, cleanup();
  239. X  VOID    usage(), logerr(), dodump(), genps();
  240. X  DOUBLE  xoffset = 0., yoffset= 0., scalefactor = 1., height = 0.;
  241. X  DOUBLE  xresfactor, yresfactor, atof();
  242. X  PICTURE picts[8]; /* maximal 8 pictures */
  243. X  TIFF    tiff;
  244. X  jmp_buf env;
  245. X
  246. X  if (!rindex (av[0], '/')) progname = av[0];
  247. X    else progname = rindex (av[0], '/') + 1;
  248. X
  249. X  if (ac < 2)
  250. X    {
  251. X      usage ();
  252. X      exit (-1);
  253. X    }
  254. X
  255. X  while ((c = getopt (ac, av, "v:")) != EOF) {
  256. X      switch (c) {
  257. X      case 'v': /* print current version of this program */
  258. X    printf ("This is %s version %s.\n", av[0], version());
  259. X    exit (0);
  260. X      default:
  261. X    usage ();
  262. X    exit (-1);
  263. X      }
  264. X   }  /* end of command line parsing */
  265. X
  266. X  (VOID) signal (SIGINT, cleanup);
  267. X
  268. X  nfiles = ac - optind;
  269. X  for (i = 0; i < nfiles; i++)
  270. X    {
  271. X      if (scantif (av[i+optind], picts, &tiff) == ERROR)
  272. X    { logerr (progname, "cannot read file"); exit (-1); }
  273. X      if (!strcmp (progname, "tifdump"))
  274. X    {
  275. X      printf ("This is %s version %s.\n\n", progname, version());
  276. X      dodump (av[i+optind], &tiff);
  277. X      continue;
  278. X    }
  279. X      /* else do initializations */
  280. X      /* a loop through all pictures should be inserted here */
  281. X
  282. X      /* adjust bytecount ???? perhaps not correct */
  283. X      /* manages only single strip pictures */
  284. X      if (picts[0].image.strips[0].byteCount == 0)
  285. X    picts[0].image.strips[0].byteCount = 
  286. X      (picts[0].image.imWidth * picts[0].image.imLength) / 
  287. X        (8 / picts[i].image.bitsPerSample);
  288. X
  289. X      switch (picts[0].physWorld.resUnit)
  290. X    {
  291. X    case 1: /* special */
  292. X      xresfactor = 1. / picts[0].physWorld.xRes;
  293. X      yresfactor = 1. / picts[0].physWorld.yRes;
  294. X      break;
  295. X    case 2: /* inches */
  296. X      xresfactor = 72. / picts[0].physWorld.xRes;
  297. X      yresfactor = 72. / picts[0].physWorld.yRes;
  298. X      break;
  299. X    case 3: /* centimetres */
  300. X      xresfactor = 28.3465 / picts[0].physWorld.xRes;
  301. X      yresfactor = 28.3465 / picts[0].physWorld.yRes;
  302. X      break;
  303. X    }
  304. X      
  305. X      if (height != 0.)
  306. X    scalefactor = (height / (picts[0].image.imLength * yresfactor));
  307. X      
  308. X      if (xoffset != 0.)
  309. X    picts[0].context.xPos = xoffset;
  310. X      if (yoffset != 0.)
  311. X    picts[0].context.yPos = yoffset;
  312. X      
  313. X      picts[0].context.xMax = 
  314. X    (picts[0].image.imWidth * xresfactor * scalefactor) +
  315. X      picts[0].context.xPos;
  316. X      picts[0].context.yMax = 
  317. X    (picts[0].image.imLength * yresfactor * scalefactor) + 
  318. X      picts[0].context.yPos;
  319. X      
  320. X      genrast (av[i+optind], picts);
  321. X    }
  322. X} /* end of main */
  323. X
  324. XLOCAL INT cleanup ()
  325. X{
  326. X#ifdef MSDOS
  327. X  cprintf ("cleanup...\n");
  328. X#else
  329. X  fprintf (stderr, "cleanup...\n");
  330. X#endif
  331. X  exit (-1);
  332. X}
  333. X
  334. XLOCAL VOID usage ()
  335. X{
  336. X  printf ("usage: %s [-h <height>] [-s <scalefactor>]\n", progname);
  337. X  printf ("\t\t[-v] [-x <x-offset>] [-y <y-offset>] file1 ...\n");
  338. X}
  339. X
  340. XEXPORT VOID logerr (routine, msg)
  341. X     CHAR *routine, *msg;
  342. X{
  343. X#ifdef MSDOS
  344. X  cprintf ("%s(%s): %s\n", progname, routine, msg);
  345. X#else
  346. X  fprintf (stderr, "%s(%s): %s\n", progname, routine, msg);
  347. X#endif
  348. X}
  349. X
  350. XEXPORT CHAR *date()
  351. X{
  352. X  LONG seconds, time();
  353. X#ifndef MSDOS
  354. X  CHAR *asctime();  
  355. X#endif
  356. X
  357. X#ifdef MSDOS
  358. X  time (&seconds);
  359. X  return (ctime (&seconds));
  360. X#else 
  361. X  seconds = time ((LONG *) 0);
  362. X  return (asctime (localtime (&seconds)));
  363. X#endif
  364. X}
  365. X
  366. XEXPORT CHAR *caller()
  367. X{
  368. X  STATIC CHAR name[128];
  369. X#ifdef MSDOS
  370. X  strcpy (name, ""); /* cannot get hostname and login name */
  371. X#else
  372. X  CHAR *getlogin (), host[128];
  373. X
  374. X  (VOID) gethostname (host, 128);
  375. X  (VOID) sprintf (name, "%s@%s\0", getlogin(), host);
  376. X#endif
  377. X  return (name);
  378. X}
  379. //E*O*F tif2rast.c//
  380.  
  381. echo x - scantif.c
  382. sed -e 's/^X//' > "scantif.c" << '//E*O*F scantif.c//'
  383. X/*
  384. X * tif2ps/tifdump -- convert TIFF to PostScript
  385. X *
  386. X * written by:
  387. X * Andreas Lampen, TU-Berlin (andy@coma.UUCP)
  388. X *                 (andy@db0tui62.BITNET)
  389. X *
  390. X * Copyright (C) 1988 by the author.
  391. X * Permission is granted to copy and distribute this program
  392. X * without charge, provided this copyright notice is included
  393. X * in the copy.
  394. X * This Software is distributed on an as-is basis. There will be
  395. X * ABSOLUTELY NO WARRANTY for any part of this software to work
  396. X * correct. In no case will the author be liable to you for damages
  397. X * caused by the usage of this software.
  398. X */
  399. X
  400. X/*
  401. X * scantif.c -- read tif-file
  402. X *
  403. X * $Header: scantif.c[1.0] Thu Dec 29 20:10:59 1988 andy@coma published $
  404. X */
  405. X
  406. X#include <stdio.h>
  407. X#include "defs.h"
  408. X#include "tif.h"
  409. X
  410. XSTATIC IMAGE nullimage = {0, 0, 0, -1L, 0, 0L, 1, 1, 0, 1, 0L, 0L, 1, 1, 0, 0};
  411. XSTATIC PHMETRIC nullphmetric = { 0, 1, 0, 0, 0 };
  412. XSTATIC PHYS nullphys = { 0., 0., 2, 1 };
  413. XSTATIC CONTEXT nullcontext = { '\0', '\0', 0., 0., 0., 0., 1, 1 };
  414. X
  415. X#define FIELDSBASE 255
  416. XCHAR *fields[] = {
  417. X  "SubfileType        ",    /* 255  (ff) */
  418. X  "ImageWidth         ",    /* 256 (100) */
  419. X  "ImageLength        ",    /* 257 (101) */
  420. X  "BitsPerSample      ",    /* 258 (102) */
  421. X  "Compression        ",    /* 259 (103) */
  422. X  "                   ",    /* 260 (104) unused */
  423. X  "                   ",    /* 261 (105) unused */
  424. X  "PhotometricInterpr.",    /* 262 (106) */
  425. X  "Threshholding      ",    /* 263 (107) */
  426. X  "CellWidth          ",    /* 264 (108) */
  427. X  "CellLength         ",    /* 265 (109) */
  428. X  "FillOrder          ",    /* 266 (10a) */
  429. X  "                   ",    /* 267 (10b) unused */
  430. X  "                   ",    /* 268 (10c) unused */
  431. X  "DocumentName       ",    /* 269 (10d) */
  432. X  "ImageDescription   ",    /* 270 (10e) */
  433. X  "Make               ",    /* 271 (10f) */
  434. X  "Model              ",    /* 272 (110) */
  435. X  "StripOffsets       ",    /* 273 (111) */
  436. X  "Orientation        ",    /* 274 (112) */
  437. X  "                   ",    /* 275 (113) unused */
  438. X  "                   ",    /* 276 (114) unused */
  439. X  "SamplesPerPixel    ",        /* 277 (115) */
  440. X  "RowsPerStrip       ",    /* 278 (116) */
  441. X  "StripByteCounts    ",    /* 279 (117) */
  442. X  "MinSampleValue     ",    /* 280 (118) */
  443. X  "MaxSampleValue     ",    /* 281 (119) */
  444. X  "XResolution        ",    /* 282 (11a) */
  445. X  "YResolution        ",    /* 283 (11b) */
  446. X  "PlanarConfiguration",        /* 284 (11c) */
  447. X  "PageName           ",    /* 285 (11d) */
  448. X  "XPosition          ",    /* 286 (11e) */
  449. X  "YPosition          ",    /* 287 (11f) */
  450. X  "FreeOffsets        ",    /* 288 (120) */
  451. X  "FreeByteCounts     ",    /* 289 (121) */
  452. X  "GrayResponseUnit   ",    /* 290 (122) */
  453. X  "GrayResponseCurve  ",    /* 291 (123) */
  454. X  "Group3Options      ",    /* 292 (124) */
  455. X  "Group4Options      ",    /* 293 (125) */
  456. X  "                   ",    /* 294 (126) unused */
  457. X  "                   ",    /* 295 (127) unused */
  458. X  "ResolutionUnit     ",    /* 296 (128) */
  459. X  "PageNumber         ",    /* 297 (129) */
  460. X  "                   ",    /* 298 (12a) unused */
  461. X  "                   ",    /* 299 (12b) unused */
  462. X  "ColorResponseUnit  ",    /* 300 (12c) */
  463. X  "ColorResponseCurves",    /* 301 (12d) */
  464. X};
  465. X
  466. XCHAR *malloc();
  467. XVOID logerr();
  468. X
  469. XEXPORT INT scantif (filename, pics, tiff)
  470. X     CHAR    *filename;
  471. X     PICTURE *pics;  /* array of picture buffers -- out */
  472. X     TIFF    *tiff;
  473. X{
  474. X  DATAFILE infile;
  475. X  INT      ifdcount=0;
  476. X  VOID     EnterPicValue(), GetImageData();
  477. X  USHORT   entrycount, wordtemp, nrofentries;
  478. X  ULONG    location, dblwordtemp;
  479. X  ENTRY    *entry, stripOffsets, stripByteCounts;
  480. X
  481. X#ifdef MSDOS
  482. X  if ((infile.fdes = fopen (filename, "rb")) == NULL)
  483. X#else
  484. X  if ((infile.fdes = fopen (filename, "r")) == NULL)
  485. X#endif
  486. X    { logerr ("scantif", "cannot open input file"); return ERROR; }
  487. X
  488. X  /* read the first word, and determine the byte order
  489. X   */
  490. X  infile.order = INTELTIFF;
  491. X  if (GtData (&infile, 0L, 1, TIFFSHORT, (char *)&wordtemp))
  492. X    { logerr ("scantif", "can't read first word"); goto error; }
  493. X  infile.order = wordtemp;
  494. X
  495. X  /* read the 8-byte header
  496. X   */
  497. X  if (GtTiffHdr (&infile, &(tiff->header)))
  498. X    { logerr ("scantif", "can't read header"); goto error; }
  499. X
  500. X  location = tiff->header.offset;
  501. X         
  502. X  /* loop through the IFD's
  503. X   */
  504. X  do {
  505. X    /* if ifd location is 0, quit
  506. X     */
  507. X    if (location == 0L)
  508. X      {
  509. X    (VOID) fclose (infile.fdes);
  510. X    return OK;
  511. X      }
  512. X    
  513. X    /* read the number of entries
  514. X     */
  515. X    if (GtData (&infile, location, 1, TIFFSHORT, (char *)&nrofentries))
  516. X      { logerr ("scantif", "can't read # of entries"); goto error; }
  517. X    tiff->ifdlist[ifdcount].entrycount = nrofentries;
  518. X
  519. X    if ((tiff->ifdlist[ifdcount].entrylist = 
  520. X     (ENTRY *)malloc (nrofentries * sizeof (ENTRY))) == (ENTRY *)0)
  521. X      { logerr ("scantif", "not enough memory"); goto error; }
  522. X
  523. X    location += 2;
  524. X
  525. X    pics[ifdcount].image = nullimage;
  526. X    pics[ifdcount].photoMetric = nullphmetric;
  527. X    pics[ifdcount].physWorld = nullphys;
  528. X    pics[ifdcount].context = nullcontext;
  529. X    
  530. X    /* loop through the entries
  531. X     */
  532. X    for (entrycount = 0; entrycount < nrofentries; entrycount++) {
  533. X      /* read the entry, and dump it
  534. X       */
  535. X      entry = &(tiff->ifdlist[ifdcount].entrylist[entrycount]);
  536. X      if (GtTiffEntry (&infile, location, entry))
  537. X    goto error;
  538. X      /* adjust the current location
  539. X       */
  540. X      location += (sizeof (ENTRY) - sizeof (CHAR *));
  541. X
  542. X      if (entry->tag == STRIPOFFSETS)
  543. X    stripOffsets = *entry;
  544. X      else
  545. X    {
  546. X      if (entry->tag == STRIPBYTECOUNTS)
  547. X        stripByteCounts = *entry;
  548. X      else
  549. X        EnterPicValue (entry, &(pics[ifdcount]));
  550. X    }
  551. X    } /* end of entry loop */
  552. X
  553. X    /* read the data */
  554. X    GetImageData (&infile, &(pics[ifdcount].image), &stripOffsets, &stripByteCounts);
  555. X
  556. X    /* read the location of the next ifd */
  557. X    if (GtData(&infile, location, 1, TIFFLONG, (char *)&dblwordtemp))
  558. X      { logerr ("scantif", "can't read location of the next ifd"); goto error;}
  559. X    location = dblwordtemp;
  560. X    ifdcount++;
  561. X
  562. X  } while (1); /* end of ifd loop */
  563. X
  564. X error: ;
  565. X  (VOID) fclose (infile.fdes);
  566. X  return ERROR;
  567. X}
  568. X
  569. XEXPORT VOID dodump (filename, tiff)
  570. X     CHAR *filename;
  571. X     TIFF *tiff;
  572. X{
  573. X  INT    ifdcount=0, i;
  574. X  USHORT maxitems, item;
  575. X  IFD    *ifdptr;
  576. X  CHAR   *bufptr;
  577. X
  578. X  printf ("File: %s\n", filename);
  579. X
  580. X  /* print header */
  581. X  switch (tiff->header.byteorder)
  582. X    {
  583. X    case INTELTIFF:
  584. X      printf ("    Byte Order: INTELTIFF\n");
  585. X      break;
  586. X    case MOTOROLATIFF:
  587. X      printf ("    Byte Order: MOTOROLATIFF\n");
  588. X      break;
  589. X    default:
  590. X      printf ("    Byte Order: ***illegal***\n");
  591. X    }
  592. X  printf ("    Version: %d\n", tiff->header.version);
  593. X  printf ("    Ifd Offset: %d\n", tiff->header.offset);
  594. X
  595. X  /* print IFDs */
  596. X  do {
  597. X    ifdptr = &(tiff->ifdlist[ifdcount]);
  598. X    printf ("    IFD Number %d\n", ifdcount);
  599. X    printf ("\tNumber of entries: %d\n", ifdptr->entrycount);
  600. X    for (i=0; i<ifdptr->entrycount; i++)
  601. X      {
  602. X    printf ("\t%s (%d) type=%d length=%3d val=",
  603. X        (ifdptr->entrylist[i].tag >= 32768) ? "-------------------" :
  604. X        fields[ifdptr->entrylist[i].tag-FIELDSBASE],
  605. X        ifdptr->entrylist[i].tag, ifdptr->entrylist[i].type,
  606. X        ifdptr->entrylist[i].length);
  607. X
  608. X    bufptr = ifdptr->entrylist[i].value;
  609. X    maxitems = ifdptr->entrylist[i].length;
  610. X    switch (ifdptr->entrylist[i].type)
  611. X      {
  612. X      case TIFFBYTE:
  613. X        for (item = 0; item < maxitems; item++)
  614. X          printf ("%x", (unsigned)(*bufptr++));
  615. X        printf ("\n");
  616. X        break;
  617. X      case TIFFASCII:
  618. X        if (maxitems == 0)
  619. X          break;
  620. X        printf ("%.*s\n", maxitems, bufptr);
  621. X        break;
  622. X      case TIFFSHORT:
  623. X        for (item = 0; item < maxitems; item++, bufptr += 2)
  624. X          printf ("%u ", *((USHORT *)bufptr));
  625. X        printf ("\n");
  626. X        break;
  627. X      case TIFFLONG:
  628. X        for (item = 0; item < maxitems; item++, bufptr += 4)
  629. X          printf ("%lu ", *((ULONG *)bufptr));
  630. X        printf ("\n");
  631. X        break;
  632. X      case TIFFRATIONAL:
  633. X        for (item = 0; item < maxitems; item++) {
  634. X          printf ("% lu ", *((ULONG *)bufptr));
  635. X          bufptr += 4;
  636. X          printf ("%lu ", *((ULONG *)bufptr));
  637. X          bufptr += 4;
  638. X        }
  639. X        printf ("\n");
  640. X        break;
  641. X      default:
  642. X        logerr ("dodump", "internal error");
  643. X        break;
  644. X      }
  645. X      }
  646. X  }
  647. X  while (tiff->ifdlist[ifdcount++].nextifd);
  648. X  printf ("Ok -- that's all ! Bye Bye...\n");
  649. X}
  650. X
  651. X/**********************************************************************/
  652. X
  653. X/*
  654. X/* The following six routiones (swap, swaw, GtTiffSizeof, GtData,
  655. X/* GtTiffHdr, GtTiffEntry) are not originally written by me.
  656. X/* I copied them in a slightli modified form from a "tiffdump"
  657. X/* program, I received from Microsoft. There was no copyright
  658. X/* notice so I think the code is in the public domain.
  659. X/*       Andreas Lampen
  660. X/**/
  661. X
  662. X/* swap bytes -- overlapping arrays are handled properly
  663. X */
  664. X
  665. XLOCAL VOID swab (lpSrc, lpDst, nbytes)
  666. X     register CHAR *lpSrc, *lpDst;    /* assumed to be word-aligned */
  667. X     USHORT        nbytes;              /* assumed to be even */
  668. X{
  669. X  register USHORT words;
  670. X  union {
  671. X    CHAR c[2];
  672. X    USHORT w;
  673. X  } wrd;
  674. X  
  675. X  words = nbytes/2;
  676. X  
  677. X  if (lpDst <= lpSrc || lpDst >= lpSrc + nbytes) {
  678. X    for (; words--; lpSrc += 2) {
  679. X      wrd.w = *(USHORT *)lpSrc;
  680. X      *lpDst++ = *(CHAR *)(wrd.c + 1);    /* W2 doesn't like wrd.c[1] */
  681. X      *lpDst++ = *(CHAR *)(wrd.c);
  682. X    }
  683. X  }
  684. X  else {        /* we'll have to go backward */
  685. X    lpSrc += nbytes - sizeof(USHORT);
  686. X    lpDst += nbytes - 1;
  687. X    for (; words--; lpSrc -= 2) {
  688. X      wrd.w = *(USHORT *)lpSrc;
  689. X      *lpDst-- = *(CHAR *)(wrd.c);
  690. X      *lpDst-- = *(CHAR *)(wrd.c + 1);
  691. X    }
  692. X  }
  693. X}
  694. X
  695. X/* swap words -- overlapping ranges are handled properly
  696. X */
  697. XLOCAL VOID swaw (lpSrc, lpDst, nbytes)
  698. X     register CHAR *lpSrc, *lpDst;    /* assumed to be word-aligned */
  699. X     USHORT         nbytes;               /* assumed to be multiple of 4 */
  700. X{
  701. X  register USHORT dwords;
  702. X  union {
  703. X    CHAR c[4];
  704. X    ULONG dw;
  705. X  } dwrd;
  706. X  
  707. X  dwords = nbytes/4;
  708. X  
  709. X  if (lpDst <= lpSrc || lpDst >= lpSrc + nbytes) {
  710. X    for (; dwords--; lpSrc += 4) {
  711. X      dwrd.dw = *(ULONG *)lpSrc;
  712. X      *lpDst++ = *(CHAR *)(dwrd.c + 3);
  713. X      *lpDst++ = *(CHAR *)(dwrd.c + 2);
  714. X      *lpDst++ = *(CHAR *)(dwrd.c + 1);
  715. X      *lpDst++ = *(CHAR *)(dwrd.c);
  716. X    }
  717. X  }
  718. X  else {        /* we'll have to go backward */
  719. X    lpSrc += nbytes - sizeof(ULONG);
  720. X    lpDst += nbytes - 1;
  721. X    for (; dwords--; lpSrc -= 4) {
  722. X      dwrd.dw = *(ULONG *)lpSrc;
  723. X      *lpDst-- = *(CHAR *)(dwrd.c);
  724. X      *lpDst-- = *(CHAR *)(dwrd.c + 1);
  725. X      *lpDst-- = *(CHAR *)(dwrd.c + 2);
  726. X      *lpDst-- = *(CHAR *)(dwrd.c + 3);
  727. X    }
  728. X  }
  729. X}
  730. X
  731. XLOCAL INT GtTiffSizeof (n, p)
  732. X     USHORT n;    /* TIFFBYTE or ... */
  733. X     USHORT *p;    /* output */
  734. X{
  735. X  SHORT err = OK;
  736. X  
  737. X  switch (n) {
  738. X  case TIFFBYTE:
  739. X  case TIFFASCII:
  740. X    *p = 1;
  741. X    break;
  742. X  case TIFFSHORT:
  743. X    *p = 2;
  744. X    break;
  745. X  case TIFFLONG:
  746. X    *p = 4;
  747. X    break;
  748. X  case TIFFRATIONAL:
  749. X    *p = 8;
  750. X    break;
  751. X  default:
  752. X    *p = 1;
  753. X    err = ERROR;
  754. X    break;
  755. X  }
  756. X  return err;
  757. X}
  758. X
  759. X/* get data -- handles file/table and byte-order problems
  760. X * 64K max
  761. X */
  762. XLOCAL INT GtData (pInfile, pos, n, dtype, lpData)
  763. X     DATAFILE *pInfile; /* data location - open file or locked-down table */
  764. X     ULONG  pos;       /* file/table position, with respect to its beginning */
  765. X     USHORT n;           /* number of data elements to read */
  766. X     USHORT dtype;     /* data type: TIFFSHORT, etc */
  767. X     CHAR   *lpData;   /* where to put the data */
  768. X{
  769. X  INT    err;
  770. X  USHORT tsize, BytesToRead;
  771. X
  772. X  /* read the data
  773. X   */
  774. X  if (err = GtTiffSizeof (dtype, &tsize))
  775. X    return err;
  776. X
  777. X  BytesToRead = tsize * n;
  778. X  if (err = fseek (pInfile->fdes, (long) pos, 0))
  779. X    { logerr ("GtData", "fseek error"); return ERROR; }
  780. X
  781. X  if ((fread (lpData, 1, (INT)BytesToRead, pInfile->fdes)) == 0)
  782. X    { logerr ("GtData", "fread error"); return ERROR; }
  783. X
  784. X  /* change the byte order, if necessary
  785. X   */
  786. X#ifdef MOTOROLA
  787. X  if (pInfile->order == INTELTIFF) {
  788. X#else
  789. X  if (pInfile->order == MOTOROLATIFF) {
  790. X#endif
  791. X    if (dtype == TIFFSHORT)
  792. X      swab (lpData, lpData, BytesToRead);
  793. X    else if (dtype == TIFFLONG)
  794. X      swaw (lpData, lpData, BytesToRead);
  795. X    else if (dtype == TIFFRATIONAL)
  796. X      swaw (lpData, lpData, BytesToRead);
  797. X  }
  798. X
  799. X  return OK;
  800. X}
  801. X  
  802. X/* get TIFF 8-byte header
  803. X * currently only probably portable.  depends somewhat on compiler's 
  804. X * structure organization.
  805. X */
  806. XLOCAL INT GtTiffHdr (pInfile, pHdr)
  807. X     DATAFILE *pInfile;
  808. X     HEADER *pHdr;
  809. X{
  810. X  SHORT err;
  811. X  
  812. X  /* get the first 2 words
  813. X   */
  814. X  if (err = GtData (pInfile, (ULONG) 0, 2, TIFFSHORT, (CHAR *)&pHdr->byteorder))
  815. X    { logerr ("GtTiffHdr", "A"); return err; }
  816. X  
  817. X  /* get the double word (IFD offset)
  818. X   */
  819. X  if (err = GtData (pInfile, (ULONG)4, 1, TIFFLONG, (CHAR *)&pHdr->offset))
  820. X    { logerr ("GtTiffHdr", "B"); return err; }
  821. X
  822. X  return OK;
  823. X}
  824. X
  825. X/* get TIFF directory entry
  826. X */
  827. XLOCAL INT GtTiffEntry (pInfile, EntryOffset, pDe)
  828. X     DATAFILE    *pInfile;
  829. X     ULONG    EntryOffset;
  830. X     ENTRY    *pDe;
  831. X{
  832. X  SHORT  err;
  833. X  USHORT tsize, BytesToRead, maxitems;
  834. X  ULONG  valpos;
  835. X  
  836. X  /* get the 2 words beginning with deTag
  837. X   */
  838. X  if (err = GtData (pInfile, EntryOffset, 2, TIFFSHORT, (CHAR *)&pDe->tag))
  839. X    return err;
  840. X
  841. X  /* get the 2 dwords, beginning with deLength
  842. X   */
  843. X  if (err = GtData (pInfile, EntryOffset + 4L, 2, TIFFLONG,(CHAR *)&pDe->length))
  844. X    return err;
  845. X
  846. X  /* get value
  847. X   */
  848. X  if (err = GtTiffSizeof (pDe->type, &tsize))
  849. X    return err;
  850. X
  851. X  if ((BytesToRead = tsize * pDe->length) == 0)
  852. X    return OK; /* no need to read data */
  853. X
  854. X  if ((pDe->value = malloc (BytesToRead)) == (CHAR *)0)
  855. X    { logerr ("GtTiffEntry", "not enough memory"); return err; }
  856. X
  857. X  maxitems = (USHORT)(pDe->length);
  858. X  /* careful here: we can't just use valoffset to grab data out of, since
  859. X   * may already have been byte-reversed!
  860. X   */
  861. X  if (BytesToRead <= 4)
  862. X    valpos = EntryOffset + 8L;    /* valoffset starts on byte 8, wit de */
  863. X  else
  864. X    valpos = pDe->valoffset;
  865. X  if (err = GtData (pInfile, valpos, maxitems, pDe->type, pDe->value))
  866. X    return err;
  867. X
  868. X  return OK;
  869. X}
  870. X
  871. XLOCAL VOID EnterPicValue (entry, picture)
  872. X     ENTRY   *entry;
  873. X     PICTURE *picture;
  874. X{
  875. X  CHAR *bufptr;
  876. X  ULONG num, denom;
  877. X  SHORT i;
  878. X
  879. X  switch (entry->tag)
  880. X    {
  881. X    case SUBFILETYPE:
  882. X      picture->image.subfileType = *((USHORT *)entry->value);
  883. X      break;
  884. X    case IMAGEWIDTH:
  885. X      picture->image.imWidth = *(USHORT *)entry->value;
  886. X      break;
  887. X    case IMAGELENGTH:
  888. X      picture->image.imLength = *(USHORT *)entry->value;
  889. X      break;
  890. X    case ROWSPERSTRIP:
  891. X      picture->image.rowsPerStrip = *(ULONG *)entry->value;
  892. X      break;
  893. X    case SAMPLESPERPIXEL:
  894. X      /* ignored */
  895. X      break;
  896. X    case BITSPERSAMPLE:
  897. X      picture->image.bitsPerSample = *(USHORT *)entry->value;
  898. X      break;
  899. X    case PLANARCONFIGURATION:
  900. X      picture->image.planConf = *(USHORT *)entry->value;
  901. X      break;
  902. X    case COMPRESSION:
  903. X      picture->image.compression = *(USHORT *)entry->value;
  904. X      break;
  905. X    case GROUP3OPTIONS:
  906. X      picture->image.gr3Options = *(ULONG *)entry->value;
  907. X      break;
  908. X    case GROUP4OPTIONS:
  909. X      picture->image.gr4Options = *(ULONG *)entry->value;
  910. X      break;
  911. X    case FILLORDER:
  912. X      picture->image.fillOrder = *(USHORT *)entry->value;
  913. X      break;
  914. X    case THRESHHOLDING:
  915. X      picture->image.threshholding = *(USHORT *)entry->value;
  916. X      break;
  917. X    case CELLWIDTH:
  918. X      picture->image.cellWidth = *(USHORT *)entry->value;
  919. X      break;
  920. X    case CELLLENGTH:
  921. X      picture->image.cellLength = *(USHORT *)entry->value;
  922. X      break;
  923. X    case MINSAMPLEVALUE:
  924. X      picture->photoMetric.minSampleValue = *(USHORT *)entry->value;
  925. X      break;
  926. X    case MAXSAMPLEVALUE:
  927. X      picture->photoMetric.maxSampleValue = *(USHORT *)entry->value;
  928. X      break;
  929. X    case PHOTOMETRICINTERPR:
  930. X      picture->photoMetric.photometInterpr = *(USHORT *)entry->value;
  931. X      break;
  932. X    case GRAYRESPONSEUNIT:
  933. X      picture->photoMetric.grayResponseUnit = *(USHORT *)entry->value;
  934. X      break;
  935. X    case GRAYRESPONSECURVE:
  936. X      bufptr = entry->value;
  937. X      picture->photoMetric.grayResponseCurve = 
  938. X    (USHORT *)malloc ((UINT)(entry->length+1) * sizeof (USHORT)); 
  939. X      for (i=0; i < entry->length; i++, bufptr += 2)
  940. X    picture->photoMetric.grayResponseCurve[i] = *(USHORT *)bufptr;
  941. X      picture->photoMetric.grayResponseCurve[entry->length] = -1;
  942. X      break;
  943. X    case XRESOLUTION:
  944. X      num = *(ULONG *)entry->value;
  945. X      bufptr = entry->value+4;
  946. X      denom = *(ULONG *)bufptr;
  947. X      picture->physWorld.xRes = (DOUBLE)num/(DOUBLE)denom;
  948. X      break;
  949. X    case YRESOLUTION:
  950. X      num = *(ULONG *)entry->value;
  951. X      bufptr = entry->value+4;
  952. X      denom = *(ULONG *)bufptr;
  953. X      picture->physWorld.yRes = (DOUBLE)num/(DOUBLE)denom;
  954. X      break;
  955. X    case RESOLUTIONUNIT:
  956. X      picture->physWorld.resUnit = *(USHORT *)entry->value;
  957. X      break;
  958. X    case ORIENTATION:
  959. X      picture->physWorld.orientation = *(USHORT *)entry->value;
  960. X      break;
  961. X    case DOCUMENTNAME:
  962. X      picture->context.docName = (CHAR *) entry->value;
  963. X      break;
  964. X    case PAGENAME:
  965. X      picture->context.pageName = (CHAR *) entry->value;
  966. X      break;
  967. X    case XPOSITION:
  968. X      num = *(ULONG *)entry->value;
  969. X      bufptr = entry->value+4;
  970. X      denom = *(ULONG *)bufptr;
  971. X      picture->context.xPos = (DOUBLE)num/(DOUBLE)denom;
  972. X      break;
  973. X    case YPOSITION:
  974. X      num = *(ULONG *)entry->value;
  975. X      bufptr = entry->value+4;
  976. X      denom = *(ULONG *)bufptr;
  977. X      picture->context.yPos = (DOUBLE)num/(DOUBLE)denom;
  978. X      break;
  979. X    case PAGENUMBER:
  980. X      picture->context.pageNo = *(USHORT *)entry->value;
  981. X      bufptr = entry->value+2;
  982. X      picture->context.noOfPages = *(USHORT *)bufptr;
  983. X      break;
  984. X    }
  985. X}
  986. X
  987. XLOCAL VOID GetImageData (infile, image, stripOffsets, stripByteCounts)
  988. X     DATAFILE *infile;
  989. X     IMAGE    *image;
  990. X     ENTRY    *stripOffsets, *stripByteCounts;
  991. X{
  992. X  ULONG offset;
  993. X
  994. X  if (stripOffsets->length != 1)
  995. X    { logerr ("GetImageData", "cannot handle multiple strips"); return; }
  996. X
  997. X  if ((image->strips = (STRIP *)malloc (2 * sizeof (STRIP))) == (STRIP *)0)
  998. X    { logerr ("GetImageData", "not enough memory"); return; }
  999. X
  1000. X  image->strips[0].byteCount = *(ULONG *)stripByteCounts->value;
  1001. X  offset = *(ULONG *)stripOffsets->value;
  1002. X
  1003. X  if (fseek (infile->fdes, (LONG) offset, 0) == ERROR)
  1004. X    { logerr ("GetImageData", "fseek error"); return; }
  1005. X
  1006. X  if ((image->strips[0].data = 
  1007. X       malloc ((UINT)image->strips[0].byteCount)) == (CHAR *)0)
  1008. X    { logerr ("GetImageData", "not enough memory"); return; }
  1009. X
  1010. X  if (fread (image->strips[0].data, sizeof (CHAR),
  1011. X         (INT)image->strips[0].byteCount, infile->fdes) == 0)
  1012. X    { logerr ("GetImageData", "fread error"); return; }
  1013. X
  1014. X  image->strips[1].byteCount = 0;
  1015. X  image->strips[1].data = (char *)0;
  1016. X}
  1017. //E*O*F scantif.c//
  1018.  
  1019. echo x - genrast.c
  1020. sed -e 's/^X//' > "genrast.c" << '//E*O*F genrast.c//'
  1021. X
  1022. X#include <rasterfile.h>
  1023. X#include <stdio.h>
  1024. X#include "defs.h"
  1025. X#include "tif.h"
  1026. X
  1027. Xstruct rasterfile ras;
  1028. X
  1029. Xint bytes_per_row = 0;
  1030. X
  1031. Xgenrast(filename, picts)
  1032. X     char    *filename;
  1033. X     PICTURE *picts;
  1034. X{
  1035. X  int i;
  1036. X
  1037. X  /* calculate raster header and swap bytes */
  1038. X  bytes_per_row = (int) (picts[0].image.imWidth / 8);
  1039. X  ras.ras_magic = RAS_MAGIC;
  1040. X  ras.ras_width = picts[0].image.imWidth;
  1041. X  ras.ras_height = picts[0].image.imLength;
  1042. X  ras.ras_depth = 1;
  1043. X  ras.ras_length = (bytes_per_row * picts[0].image.imLength);
  1044. X  ras.ras_type = 1;
  1045. X  ras.ras_maptype = 0;
  1046. X  ras.ras_maplength = 0;
  1047. X  
  1048. X  /* write out rasterfile header */
  1049. X  fwrite((char *) &ras,sizeof(struct rasterfile),1,stdout);
  1050. X  for (i = 0; i < picts[0].image.strips[0].byteCount; i++) 
  1051. X    printf("%c", picts[0].image.strips[0].data[i]);
  1052. X}
  1053. X
  1054. X
  1055. //E*O*F genrast.c//
  1056.  
  1057. echo x - getopt.c
  1058. sed -e 's/^X//' > "getopt.c" << '//E*O*F getopt.c//'
  1059. X/*
  1060. X *    I got this off net.sources from Henry Spencer.
  1061. X *    It is a public domain getopt(3) like in System V.
  1062. X *
  1063. X *    I made some minor modifications while porting it to MS-DOS.
  1064. X *        andy@coma
  1065. X */
  1066. X#include <stdio.h>
  1067. X#include <string.h>
  1068. X
  1069. X#define    ARGCH    (int)':'
  1070. X#define BADCH     (int)'?'
  1071. X#define EMSG     ""
  1072. X#define    ENDARGS  "--"
  1073. X
  1074. X/*
  1075. X * get option letter from argument vector
  1076. X */
  1077. Xint    optind = 1,        /* index into parent argv vector */
  1078. X    optopt;            /* character checked for validity */
  1079. Xchar    *optarg;        /* argument associated with option */
  1080. X
  1081. X#define tell(s)    fputs(*nargv,stderr);fputs(s,stderr); \
  1082. X        (void)fputc(optopt,stderr);(void)fputc('\n',stderr); \
  1083. X                return(BADCH);
  1084. X
  1085. Xint getopt(nargc,nargv,ostr)
  1086. Xint    nargc;
  1087. Xchar    **nargv,
  1088. X    *ostr;
  1089. X{
  1090. X    static char    *place = EMSG;    /* option letter processing */
  1091. X    register char    *oli;        /* option letter list index */
  1092. X
  1093. X    if(!*place) {            /* update scanning pointer */
  1094. X        if(optind >= nargc || *(place = nargv[optind]) != '-' || !*++place) return(EOF);
  1095. X        if (*place == '-') {    /* found "--" */
  1096. X            ++optind;
  1097. X            return(EOF);
  1098. X        }
  1099. X    }                /* option letter okay? */
  1100. X    if ((optopt = (int)*place++) == ARGCH || !(oli = strchr (ostr,optopt))) {
  1101. X        if(!*place) ++optind;
  1102. X        tell(": illegal option -- ");
  1103. X    }
  1104. X    if (*++oli != ARGCH) {        /* don't need argument */
  1105. X        optarg = NULL;
  1106. X        if (!*place) ++optind;
  1107. X    }
  1108. X    else {                /* need an argument */
  1109. X        if (*place) optarg = place;    /* no white space */
  1110. X        else if (nargc <= ++optind) {    /* no arg */
  1111. X            place = EMSG;
  1112. X            tell(": option requires an argument -- ");
  1113. X        }
  1114. X         else optarg = nargv[optind];    /* white space */
  1115. X        place = EMSG;
  1116. X        ++optind;
  1117. X    }
  1118. X    return(optopt);            /* dump back option letter */
  1119. X}
  1120. //E*O*F getopt.c//
  1121.  
  1122. echo x - version.c
  1123. sed -e 's/^X//' > "version.c" << '//E*O*F version.c//'
  1124. X#include "defs.h"
  1125. XCHAR *version () {
  1126. X  STATIC CHAR ConfID[] =  "1.0 (Sun Feb 12 21:55:10 1989 by wu@sunybcs)";
  1127. X  return ConfID;
  1128. X}
  1129. //E*O*F version.c//
  1130.  
  1131. echo x - tif2rast.1
  1132. sed -e 's/^X//' > "tif2rast.1" << '//E*O*F tif2rast.1//'
  1133. X...
  1134. X... tif2rast/tifdump -- convert TIFF to Sun raster
  1135. X...
  1136. X... written by:
  1137. X... Andreas Lampen, TU-Berlin (andy@coma.UUCP)
  1138. X...                 (andy@db0tui62.BITNET)
  1139. X... William W.C. Wu, State University of New York at Buffalo
  1140. X...                  (wu@sunybcs.bitnet)
  1141. X...                  (wu@cs.buffalo.edu)
  1142. X...
  1143. X... Copyright (C) 1988 by the author.
  1144. X... Permission is granted to copy and distribute this program
  1145. X... without charge, provided this copyright notice is included
  1146. X... in the copy.
  1147. X... This Software is distributed on an as-is basis. There will be
  1148. X... ABSOLUTELY NO WARRANTY for any part of this software to work
  1149. X... correct. In no case will the author be liable to you for damages
  1150. X... caused by the usage of this software.
  1151. X...
  1152. X.TH TIF2RAST 1
  1153. X.SH NAME
  1154. Xtif2Rast, tifdump \- convert TIFF files to Sun Raster
  1155. X.SH SYNOPSIS
  1156. X.B tif2rast
  1157. X.RB [ \-h
  1158. X.IR height ]
  1159. X.RB [ \-s ]
  1160. X.IR scalefactor ]
  1161. X.RB [ \-v ]
  1162. X.RB [ \-x
  1163. X.IR x-offset ]
  1164. X.RB [ \-y
  1165. X.IR y-offset ]
  1166. Xfile1 ...
  1167. X.LP
  1168. X.B tifdump 
  1169. X.RB [ \-v ]
  1170. Xfile1 ...
  1171. X.SH DESCRIPTION
  1172. X\fITif2rast\fR converts a TIFF file to Sun Raster file, and writes the result
  1173. Xto standard output.
  1174. X\fITif2rast\fR recognizes the following options:
  1175. X.TP
  1176. X.BI \-v
  1177. Xprints the version identification of \fItif2rast\fR.
  1178. X.LP
  1179. X\fITifdump\fR produces a human readable dump of the given TIFF-files.
  1180. XThe result is written to standard output.
  1181. X.SH BUGS
  1182. XThis version of \fItif2rast\fR has not been tested very extensively yet.
  1183. XSo don't be too angry if it produces core dumps or incorrect Sun Raster
  1184. Xfiles.
  1185. XIn that case, please drop a short error report to the author.
  1186. X.br
  1187. X.PP
  1188. XData compression is not yet supported.
  1189. X.PP
  1190. X.SH AUTHOR 1
  1191. XAndreas Lampen, TU Berlin
  1192. X.sp
  1193. X.ta 0.7i 
  1194. XUUCP:    unido!coma!andy
  1195. X.br
  1196. XBITNET:    andy@db0tui62
  1197. X.PP
  1198. X.SH AUTHOR 2
  1199. XWilliam W.C. Wu, State University of New York at Buffalo
  1200. X.sp
  1201. X.ta 0.7i 
  1202. XUUCP:    ..!{boulder,decvax,rutgers}!sunybcs!wu
  1203. X.br
  1204. XBITNET:    wu@sunybcs.bitnet
  1205. X.br
  1206. XINTERNET: wu@cs.buffalo.edu
  1207. //E*O*F tif2rast.1//
  1208.  
  1209. exit 0
  1210.  
  1211.  
  1212.