[net.micro.mac] Thunderscan grey map image and other questions.

frankk@mcvax.UUCP (Frank Kuiper) (12/11/85)

A colleague of mine (Marjo) is trying to understand the file
format of a Thunderscan file. She wants to write a program to 
manipulate the data for a scanned image. The image she wants to
read consists of a photo with much grey values, and on that photo
are certain spots. She wants to do statistical calculations on the
size and the number of those spots.
Therefore she wants to know (and I as well) how to interpret
the scanned-image-file.

In the user gide (on page 57) the header of the file is specified.
We understand most of it, but here are our problems:

1) Offset 2: bounding rectangle (8 bytes);
	We suppose that this is the rectangle of the image to be
	scanned on the ImageWriter (i.e. a photo).
	What we would like to know is, which of the 8 bytes specifies
	what. Are there two bytes per rectangle corner?
	And to what offset on the printer.

2) Offset 12: resolution
	Which resolution is this. The resolution of the Thunderscan
	file image, the screen?

3) This is about the grey map and I quote:
	"The gray map consists of scan lines packed with 4 bits per
	pixel, 2 per byte, followed by remainder bytes (the fifth bit),
	8 per pixel."
	We know that there are 5 bits per pixel specifying the gray values.
	We understand that this information is grouped: two pixels in
	one byte, but what we don't understand is where EXACTLY are
	those fifth bits.
	And what is meant with: "8 per pixel". Is that 8 bits per pixel,
	or 8 bytes (the latter is suggested). If it are 8 bits per pixel
	does that mean that there are three bytes for two pixels?
	The first byte split in two, followed by one byte for pixel_1
	and one byte for pixel_2?

I hope that someone is friendly enough to help us out.
If more people are interested in these answers please e-mail me,
and I will summarize to the net.

Thanks,

               Marjo & Frank

Marjo Rottschaefer                                                    ___   
Frank Kuiper, CWI, Amsterdam.                                    _][__| |
...{decvax,philabs,seismo,okstate,garfield}!mcvax!frankk        <_______|-1
Llanfairpwllgwyngyllgogerychwyrndrobwllllantysiliogogogoch.       O-O-O
-- 

               Frank
                                                                      ___   
Frank Kuiper, CWI, Amsterdam.                                    _][__| |
...{decvax,philabs,seismo,okstate,garfield}!mcvax!frankk        <_______|-1
Llanfairpwllgwyngyllgogerychwyrndrobwllllantysiliogogogoch.       O-O-O

adams1@gumby.UUCP (12/12/85)

> A colleague of mine (Marjo) is trying to understand the file
> format of a Thunderscan file. She wants to write a program to 
...
> Therefore she wants to know (and I as well) how to interpret
> the scanned-image-file.
> 
> 1) Offset 2: bounding rectangle (8 bytes);
The bounding rectangle is relative to the image scanned.  I think it is
in this order: top, left, bottom, right.  The top and left are usually zero.

> 2) Offset 12: resolution
Tells whether this is a bitmap or grey may info, that's all.

> 3) This is about the grey map and I quote:
> 	"The gray map consists of scan lines packed with 4 bits per
> 	pixel, 2 per byte, followed by remainder bytes (the fifth bit),
> 	8 per pixel."
> 	We know that there are 5 bits per pixel specifying the gray values.
> 	We understand that this information is grouped: two pixels in
> 	one byte, but what we don't understand is where EXACTLY are
> 	those fifth bits.
> 	And what is meant with: "8 per pixel". Is that 8 bits per pixel,
> 	or 8 bytes (the latter is suggested). If it are 8 bits per pixel
> 	does that mean that there are three bytes for two pixels?
> 	The first byte split in two, followed by one byte for pixel_1
> 	and one byte for pixel_2?
> 
>                Marjo & Frank
> Marjo Rottschaefer                                                    ___   
> Frank Kuiper, CWI, Amsterdam.                                    _][__| |
> ...{decvax,philabs,seismo,okstate,garfield}!mcvax!frankk        <_______|-1
> Llanfairpwllgwyngyllgogerychwyrndrobwllllantysiliogogogoch.       O-O-O
> -- 

Well, the grey stuff IS a little complicated.  Lets see...  Each pixels
has 5 bits associated with it.  So, we take four of those five (I don't
recall if they are the most-significant or least significant) and
pack them two by two in bytes for one scan line.  Then we pack together
all of the left-over bits, eight per byte (Just string them together.)
I've got MS-BASIC programs that read T-Scan files, and do different things
to them (like smoothing [pixel averaging]).

HOWEVER - I think you can save a lot of work if you get your update
to T-Scan version 2.7 which just came out.  It has an option where you
can select an area, and select Halftone with the Option key down, and it
will write a file on your disk called "HalftoneFile" which has the grey
stuff (AFTER contrast & Brightness & Grey Filter adjustments).  The
pixels are encoded 0 to 31 starting at ASCII "0" (Through "O", I guess).
You could read this file.  (New T-Scan also works with switcher, so
you could have your image analysis program running at the same time.
This gives you the advantage of seeing the part of the picture that you
will be analysing.

I will be putting together some super-fantastic T-Scan support programs
someday when work & school slack me some time (-=*RIGHT*=-)...

Good luck.

Dennis Adams
!uwvax!gumby!adams1
but not very much longer...  semester ends next week!