MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive


  • To: mathgroup at
  • Subject: [mg102005] Export
  • From: Hannes Kessler <HannesKessler at>
  • Date: Sun, 26 Jul 2009 03:55:24 -0400 (EDT)


exporting a Mathematica expression to an image file, base64 encoding
that file seems to work improperly. This can be be shown for example
by re-importing the encoded file to Mathematica: Import or create any
image as an example

rose = Import["ExampleData/rose.gif"]

Exporting and re-importing as either GIF or Base64 works:

ImportString[ExportString[rose, "Base64"], "Base64"]
ImportString[ExportString[rose, "GIF"], "GIF"]

However, let us now export the image to GIF or any other image format
and base64 encode the GIF

gif = ExportString[rose, "GIF"];
encoded = ExportString[gif, "Base64"];

Re-importing the encoded version without specified format gives a list
of still encoded strings:


Re-importing the encoded version with specified format fails giving an
error messages "Import::fmterr : Cannot import data as GIF format"
followed by further error messages

ImportString[encoded, "Base64"]

Did I miss something or is this a bug of Export? By the way, my
purpose of exporting a base64 encoded image is to modify Microsoft
Word files in XML format as Word stores images in this form.

Best regards,

  • Prev by Date: Re: solving a system of two equations
  • Next by Date: Re: solving a system of two equations
  • Previous by thread: Re: freeing memory used by Import[]
  • Next by thread: Copy As MathML Weirdness