Non-Mac PICT Parsing?
20 messages in this thread
There are two 'PICT's common in the Mac World.
(1) A PICT resource is a picture resource, stored in the resource fork of a
file. The structure of a PICT resource, and of a resource fork, is
available in Inside Mac.
(2) A PICT document is a data fork based file of (o/s type) PICT. This is
different from a PICT resource. There is a header on this file of 512
bytes, which can hold info, but frequently doesn't. Traditionally, MacPaint
stored a palette in the header.
So, I guess you're trying to look at #2 above; you remove the MacBinary
header, and then the PICT header, and you get the data which is the
bitmapped picture you're looking for. When this doesn't work, you are
probably looking at #1 above, which is completely different.
Bill S
Mystery solved! I hadn't seen an explanation of the header of 512 bytes.
Thanks for your help.
Read action !
My pleasure.
Bill S
Read action !delete
Deleted
Maybe I can show you what I see, and how I interpret it. Here's the start
of the file I'm decoding. After the PICT2 version $02FF, I see a HeaderOp
$0C00, and skip 24 bytes to location $0228. Then there's a Clip $0001,
followed by the rgbSize $00A0, and a rect bounding box 0,0 480,768. Then
reserved $009A, with data size 0. Then there's $00FF, which looks like the
end of the picture… but it isn't. Where did I go wrong?
0200: 85DA0000 000001E0 03000011 02FF0C00 …………….
0210: FFFE0000 00480000 00480000 00000000 …..H…H……
0220: 01E00300 00000000 0001000A 00000000 …………….
0230: 01E00300 009A0000 00FF8C00 00000000 …………….
0240: 01E00300 00000004 00000000 00480000 ………….H..
0250: 00480000 00100020 00030008 00000000 .H….. ……..
0260: 00000000 00000000 00000000 01E00300 …………….
0270: 00000000 01E00300 00400184 E5D0ECD1 ………@……
0280: E8D2EDD3 E8D4F9D5 F5D5EDD6 E8D7ECD8 …………….
0290: E7D9EBDA 00DBE9DB EDDCEDDD E7DEECDF …………….
02A0: F1E0F8E0 EDE1E7E2 ECE3EDE4 E9E5FAE6 …………….
Read action !re
Enter reply. (/EXIT when done)
1: After the $00FF opEndPic, it's clear the next thing is a pixMap.
2: It describes a pixMap with a packType of 4, which and apixelType of 16,
and 3: cmpSize 88neightther of which I quite understnadunderstandan can explain. After the pixMap, what flollows?
4: /post
Message # 41118 posted
After the $00FF opEndPic, it's clear the next thing is a pixMap. It
describes a pixMap with a packType of 4, and pixelType of 16, neither of
which I can explain. After the pixMap, what follows?
Read action !
Mac Developers Forum Read Menu
Read
1 [NEW] messages
2 Message NUMBER
3 WAITING messages for you (0)
Search [new] messages
4 FROM (Sender)
5 SUBJECT
6 TO (Recipient)
Enter choice !
I really don't have the time right now to do PICT2 detective work with you
(sorry); If I get a chance over the weekend I'll look at the hex you sent.
maybe someone else will chime in though.
Bill S
ps Is this a PICT resource, or a data fork picture of filetype PICT?
Read action !re
Enter reply. (/EXIT when done)
1: It's the data fork of a PICT., saved by Photoshop, Suttuffed, then
2: split on a into data and resource on .
/ 3: post
Message # 41245 posted
What you've got there is a 32-bit PICT. OpCode $9A means DirectBitsRect,
provided that you have 32-bit QuickDraw running. Otherwise, as you've
noted, regular Color QuickDraw sees an unassigned OpCode with a data length
of zero followed by an end-of-picture code. This was done intentionally. A
pixelType of 16 means RGBDirect under 32-bit QD and a packType of 4 denotes
a particular type of run-length encoding that's too involved to go into
here, but it's the default packType used when the pixelSize is 32.
What you need is documentation for 32-bit QuickDraw which, I believe, is
available from APDA.
Read action !re
Enter reply. (/EXIT when done)
1: this documentaThis APDA documentation for 32 bit QuickDraw is more comphreprehensive
tha 2: tn what's available in Inside Mac?
3: /post
Message # 41246 posted
This APDA documentation for 32 bit QuickDraw is more comprehensive than
what's available in Inside Mac?
Read action !
"This APDA documentation for 32 bit QuickDraw is more comprehensive than
what's available in Inside Mac?"
Except for Inside Mac Vol. VI, which hasn't been published yet, there is no
32-bit QuickDraw doc in Inside Mac. The QuickDraw doc in Inside Mac Vol. V
only describes the original "Color QuickDraw", which doesn't support 16-
and 32-bit color.
Read action !re
Enter reply. (/EXIT when done)
1: Thanks, that wasn't clear to m.e.
/ 2: post
Message # 41320 posted
Dear Mr. Syndesis Corp,
Opcode 0x009a and 0x009b are the new opcodes DirectBits and DirectBitsRgn
(respectively) that were added to support 32-Bit direct rgb pixel maps.
These are described in the documentation for 32-Bit QuickDraw. I guess it
was intended by Apple that these opcodes would be self-terminating
(0x000000ff) because the information (32-Bit direct rgb pixel maps) would
be pretty much useless to anyone not expecting it.
Ed Ludwig, Abbott Systems
Read action !re
Enter reply. (/EXIT when done)
1: Where did you ge tt this information? It sounds like thn order to intpererpret PICT
2: an d partcicularly PICT2 on a non-Mac, I'm going to need to know
abou 3: t some of these 'reserved' opcodes like $009A. WhI'm
curio 4: us – if PICT handling is done somewhat transparently
5: on inside a Mac program, then how are y'all able to answer
m 6: y questions about the details of PICTs on disk?
7: /post
Message # 41247 posted
Where did you get this information? In order to interpret PICT and
particularly PICT2 on a non-Mac, I'm going to need to know about some of
these 'reserved' opcodes like $009A. I'm curious – if PICT handling is
done somewhat transparently inside a Mac program, then how are y'all able
to answer my questions about the details of PICTs on disk?
Read action !
John,
The information to parse PICT1 and PICT2 are, unfortunately, scattered over
several sources. PICT1 is covered in a tech note and PICT2 is covered in IM
5. The new 32-Bit opcodes are covered in the docs for 32-Bit QuickDraw,
which are in IM 6 and probably are available from APDA (maybe). Most Mac
programmers that need to figure out what kind of primitives are inside a
PICT dont have to deal with the PICT directly, they let QuickDraw play the
picture back (obviously on the Mac) and set up official hooks (QDProcs –
see IM 1) that QuickDraw uses to draw the basic primitives. These hooks are
called as each primitive in the PICT is scanned by QuickDraw. This lets Mac
programmer know the contents of a PICT without having to understand the
PICT data format.
The reason that I know about this is because I had to write a PICT1 & PICT2
parser for a commercial product that I wrote. I needed a routine that would
scan a file for arbitray clumps of QuickDraw pictures. Since I don't know
where the PICT data is in the file (if it's there at all), I have to search
and validate anything that might look like a pict. Believe me, the routine
was a pain to write. Taking this route means that I will have to keep up
with any new opcodes that Apple adds in the future.
Ed Ludwig, Abbott Systems
Read action !re
Enter reply. (/EXIT when done)
1: Thanks for your help. What product did id incorporates your parser?
2: Also, you're the second person to refer me to Inside Mac Vol 5.6.,,
w 3: hich isn't out yet. Do some people have pre-release copies?
4: .
5: /post
Message # 41321 posted
Thanks for your help. What product incorporates your parser? Also, you're
the second person to refer me to Inside Mac Vol 6, which isn't out yet. Do
some people have pre-release copies?
Read action !
John,
The product's name is "CanOpener" from Abbott Systems. IM 6 was given out
to developers at the Dev Conference 2 years ago. (2 years? Has it been that
long?)
Ed Ludwig, Abbott Systems
Read action !re
Enter reply. (/EXIT when done)
1: What does "CanOpener" do? What machine does it rochine? , and what machine does it roun on?
2: As for IM 6, I realized it's probably on the set of Apple
de 3: veloper CD ROMs that a co-worker has, at an ofiffice where
I' 4: m doing some other consulting. Did you ever find ansource to
5: a PICT or PICT 2 parser, to assit your st your task? I found a very
sim 6: plistic PICT1 parser, in Pascal, in the Symantec forum.
7: /post
Message # 41349 posted
What does "CanOpener" do, and what machine does it run on? As for IM 6, I
realized it's probably on the set of Apple developer CD ROMs that a
co-worker has, at an office where I'm doing some other consulting. Did you
ever find source to a PICT or PICT2 parser, to assist your task? I found a
very simplistic PICT1 parser, in Pascal, in the Symantec forum.
Read action !
Mac Developers Forum Read Menu
Read
1 [NEW] messages
2 Message NUMBER
3 WAITING messages for you (1)
Search [new] messages
4 FROM (Sender)
5 SUBJECT
6 TO (Recipient)
Enter choice !
John,
CanOpener if a file browser/data retriever/simple data librarian that runs
on the Macintosh (all known Macs as of this writing). CanOpener uses a
two-tiered approach to getting useful text, graphics, or sounds out of a
file. The first level is a modular filter approach that is useful if the
data is in an encrypted form. The filters are plug-in modules that are file
type specific. The second tier are the generic text and picture extractors
that are built in to CanOpener. If no filters exist for a specific file,
these extractors go to work. The text extractor has the ability to enter
any file and retrieve and concatenate any bits of what it call "useful"
text, and then to apply a cleanup algorithm to the text so that it comes
out reasonably free of garbage. The picture extractor scans the file for
blocks of data that "look" like quickdraw PICT data. It has to look at the
data very carefully, to avoid passing quickdraw a non-picture. In answer to
your second question, unfortunately, I had no help. I wish I had had some
code to at least peek at!
I work alot with various types of files that store PICT data all over the
place. I use CanOpener to extract as well as validate the pictures in these
files. It also has the ability to save this data to disk and to copy it to
the clipboard.
CanOpener's main end user use at this point seems to be extracting ascii
text from corrupted WP and DTP files and general browsing.
Ed <who probably told you more than you wanted to know> Ludwig, Abbott
Systems
Read action !re
Enter reply. (/EXIT when done)
1: No, that was exactly the depth I wanted to hear. Thanks for the
e 2: xplanation. CanOpener is a commercial preooduct?
3: /post
Message # 41394 posted
No, that was exactly the depth I wanted to hear. Thanks for the
explanation. CanOpener is a commercial product?
Read action !