home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume6 / tif2rast < prev    next >
Text File  |  1989-03-06  |  35KB  |  1,203 lines

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