The Metadata in WEBP files » History » Revision 3
The Metadata in WEBP (.webp) files (Under construction)¶
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.
This page brief is about the WebP type image file container.
What is WebP?¶
Webp is a structured image container format (similar to the RIFF video format) issued from Google based on technology it acquired from ON2 Technologies.
How it is structured?¶
Everything in WepB 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:
- Every chunk should have ChunkId(four bytes), ChunkSize(four bytes). Do not include size of ChunkId and ChunkSize in ChunkSize.
- ChunkData having odd number of bytes should be padded with one more dummy byte, and ChunkSize is always even.
- ChunkData can be simple data like animation frames, or another Chunk having similar structure as parent Chunk.
- Every chunk will have data which has to be decoded according to either predefined schema or variable size metadata chunks.
Recovering the metadata in a WebP file¶
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:
509 rmills@rmillsmbp:~/gnu/exiv2/trunk $ exiv2 -pa --grep Model/i test/data/exiv2-bug1199.webp Exif.Image.Model Ascii 12 NIKON D5300 510 rmills@rmillsmbp:~/gnu/exiv2/trunk $Options are provide by the exiv2 to insert, modify and delete delete metadata. Consult man (1) exiv2 for more information.
Examining the structure of a WebP file¶
Exiv2 supports the options -pS and -pR for WebP files. The option -pS reports the structure of a file. For example:
507 rmills@rmillsmbp:~/gnu/exiv2/trunk $ exiv2 -pS test/data/exiv2-bug1199.webp STRUCTURE OF WEBP FILE: test/data/exiv2-bug1199.webp Chunk | Length | Offset | Payload RIFF | 187536 | 0 | WEBP VP8X | 10 | 12 | ,........ ICCP | 560 | 30 | ...0ADBE....mntrRGB XYZ ........ VP8 | 172008 | 598 | .G...*.. .>1..B.!..o.. ......].. EXIF | 12050 | 172614 | ../.Exif..II*.................. XMP | 2864 | 184672 | <?xpacket begin="..." id="W5M0MpThe options -pR recursively prints the structure of a file and descends into TIFF, ICC, IPTC, Exiv2 data structures. For Example:
508 rmills@rmillsmbp:~/gnu/exiv2/trunk $ exiv2 -pR test/data/exiv2-bug1199.webp STRUCTURE OF WEBP FILE: test/data/exiv2-bug1199.webp Chunk | Length | Offset | Payload RIFF | 187536 | 0 | WEBP VP8X | 10 | 12 | ,........ ICCP | 560 | 30 | ...0ADBE....mntrRGB XYZ ........ VP8 | 172008 | 598 | .G...*.. .>1..B.!..o.. ......].. EXIF | 12050 | 172614 | ../.Exif..II*.................. STRUCTURE OF TIFF FILE (??): MemIo END MemIo XMP | 2864 | 184672 | <?xpacket begin="..." id="W5M0Mp 509 rmills@rmillsmbp:~/gnu/exiv2/trunk $
Metadata types in WebP¶
WebP files currently have chunkIDs defined for Exif, XMP, and ICC profile. 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:
511 rmills@rmillsmbp:~/gnu/exiv2/trunk $ exiv2 -pi test/data/exiv2-bug1199.webp Iptc.Application2.ObjectName String 10 Stonehenge Iptc.Envelope.CharacterSet String 3 G Iptc.Application2.Byline String 11 Robin Mills Iptc.Application2.BylineTitle String 10 Stonehenge Iptc.Application2.Caption String 12 Classic View 512 rmills@rmillsmbp:~/gnu/exiv2/trunk $Please be aware that this is an artefact of the exiv2 application. The IPTC metadata reported above is not stored in the file and therefore is probably not displayed by metadata applications which do not use libexiv2. For example: Adobe Bridge has metadata inspectors which will not present those IPTC tags.