[comp.sys.mac.programmer] PICT hacking question

minow@mountn.dec.com (Martin Minow) (07/02/90)

I'm trying to clean up a scanned image that is stored in a PICT file.  I
read the image into an offscreen bitmap (using the picFrame to define
the bitmap's size) and eventually write the cleaned up bitmap (noise
filtered) to another PICT file.

The original image was scanned at 300 dpi.  When I look at the output
image (even without processing), it is clearly at a coarser resolution
(probably 72 dpi).

Could anyone tell me how I get the actual image at its intended resolution
(both into my program and out to a new PICT file)?  Inside-Mac and the
TechNotes stack don't seem to have anything relevant.

Surely I don't have to parse the PICT internal format?  Hopefully, I won't
have to find the source to NCSA Image (which didn't do what I wanted, but
I only tried for a half-hour).  All suggestions are welcome.

Thanks.

Martin Minow
minow@bolt.enet.dec.com

hildreth@cg-atla.agfa.com (Lon Hildreth) (07/03/90)

In article <1732@mountn.dec.com> minow@bolt.enet.dec.com (Martin Minow) writes:
>The original image was scanned at 300 dpi.  When I look at the output
>image (even without processing), it is clearly at a coarser resolution
>(probably 72 dpi).
>
>Could anyone tell me how I get the actual image at its intended resolution
>(both into my program and out to a new PICT file)?  Inside-Mac and the
>TechNotes stack don't seem to have anything relevant.
>
You need to put yourself in the StdBits bottleneck during playback.  The
hRes and vRes fields of the srcBits passed in contain the horizontal and
vertical resolution of the image in dots per inch.  They're Fixed point
numbers, so you can call Fix2Long on them to get usable numbers.  First,
make sure that srcBits is a PixMap by checking the high bit of rowBytes.

For creating a new PICT, make sure that the hRes and vRes fields of your
source pixmap is set properly.  Also, the dest rect of the CopyBits call
should be at 72 dpi.


-- 
Lon Hildreth		...!{decvax,uunet,samsung}!cg-atla!hildreth
Agfa Compugraphic		or	hildreth@cg-atla.agfa.com
Wilmington, MA		A Cub fan, but not a Bud man.