[Date Index] [Thread Index] [Author Index]
Re: how to select all graphics in a notebook?
On May 24, 12:53 am, John Fultz <jfu... at wolfram.com> wrote: > On Fri, 23 May 2008 03:09:05 -0400 (EDT), GS wrote: > > In version 5 of Mathematica I used a pallete SelectAll.nb (http:// > > support.wolfram.com/mathematica/interface/customize/selectall.en.html) > > to select all graphics cells in an open notebook. The selection is > > implemented via command NotebookFind[SelectedNotebook[ ], "Graphics", > > All, CellStyle]. Unfotunately, it does not work any more with version > > 6 of Mathematica. > > > Does anybody know how to select all graphics in a notebook at once? I > > do not want to go through menu and click on each cell. I have many > > plots in my notebooks, and to save space I would like to select them > > all, and then convert into bitmap. > > > Thank you. > > GS > > Interestingly, we had a similar problem when generating our help notebooks. > With thousands of notebook files, we wanted to reduce space without > fundamentally changing the notebook format or introducing intermediate > steps, so that customers could reasonably download a product image from > the Wolfram store with full documentation. > > To resolve this, I created a method for converting cells to bitmaps > conditionally based upon whether doing so would actually reduce the byte count > of the file. As a part of the documentation build process, this is applied to > all output cells. This means that some graphical output cells are not bitmaps > (because the underlying expression was smaller than the bitmap), and also that > some textual outputs are bitmaps (because the bitmap compressed even better than > the textual representation). Additionally, the conditional conversion will > refuse to convert any cell with a Dynamic inside of it, so that interfaces > will continue to function. > > To invoke this functionality, do... > > NotebookFind[InputNotebook, "Output", All, CellStyle]; > FrontEndTokenExecute[ > InputNotebook, "SelectionConvert", "BitmapConditional"]; > > Sincerely, > > John Fultz > jfu... at wolfram.com > User Interface Group > Wolfram Research, Inc. Thank you John for the detailed answer. Indeed, this small piece of code in many cases does the job. However, it turns out that on some occasions, (with large notebooks, 50-80 MB) the code crashes Mathematica. I am using version 6.0.2 on Windows XP. GS