The Metadata in WEBP files » History » Version 6
Robin Mills, 18 Aug 2016 07:41
1 | 1 | Ben Touchette | h1. The Metadata in WEBP (.webp) files (Under construction) |
---|---|---|---|
2 | |||
3 | Please note: Four bytes words in caps have special significance in this document, which are called Chunk headers, and appear exactly same in the original WebP file. |
||
4 | |||
5 | This page brief is about the WebP type image file container. |
||
6 | |||
7 | h2. What is WebP? |
||
8 | |||
9 | Webp is a structured image container format (similar to the RIFF video format) issued from Google based on technology it acquired from ON2 Technologies. |
||
10 | |||
11 | h2. How it is structured? |
||
12 | |||
13 | 5 | Robin Mills | Everything in WebP is structured in Chunk, sub-chunk hierarchy. Every chunk contains ChunkID, ChunkSize, and ChunkData. First four bytes of a WebP file type must be ASCII values corresponding to the letters *RIFF* followed at offset 8 (in bytes) by the ASCII values corresponding to the letters *WEBP*. This is the ChunkId parent of every other sub-chunk. Similar to the rules dominating RIFF structure which describe how a typical RIFF and WebP file are: |
14 | 1 | Ben Touchette | |
15 | * Every chunk should have ChunkId(four bytes), ChunkSize(four bytes). Do not include size of ChunkId and ChunkSize in ChunkSize. |
||
16 | * ChunkData having odd number of bytes should be padded with one more dummy byte, and ChunkSize is always even. |
||
17 | * ChunkData can be simple data like animation frames, or another Chunk having similar structure as parent Chunk. |
||
18 | * Every chunk will have data which has to be decoded according to either predefined schema or variable size metadata chunks. |
||
19 | 3 | Robin Mills | |
20 | h2. Recovering the metadata in a WebP file |
||
21 | |||
22 | Exiv2 seamlessly parses and presents the metadata in a WebP file in the same way that it does for JPEG, TIFF, PNG and other formats. For example: <pre>509 rmills@rmillsmbp:~/gnu/exiv2/trunk $ exiv2 -pa --grep Model/i test/data/exiv2-bug1199.webp |
||
23 | Exif.Image.Model Ascii 12 NIKON D5300 |
||
24 | 5 | Robin Mills | 510 rmills@rmillsmbp:~/gnu/exiv2/trunk $ </pre>Options are provide by the exiv2 utility to insert, modify and delete delete metadata. Consult man (1) exiv2 for more information. |
25 | 3 | Robin Mills | |
26 | h2. Examining the structure of a WebP file |
||
27 | |||
28 | Exiv2 supports the options -pS and -pR for WebP files. The option -pS reports the structure of a file. For example: <pre>507 rmills@rmillsmbp:~/gnu/exiv2/trunk $ exiv2 -pS test/data/exiv2-bug1199.webp |
||
29 | STRUCTURE OF WEBP FILE: test/data/exiv2-bug1199.webp |
||
30 | Chunk | Length | Offset | Payload |
||
31 | 6 | Robin Mills | RIFF | 187526 | 0 | WEBP |
32 | 3 | Robin Mills | VP8X | 10 | 12 | ,........ |
33 | ICCP | 560 | 30 | ...0ADBE....mntrRGB XYZ ........ |
||
34 | VP8 | 172008 | 598 | .G...*.. .>1..B.!..o.. ......].. |
||
35 | 6 | Robin Mills | EXIF | 12040 | 172614 | II*........................... . |
36 | XMP | 2864 | 184662 | <?xpacket begin="..." id="W5M0Mp</pre>The options -pR recursively prints the structure of a file and recursively descends into XMP, ICC, and EXIF chunks. For Example:<pre> |
||
37 | 4 | Robin Mills | 1202 rmills@rmillsmbp:~/gnu/exiv2/trunk $ exiv2 -pR test/data/exiv2-bug1199.webp |
38 | 3 | Robin Mills | STRUCTURE OF WEBP FILE: test/data/exiv2-bug1199.webp |
39 | Chunk | Length | Offset | Payload |
||
40 | 4 | Robin Mills | RIFF | 187526 | 0 | WEBP |
41 | 1 | Ben Touchette | VP8X | 10 | 12 | ,........ |
42 | ICCP | 560 | 30 | ...0ADBE....mntrRGB XYZ ........ |
||
43 | VP8 | 172008 | 598 | .G...*.. .>1..B.!..o.. ......].. |
||
44 | 4 | Robin Mills | EXIF | 12040 | 172614 | II*........................... . |
45 | STRUCTURE OF TIFF FILE (II): MemIo |
||
46 | address | tag | type | count | offset | value |
||
47 | 10 | 0x0100 ImageWidth | LONG | 1 | 1200 | 1200 |
||
48 | 22 | 0x0101 ImageLength | LONG | 1 | 800 | 800 |
||
49 | ... |
||
50 | 166 | 0x8769 ExifTag | LONG | 1 | 316 | 316 |
||
51 | STRUCTURE OF TIFF FILE (II): MemIo |
||
52 | address | tag | type | count | offset | value |
||
53 | 318 | 0x829a ExposureTime | RATIONAL | 1 | 814 | 814/0 |
||
54 | 330 | 0x829d FNumber | RATIONAL | 1 | 822 | 822/0 |
||
55 | ... |
||
56 | 498 | 0x920a FocalLength | RATIONAL | 1 | 894 | 894/0 |
||
57 | 510 | 0x927c MakerNote | UNDEFINED | 3826 | 902 | Nikon.....II*.....9.+...$...... ... |
||
58 | STRUCTURE OF TIFF FILE (II): MemIo |
||
59 | address | tag | type | count | offset | value |
||
60 | 10 | 0x002b | ASCII | 36 | 698 | 48 49 48 48 0 0 2 0 0 0 0 0 0 0 ... |
||
61 | 22 | 0x002c | ASCII | 1157 | 734 | 48 49 48 49 35 0 128 2 170 1 0 0 ... |
||
62 | ... |
||
63 | 682 | 0x0024 | UNDEFINED | 4 | 65536 | ... |
||
64 | END MemIo |
||
65 | 522 | 0x9286 UserComment | UNDEFINED | 44 | 4728 | ........ ... |
||
66 | ... |
||
67 | 798 | 0xa420 ImageUniqueID | ASCII | 33 | 4788 | 090caaf2c085f3e102513b24750041aa ... |
||
68 | END MemIo |
||
69 | 178 | 0x8825 GPSTag | LONG | 1 | 4822 | 4822 |
||
70 | ... |
||
71 | 5144 | 0x0201 JPEGInterchangeFormat | LONG | 1 | 5178 | 5178 |
||
72 | 5156 | 0x0202 JPEGInterchangeFormatLeng | LONG | 1 | 6861 | 6861 |
||
73 | 3 | Robin Mills | END MemIo |
74 | 4 | Robin Mills | XMP | 2864 | 184662 | <?xpacket begin="..." id="W5M0Mp |
75 | 1203 rmills@rmillsmbp:~/gnu/exiv2/trunk $ </pre> |
||
76 | 1 | Ben Touchette | |
77 | 3 | Robin Mills | h2. Metadata types in WebP |
78 | |||
79 | 4 | Robin Mills | WebP files currently have chunkIDs defined for Exif, XMP, and ICC profiles. IPTC data structures are no normally found in WebP files. However the exiv2 utility is equipped with conversion functions which convert XMP and EXIF metadata into equivalent IPTC Keys. These can be reported. For example: <pre>511 rmills@rmillsmbp:~/gnu/exiv2/trunk $ exiv2 -pi test/data/exiv2-bug1199.webp |
80 | 3 | Robin Mills | Iptc.Application2.ObjectName String 10 Stonehenge |
81 | Iptc.Envelope.CharacterSet String 3 G |
||
82 | Iptc.Application2.Byline String 11 Robin Mills |
||
83 | Iptc.Application2.BylineTitle String 10 Stonehenge |
||
84 | Iptc.Application2.Caption String 12 Classic View |
||
85 | 6 | Robin Mills | 512 rmills@rmillsmbp:~/gnu/exiv2/trunk $ </pre>Please be aware that this is an artefact of the exiv2 utility. The IPTC metadata reported above is not stored in the file and therefore not displayed by metadata applications which do not use libexiv2. For example: Adobe Bridge has metadata inspectors which will not present those IPTC tags. |