MathGroup Archive 1999

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

Search the Archive

Re: Programming the front end to save graphics files

  • To: mathgroup at smc.vnet.net
  • Subject: [mg15711] Re: Programming the front end to save graphics files
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Fri, 5 Feb 1999 03:42:11 -0500 (EST)
  • Organization: Universitaet Leipzig
  • References: <79531n$kc9@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi Malcom,

why use the frontend ?

Say You have a notebook (the simples way is
nb=NotebookGet[SelectedNotebook[]];)

than the function

SaveGraphicCells[nb_Notebook,fpre_String,type_:"EPS"]:=
  Module[{gc,fname,slst},
    gc=Cases[nb,Cell[_,"Graphics",___],Infinity];
    slst=MapIndexed[(
             fname=fpre <>ToString[First[#2]]<> "."<>ToLowerCase[type];
             Display[fname,#1,type];fname
            )& ,
           gc
          ];
   slst
  ]
	

will save graphic cells if you write

SaveGraphicCells[nb,"test","EPS"]

Hope that helps
  Jens


Malcolm Boshier wrote:
> 
>     Since the kernel function Display[ ] can't save graphics in the
> Windows bitmap format, I'm trying to program the front end to do it via
> the Save Selection As... menu option.  I know that it's straightforward
> to use Display[ ] to save the cells as PBM's and then convert these
> files to BMPs using a suitable program, but using the front end
> directly would be simpler and knowing how to program it seems like a
> useful skill, so I'd like to get this working.
>     So far I've found that the selecting a graphic and then executing
> the command
> 
>                   FrontEndExecute[FrontEndToken[nb,
> "SelectionSaveSpecial","MGF"]]
> 
> brings up the file Save As dialog box and then saves the graphics
> correctly when the filename is typed in.  I'd eventually like to write
> a function which looks like Display[ ], so I'd obviously like to avoid
> the Save As dialog box - does anybody know if it's possible to include
> a channel or filename directly in the expression above, or bypass the
> dialog box in some other way?
> 
> thanks,
> Malcolm


  • Prev by Date: Speed (resumed)
  • Next by Date: How to use DisplayTogether[] properly?
  • Previous by thread: Programming the front end to save graphics files
  • Next by thread: Mathematica as an Object