reading graphics files
- To: mathgroup@smc.vnet.net
- Subject: [mg12597] reading graphics files
- From: Russell Towle <rustybel@foothill.net>
- Date: Mon, 25 May 1998 14:25:08 -0400
I saw some recent postings about using Mathematica to read and manipulate image data, say, from a TIFF or PICT or some sort of pixel-mapped file format. Since the last word seemed to be that reading and working with such data was "supposed" to be feasible but in fact was devilishly difficult, I decided to have a try. I happened to have a 24-bit Targa file on hand with 180 columns of 200 pixels per column. I had made it in such a way that the red and green bytes together formed 16-bit numbers, while the blue byte was empty. Without knowing anything about the particulars of the Targa file format, I opened it using OpenRead and read in a bunch of Numbers using ReadList. About twenty numbers in from the beginning, I saw the numbers 180 and 200. Shortly thereafter, a long series in which every third number was zero, was seen. These triples were of course the red, green, and blue bytes. I went no further, but my sense of the matter was, that, if one knew the structure of such-and-such a file format: how long the header was, where to find the row and column counts, at what point the actual pixel data commenced--then one could easily read such data into Mathematica expressions and apply transformations to it. By the same token, knowing a particular file format, one could also use Mathematica to write a pixel-mapped file to disk in that format. Russell Towle Giant Gap Press: books on California history, digital topographic maps P.O. Box 141 Dutch Flat, California 95714 ------------------------------ Voice: (916) 389-2872 e-mail: rustybel@foothill.net ------------------------------
- Follow-Ups:
- Re: reading graphics files
- From: Sean Ross <seanross@worldnet.att.net>
- Re: reading graphics files