Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2011

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

Search the Archive

Re: Export

  • To: mathgroup at smc.vnet.net
  • Subject: [mg122119] Re: Export
  • From: Chris Degnen <degnen at cwgsy.net>
  • Date: Sat, 15 Oct 2011 06:03:10 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <h4h1vr$ic3$1@smc.vnet.net>

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 hushmail.com>
wrote:
> 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?