File Formats: WebP (original) (raw)
The WebP Format is a file format created by Google to provide superior lossless and lossy compression for images on the web. The file format has two forms:
- single page (WebP)
- multipage animation (WebP ANI)
The file format is supported by all the major web browsers and the Windows operating system starting with version 10. For information on WebP support in other Operating Systems, refer to the following:
The animation format contains the auto-loop feature in GIF. The animation is 24-bit, which means the quality of a WEBP animation will be higher than a GIF animation.
The format uses 24 or 32-bits/pixel. The 32-bit file uses alpha channel transparency, where pixels can range from fully transparent to fully opaque.
Note
When saving 32-bit files, the alpha channel might be discarded if the encoder detects that all the alpha values are 0xFF. In this case, the output file becomes 24-bit rather than 32-bit.
The lossy single page format is intended to replace JPEG. The lossless single page is intended to replace PNG and GIF. The animated files are intended to replace animated GIFs.
Compression
The WEBP format uses VP8 compression (lossy or lossless). WEBP lossless images are 26% smaller than PNG and WEBP lossy images are 25-34% smaller than JPEG files of similar size according to Google, the format's creator.
The WEBP files use the extension .webp
.
LEADTOOLS supports single-page files and animations. Each of these can be saved with lossy or lossless compression.
Features
- Alpha channel/transparency information. The 32-bit file contains a transparency channel. For these files, alpha of 0 represents transparent pixels, 255 represents opaque pixels, and alpha of 1-254 values represent translucent pixels.
- Still frame and animation support. Animated files use the alpha channel transparency to reduce the file size. The animated files can be restarted automatically using a loop setting to create the infinite animations that are so popular on the web.
- Exif metadata, which can contain the comments and tags supported by TIFF and EXIF. WEBP files can contain an embedded TIF file that contains only tags and comments information (no image data). Consequently, any metadata that can be saved in TIFF/Exif files can be saved in WEBP as well.
- Use the L_ReadFileComment or L_ReadFileComments function to read comments from an existing file. Before writing a file, use the L_SetComment function to create an array of comments to be saved in the file. See the Exif File Comments for the list of comments supported. Use L_WriteFileComment to write comments to an existing file.
- Use L_ReadFileTag2 to read TIFF/Exif tags from an existing WEBP file. Use L_SetTag before calling the save function to add your own custom tags to the output file. Use L_WriteFileTag to add TIFF tags to an existing file.
- Use L_WriteFileMetadata to write comments, tags and GeoKeys to an existing file.
- The functions listed above are the most common functions for working with Exif metadata. Refer to Implementing TIFF Comments and Tags for more details.
- XMP Metadata. Use L_ExtractXMPMetadata and L_SaveXMPMetadata to read and write the XMP metadata from/into WEBP files.
- ICC Profiles. Use L_LoadICCProfile and L_SaveICCProfile to read and write ICC profiles from/to WEBP files.
- Lossy/Lossless compression. Save lossy files by setting
qFactor
between 1 (highest quality, lowest compression) to 255 (lowest quality, highest compression). Use aqFactor
of 0 to save lossless files. - Thumbnails (Stamps). Use L_ReadFileStamp2 to read a thumbnail. You can save a stamp by setting the
ESO_SAVEWITHSTAMP
flag in the SAVEFILEOPTION.Flags structure member prior and setting the stamp width, height and bits per pixel to calling the save function. Or use L_WriteFileStamp to write a stamp bitmap to an existing file.
File constants associated with this file format are:
Constant | Read Support | Write Support | Description |
---|---|---|---|
FILE_WEBP | 24, 32 | 24, 32 BPP | [404] Single-page WEBP file. |
FILE_WEBP_ANI | 24, 32 | 24, 32 BPP | [405] Animated WEBP file. |
Required DLLs and Libraries
- LFWEBP
- For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.
Related Formats
Platforms
Win32, x64, UWP, Linux, Android, iOS.