Paint Data Section
This section contains all the data of a picture.
NB: the data on colour pictures and non-8 bit RLE encoding is still somewhat fuzzy.
Size Description
L Size of Paint Data Section (including this long)
L Offset within Paint Data Section of pixel data. Always 28 00 00 00 ?
L X Size of picture in dots
L Y Size of picture in dots
Length X Size of the picture in twips. 00 00 00 00 means unspecified.
Length Y Size of the picture in twips. 00 00 00 00 means unspecified.
L Number of bits in a dot. Usually 02 00 00 00
L 00 00 00 00 for greyscale pictures, 01 00 00 00 for colour (?)
L Always 00 00 00 00 ?
L Encoding (see table below)
L (CA) Always FF FF FF FF ?
L (CA) Always 44 00 00 00 ?
Pixel data
The two longs marked (CA) are only found in a Clip Art File. Their use is unknown. They are not included in the size of the section (first long) and the offset of the pixel data (second long): you should add 8 to both of them.
There are several ways an image may be encoded:
Vlaue Description
00 00 00 00 Plain data
01 00 00 00 8-bit RLE encoding
02 00 00 00 12-bit RLE encoding
03 00 00 00 16-bit RLE encoding
04 00 00 00 24-bit RLE encoding
Though all lines have the same length, this length can be a little larger than the picture X size. The remaining padding should be discarded. The length of a line is always a whole number of longs (after RLE decoding).
8-bit RLE encoding consists of sequences of marker bytes with data bytes. A marker byte of 00 to 7F means that the next byte should be repeated that many times and once more. A marker byte of 80 to FF means that (100-marker) bytes of data follow.
12-bit RLE encoding consists of words. The 4 most significant bits hold the number of repetitions minus 1 of the 12 least significant bits.
16-bit RLE and 24-bit RLE are similar to 8-bit RLE. A marker byte of 00 to 7F means that the next pixel (2 resp. 3 bytes) should be repeated that many times and once more. A marker byte of 80 to FF means that (100-marker) pixels (2 resp. 3 bytes each) of data follow.
After RLE decoding (or right at the start if this was plain data), you are left with a series of bytes. Depending on the number of bits per pixel, you can get any number of colours. Least significant bits are leftmost pixels, and for colour pictures, blue is usually least significant, green is in the middle, and red is most significant.
If the number of bits per pixel equals 2, each byte encodes four pixels. A pixel is two bits wide, and can range from black to invisible:
Value Color
0 Black
1 Dark grey
2 Light grey
3 Invisible
If the number of bits per pixel equals 4, a palette is used for colour images as follows:
Value RGB Color
0 00 00 00 Black
1 55 55 55 Dark grey
2 80 00 00 Dark red
3 80 80 00 Dark yellow
4 00 80 00 Dark green
5 FF 00 00 Red
6 00 FF 00 Green
7 FF FF 00 Yellow
8 FF 00 FF Magenta
9 00 FF 00 Blue
A 00 FF FF Cyan
B 80 00 80 Dark magenta
C 00 00 80 Dark blue
D 00 80 80 Dark magenta
E AA AA AA Light grey
F FF FF FF Whitew
A 8-bit colour palette as below has been found:
Value RGB
00 00 00 00
01 33 00 00
02 66 00 00
03 99 00 00
04 CC 00 00
05 FF 00 00
06 00 33 00
07 33 33 00
08 66 33 00
09 99 33 00
0A CC 33 00
0B FF 33 00
0C 00 66 00
0D 33 66 00
0E 66 66 00
0F 99 66 00
10 CC 66 00
11 FF 66 00
12 00 99 00
13 33 99 00
14 66 99 00
15 99 99 00
16 CC 99 00
17 FF 99 00
18 00 CC 00
19 33 CC 00
1A 66 CC 00
1B 99 CC 00
1C CC CC 00
1D FF CC 00
1E 00 FF 00
1F 33 FF 00
20 66 FF 00
21 99 FF 00
22 CC FF 00
23 FF FF 00
24 00 00 33
25 33 00 33
26 66 00 33
27 99 00 33
28 CC 00 33
29 FF 00 33
2A 00 33 33
2B 33 33 33
2C 66 33 33
2D 99 33 33
2E CC 33 33
2F FF 33 33
30 00 66 33
31 33 66 33
32 66 66 33
33 99 66 33
34 CC 66 33
35 FF 66 33
36 00 99 33
37 33 99 33
38 66 99 33
39 99 99 33
3A CC 99 33
3B FF 99 33
3C 00 CC 33
3D 33 CC 33
3E 66 CC 33
3F 99 CC 33
40 CC CC 33
41 FF CC 33
42 00 FF 33
43 33 FF 33
44 66 FF 33
45 99 FF 33
46 CC FF 33
47 FF FF 33
48 00 00 66
49 33 00 66
4A 66 00 66
4B 99 00 66
4C CC 00 66
4D FF 00 66
4E 00 33 66
4F 33 33 66
50 66 33 66
51 99 33 66
52 CC 33 66
53 FF 33 66
54 00 66 66
55 33 66 66
56 66 66 66
57 99 66 66
58 CC 66 66
59 FF 66 66
5A 00 99 66
5B 33 99 66
5C 66 99 66
5D 99 99 66
5E CC 99 66
5F FF 99 66
60 00 CC 66
61 33 CC 66
62 66 CC 66
63 99 CC 66
64 CC CC 66
65 FF CC 66
66 00 FF 66
67 33 FF 66
68 66 FF 66
69 99 FF 66
6A CC FF 66
6B FF FF 66
6C 11 11 11
6D 22 22 22
6E 44 44 44
6F 55 55 55
70 77 77 77
71 11 00 00
72 22 00 00
73 44 00 00
74 55 00 00
75 77 00 00
76 00 11 00
77 00 22 00
78 00 44 00
79 00 55 00
7A 00 77 00
7B 00 00 11
7C 00 00 22
7D 00 00 44
7E 00 00 55
7F 00 00 77
80 00 00 88
81 00 00 AA
82 00 00 BB
83 00 00 DD
84 00 00 EE
85 00 88 00
86 00 AA 00
87 00 BB 00
88 00 DD 00
89 00 EE 00
8A 88 00 00
8B AA 00 00
8C BB 00 00
8D DD 00 00
8E EE 00 00
8F 88 88 88
90 AA AA AA
91 BB BB BB
92 DD DD DD
93 EE EE EE
94 00 00 99
95 33 00 99
96 66 00 99
97 99 00 99
98 CC 00 99
99 FF 00 99
9A 00 33 99
9B 33 33 99
9C 66 33 99
9D 99 33 99
9E CC 33 99
9F FF 33 99
A0 00 66 99
A1 33 66 99
A2 66 66 99
A3 99 66 99
A4 CC 66 99
A5 FF 66 99
A6 00 99 99
A7 33 99 99
A8 66 99 99
A9 99 99 99
AA CC 99 99
AB FF 99 99
AC 00 CC 99
AD 33 CC 99
AE 66 CC 99
AF 99 CC 99
B0 CC CC 99
B1 FF CC 99
B2 00 FF 99
B3 33 FF 99
B4 66 FF 99
B5 99 FF 99
B6 CC FF 99
B7 FF FF 99
B8 00 00 CC
B9 33 00 CC
BA 66 00 CC
BB 99 00 CC
BC CC 00 CC
BD FF 00 CC
BE 00 33 CC
BF 33 33 CC
C0 66 33 CC
C1 99 33 CC
C2 CC 33 CC
C3 FF 33 CC
C4 00 66 CC
C5 33 66 CC
C6 66 66 CC
C7 99 66 CC
C8 CC 66 CC
C9 FF 66 CC
CA 00 99 CC
CB 33 99 CC
CC 66 99 CC
CD 99 99 CC
CE CC 99 CC
CF FF 99 CC
D0 00 CC CC
D1 33 CC CC
D2 66 CC CC
D3 99 CC CC
D4 CC CC CC
D5 FF CC CC
D6 00 FF CC
D7 33 FF CC
D8 66 FF CC
D9 99 FF CC
DA CC FF CC
DB FF FF CC
DC 00 00 FF
DD 33 00 FF
DE 66 00 FF
DF 99 00 FF
E0 CC 00 FF
E1 FF 00 FF
E2 00 33 FF
E3 33 33 FF
E4 66 33 FF
E5 99 33 FF
E6 CC 33 FF
E7 FF 33 FF
E8 00 66 FF
E9 33 66 FF
EA 66 66 FF
EB 99 66 FF
EC CC 66 FF
ED FF 66 FF
EE 00 99 FF
EF 33 99 FF
F0 66 99 FF
F1 99 99 FF
F2 CC 99 FF
F3 FF 99 FF
F4 00 CC FF
F5 33 CC FF
F6 66 CC FF
F7 99 CC FF
F8 CC CC FF
F9 FF CC FF
FA 00 FF FF
FB 33 FF FF
FC 66 FF FF
FD 99 FF FF
FE CC FF FF
FF FF FF FF