Wolfram Language & System 10.4 (2016)|Legacy Documentation

This is documentation for an earlier version of the Wolfram Language.View current documentation (Version 11.2)

WebP (.webp)

BackgroundBackground

    Registered MIME type: image/webp
    WebP raster image format.
    Binary format.
    Stores a single image.
    Stores color bitmaps at a resolution of 8 bits per channel.
    Supports alpha channels.
    Introduced in 2010 by Google to provide both lossy and lossless compression of images on the web.

Import and ExportImport and Export

  • Import["file.webp"] imports a WebP file as an image.
  • Export["file.webp",expr] exports an image, graphics, or any other expression as a raster image to WebP.
  • When exporting Wolfram Language graphics or arbitrary expressions to WebP, the resulting image has the same raster size as its displayed form.
  • Image objects are by default exported at their raster size.
  • Because WebP is a raster image format, all fonts are rasterized on export.
  • Import["file.webp",elem] imports the specified element from a WebP file.
  • Import["file.webp",{{elem1,elem2,}}] imports multiple elements.
  • The import format can be specified with Import["file","WebP"] or Import["file",{"WebP",elem,}].
  • Export["file.webp",expr,elem] creates a WebP file by treating expr as specifying element elem.
  • Export["file.webp",{expr1,expr2,},{{elem1,elem2,}}] treats each as specifying the corresponding .
  • Export["file.webp",expr,opt1->val1,] exports expr with the specified option elements taken to have the specified values.
  • Export["file.webp",{elem1->expr1,elem2->expr2,},"Rules"] uses rules to specify the elements to be exported.
  • See the reference pages for full general information on Import and Export.
  • ImportString and ExportString support the WebP format.

ElementsElements

  • General Import elements:
  • "Elements" list of elements and options available in this file
    "Rules"full list of rules for each element and option
    "Options"list of rules for options, properties, and settings
  • Data representation elements:
  • "Data"array of color values
    "Graphics"Graphics object representing an image
    "Image"raster image, given as an Image object
    "GrayLevels"array of normalized gray-level values
    "RGBColorArray"array of RGBColor objects
    {"Thumbnail",size}thumbnail of a given size (default size = Small)
  • Import and Export by default use the element for WebP files.
  • Advanced Import elements:
  • "BitDepth"bits used to represent each color channel in the file
    "ColorProfileData"embedded color profile, given as a ColorProfileData object
    "ColorSpace"color encoding used in the file
    "ImageSize"raster dimensions

OptionsOptions

  • General option:
  • ImageSizeAutomaticoverall image size
  • Export option:
  • "CompressionLevel"0compression level, given as a number between 0 and 1
  • Import and Export option:
  • "ImageTopOrientation"Automaticorientation of the image as stored in the file

ExamplesExamplesopen allclose all

Basic Examples  (4)Basic Examples  (4)

Import a WebP file as an image:

In[2]:=
Click for copyable input
Out[2]=

Show the elements that can be imported from this file:

In[3]:=
Click for copyable input
Out[3]=

Get the and elements:

In[1]:=
Click for copyable input
Out[1]=

Export arbitrary inline graphics to WebP:

In[1]:=
Click for copyable input
Out[1]=

By default, no compression is used during export:

In[1]:=
Click for copyable input
In[2]:=
Click for copyable input
Out[2]=
In[3]:=
Click for copyable input
Out[3]=

Larger can decrease the file size:

In[4]:=
Click for copyable input
Out[4]=
In[5]:=
Click for copyable input
Out[5]=

Notice decreased quality of the exported image:

In[6]:=
Click for copyable input
Out[6]=

Export a Wolfram Language expression as a raster to WebP:

In[1]:=
Click for copyable input
In[2]:=
Click for copyable input
Out[2]=
Introduced in 2014
(10.0)
| Updated in 2015
(10.3)