Export
- To: mathgroup at smc.vnet.net
- Subject: [mg102005] Export
- From: Hannes Kessler <HannesKessler at hushmail.com>
- Date: Sun, 26 Jul 2009 03:55:24 -0400 (EDT)
Hello, 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: ImportString[encoded] 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, Hannes