I have a LyX file with a PSTricks picture. Currently, when I want to convert it to a PNG image, I save the file as PS, then open the PS in gimp, then save it as PNG. Is there a way to save to PNG directly from LyX?

  • 2
    thta's possible. You can create a LyX layout for the documentclass standalone, then you can configure it to create a png output – user2478 Dec 23 '13 at 21:01
  • "You can create a LyX layout for the documentclass standalone" - how can I do this? – Erel Segal-Halevi Dec 24 '13 at 8:15
  • 1
    copy the article.layout from (on Linux) usr/share/lyx/layouts/ into your local LyX directory (on Linux) ~/.lyx/layouts/ and edit the line with \DeclareLayTeXClass{article}. Change article to standalone and then rename the file to standalone.layout and run from within LyX the option Reconfigure. Restart LyX and then the standalone class should be available. Read the documentation of standalone how PSTricks examples should be used and how you can a cropped pdf or png output. – user2478 Dec 24 '13 at 8:57
  • Is there a reason that you prefer to use PNG instead of PS? Since PS is a vector format, it is better at preserving image quality. – landroni Dec 26 '13 at 9:55
  • @Liviu I want to include the PNG in a presentation, and PNG is better supported by presentation software. – Erel Segal-Halevi Dec 26 '13 at 9:59

If you must use MS PowerPoint or LibO Impress to create the presentation, then you could define a Postscript -> PNG or EPS -> PNG converter in LyX (I'm not sure which one's more appropriate so feel free to experiment) using ImageMagick's convert.

In practice this might be easier as the converters seem to be already in place, with only minor tweaks needed: in 2.0.6 try Tools > Prefs > File > Formats > PNG then check Document format and Show in export menu (also consider setting the Viewer to something less heavy than GIMP). Then you should be able to File > Export > PNG.

Does it work?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.