Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I wrote a little script to convert various graphics files (.ps, .eps, .pdf) to the raster ones (.png). Export[out, Import[in], ImageSize -> size] fails for some files without any message at an import step: Import[in] === $Failed (well, there’s another issue, something wrong with input files, maybe?). Albeit, Inkscape does the work well via inkscape $in -w $size -e $out -z. The problem is: Mathematica’s Run doesn’t like Inkscape.

In[]:= Run["inkscape -z file.ps"]
(*
Emergency save activated!
Emergency save completed. Inkscape will close now.
If you can reproduce this crash, please file a bug at www.inkscape.org
with a detailed description of the steps leading to the crash, so we can fix it.
** Message: Error: Inkscape encountered an internal error and will close now.
*)
Out[]= 139

I tried in a notebook, in a shell mode, in a Mathematica‌Script. Other GUI programs Run properly. A PHP equivalent I had to write

passthru("inkscape $in -w $size -e $out -z")

works well, as do bare bash.

What is this hatred between Inkscape and Mathematica? Can you reproduce this behaviour? Mathematica 9 at Scientific Linux is used.

share|improve this question
    
Try to use convert from ImageMagick or upgrade to version 10 (if your license allows) and try this. –  Szabolcs Jul 16 at 15:30
    
@Szabolcs, I’m going to upgrade as soon as possible. So, in 10 it is solved, isn’t it? (Can’t wait!) Thanks for proposing ImageMagick, great. But what if I want to deal with vectors? –  McSaks Jul 16 at 15:39
    
Sorry, I should have said it clearly that I did not test this. I do not have inkscape installed and I do not use Linux. It is my suspicion that it might work with this new functionality, but I do not know this for certain. I might be wrong. –  Szabolcs Jul 16 at 15:41
    
I know for example that when using the front end, Run["python"] exits immediately, probably because there's no stdin. But StartProcess["python"] lets python keep running until it is explicitly shut down. I'm on OS X, so similar to Linux. –  Szabolcs Jul 16 at 15:44
    
@Szabolcs, Run["python"] works in terminal. Run["inkscape"] or Run["inkscape -z file"] does not. Run["inkscape -z"] works but only prints ‘Nothing to do!’, not very useful. That’s weird… –  McSaks Jul 16 at 15:54

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.