OpenersPrimaryExamplesSection(Spacer1)Examples  (3)

OpenersExampleSection0(Spacer1)Basic Examples  (2)

Export a string to a GZIP-compressed text file:

ExportString[ "A System for Doing Mathematics by Computer", {"GZIP", "Text"} ]

Convert the previous output back to a Wolfram Language string:

ImportString[%]

This exports graphics to a GZIP-compressed JPEG file:

Export["cat.jpg.gz",]

This gives the available (RefLink[Import, paclet:ref/Import]) elements of the JPEG file:

Import["cat.jpg.gz","Elements"]

When importing any element from a .gz file, the Wolfram Language automatically uncompresses it:

Import["cat.jpg.gz","ImageSize"]

OpenersExampleSection4(Spacer1)Export Options  (1)

OpenersExampleSubsection0(Spacer1)"CompressionLevel"  (1)

By default, the maximum amount of compression is used:

ExportString[, { "GZIP", "PNG"}]//ByteCount

This is equivalent to "CompressionLevel"->1:

ExportString[,{"GZIP","PNG"},"CompressionLevel"->1]//ByteCount

Specify the minimum amount of compression:

ExportString[,{ "GZIP","PNG"},"CompressionLevel"->0]//ByteCount

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {Related Formats:  (RefLink[BZIP2, paclet:ref/format/BZIP2])  ▪  (RefLink[Directory, paclet:ref/format/Directory])  ▪  (RefLink[TAR, paclet:ref/format/TAR])  ▪  (RefLink[ZIP, paclet:ref/format/ZIP])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Compression and Archive Formats, paclet:guide/CompressionAndArchiveFormats])}, {▪(RefLinkPlain[Importing & Exporting, paclet:guide/ImportingAndExporting])}, {▪(RefLinkPlain[Listing of All Formats, paclet:guide/ListingOfAllFormats])}, {▪(RefLinkPlain[New in 6.0: Data Handling & Data Sources, paclet:guide/NewIn60DataHandlingAndDataSources])}, {▪(RefLinkPlain[New in 6.0: Import & Export Formats, paclet:guide/NewIn60ImportAndExportFormats])}, {▪(RefLinkPlain[Systems & Utility Formats, paclet:guide/SystemsAndUtilityFormats])}})}})