2004.03.19 17:50 "[Tiff] txt to tiff", by Soledad Alborno

2004.03.20 15:18 "Re: [Tiff] txt to tiff", by Joris Van Damme

Hello, I am searching how to convert txt files to tiff files.

The easiest way is to use a tool like 'enscript' to produce Postscript from the text, and then use Ghostscript in conjunction with libtiff to output a TIFF file.

I beg to differ, Bob. OK, it's easiest *for your*, since you've already setup all this stuff and learned to use it. Anyone else is in for quite an adventure doing it this way.

Hello, I am searching how to convert txt files to tiff files.

This is a bit of a weird question, I'm not sure if I understand your need... TXT is a text format, is plain text. TIFF is an image format, is very flexible multipage raster image. Do you need to render txt to a image raster, and next store the created image in a TIFF file? Or is your txt some kind of array of values, as possibly exported by spreadsheets or databases or such, and do you want to create an image with pixels having those color values? Or something else alltogether?

For now, I'm going to assume it's rendering you're after. What OS do you use? If Windows, it's easy to create a DIB, and render the text on it. That should yield access to a block of memory storing something like scanlines of 8bit grayscale or 24bit 'true color' RGB. Next, you can set up LibTiff to encode this raster to a TIFF file.

First step, rendering, is described in your Windows documentation (and I assume any contemporary operating system has something similar). Search your documentation for things like CreateDIBSection, DrawText, and that kinda basic GDI stuff.

Last step, encoding to TIFF, is described in LibTiff documentation. Here's some additional pointers. First two are URL's to good documentation on how to use LibTiff. Next two are pointers to the long-term mailing list archive, riddled with information on TIFF and LibTiff.


Joris Van Damme
Download your free TIFF tag viewer for windows here: