MathGroup Archive 2009

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

Search the Archive

Paste image directly into V7 notebook on Linux/X11

  • To: mathgroup at
  • Subject: [mg99032] Paste image directly into V7 notebook on Linux/X11
  • From: jkerrb at
  • Date: Fri, 24 Apr 2009 03:48:59 -0400 (EDT)


Yesterday I called Wolfram Research to find out how to paste images
into a version 7 notebook directly from the X11 clipboard on Linux.
The tech stated that this is feature is supported only on windows and
mac, not linux. So I implemented it myself. Here's how:

I'm running KDE4.2, and Klipper does not paste image data, so dbus is
not an option. I settled on using Qt: you will need the command
"getclipboardimage" installed on your $PATH (Qt 4.4 source code and
instructions available at
Perhaps someone could suggest how to do this from perl or python,

Adding the "Paste Image" to the edit menu involves editing a user-copy
of $InstallationDirectory/SystemFiles/FrontEnd/TextResources/X/ Caution: a typo in this file can break mathematica.

Add the following between the &Paste and Clea&r\tDelete menu items:

       MenuItem["Paste &Image",
                 KernelExecute[{Module[{tmpFile, image, file},
                                 tmpFile = ToFileName
[$TemporaryDirectory, "clipboardimagefileformathematica.png"];
                                 file = Import["!getclipboardimage "
<> tmpFile, "Lines"];
                                 If[Length[file] > 0, image = Import
[file[[1]], "Image"];
                                    If[Head[image] === Image,
                 MenuKey["V", Modifiers->{"Control"}], MenuEvaluator-

Restart mathematica. Try it out by opening a PDF file, selecting an
image and copying it to the clipboard. In a notebook select "Paste
Image" from the Edit menu. This inserts the image in-line.


  • Prev by Date: Re: FindFit tips
  • Next by Date: Re: Re: pure function with optional number of arguments
  • Previous by thread: Re: Re: Mathematica JLink and comm.javax.CommPortIdentifier
  • Next by thread: Re: Paste image directly into V7 notebook on Linux/X11