Compress

Compress[expr]
gives a compressed representation of expr as a string.

Details and OptionsDetails and Options

  • Compress[expr] gives a compressed representation of any expression.
  • The string generated by Compress contains only printable ASCII characters.
  • Uncompress is the inverse of Compress.

ExamplesExamplesopen allclose all

Basic Examples  (3)Basic Examples  (3)

A compressed representation of with 100-digit precision:

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

Import an image:

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

Number of bytes used to store the image:

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

Number of bytes of a compressed representation of the image:

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

Compress a general expression:

In[1]:=
Click for copyable input

In this case there is almost a factor of 50 compression:

In[2]:=
Click for copyable input
Out[2]=
Introduced in 2007
(6.0)