MathGroup Archive 2011

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

Search the Archive

Re: Export

This summary of your bug works in version 8:

rose = Import["ExampleData/rose.gif"];
gif = ExportString[rose, "GIF"];
encoded = ExportString[gif, "Base64"];
ImportString[encoded, "Base64"]

and this modified version also works in version 7:

rose = Import["ExampleData/rose.gif"];
encoded = ExportString[rose, {"Base64", "GIF"}];
ImportString[encoded, "Base64"]

On Jul 26 2009, 8:52 am, Hannes Kessler <HannesKess... at>
> Hello,
> exportingaMathematicaexpressionto animagefile, base64 encoding
> thatfileseems to work improperly. This can be be shown for example
> by re-importing the encodedfiletoMathematica: Import or create anyimageas an example
> rose = Import["ExampleData/rose.gif"]
> Exportingand re-importing as either GIF or Base64 works:
> ImportString[ExportString[rose, "Base64"], "Base64"]
> ImportString[ExportString[rose, "GIF"], "GIF"]
> However, let us now export theimageto GIF or any otherimageformat
> 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 ofexportinga base64 encodedimageis to modify Microsoft
> Word files in XML format as Word stores images in this form.
> Best regards,
> Hannes

  • Prev by Date: Re: Formatting in XLS(X) files
  • Next by Date: Limitation on vector length in NDSolve?
  • Previous by thread: Re: Problems plotting 3D surface and using manipulate
  • Next by thread: Limitation on vector length in NDSolve?