LaTeX forum ⇒ LyXpdf to ps conversion results in low quality images Topic is solved

Information and discussion about LyX, a WYSIWYM editor, available for Linux, Windows and Mac OS X systems.
User avatar
Hiram
Posts: 15
Joined: Thu Nov 29, 2012 2:05 am

pdf to ps conversion results in low quality images

Postby Hiram » Fri Sep 04, 2015 10:16 am

Hi folks,

I just upgraded to LyX 2.1.4 and MacTex 2015 and I'm having issues with postscript conversion from pdf now, though I wasn't before I upgraded. I previously was able to output a 700+ page document with images that came to 7.2mb using ps2pdf, or 32mb using pdflatex. Now pdflatex still works fine, but the resulting ps2pdf file results in really bad images and is essentially worthless. I'm attaching a (much smaller) MWE here.

Essentially, when I include a PDF image in a document, it compiles fine using 'pdflatex' but results in a low-quality bitmap image if I compile using 'ps2pdf' or even 'dvi' output. I'm assuming there is something wrong with how LyX/LaTeX is converting the original PDF image into Postscript before re-converting the whole file back to PDF, but I have tried all the different commands I can think of and I can't get any output other than 'pdflatex' to render properly - this is fine for small documents, but not for larger files when I'm trying to keep file size down.

Here's the MWE:
PDF-PS-test.lyx
This is the MWE
(2.38 KiB) Downloaded 243 times

Here's the image file included in the MWE:
Diessel-pragmatics.pdf
Image included as PDF
(41.87 KiB) Downloaded 160 times

Here's what the PDFLATEX output gives:
PDF-PS-test-PDFLATEX.pdf
pdflatex output
(56.34 KiB) Downloaded 198 times

Here's what the PS2PDF/DVI output gives:
PDF-PS-test-PS2PDF.pdf
ps2pdf output
(10.13 KiB) Downloaded 227 times


Any suggestions on how to configure converters, etc... is much appreciated. I may have tweaked my earlier TeX installation, but I thought all the changes I made would have moved over with my 'usr/texlive/local' files. This makes me think that the changes are actually in the newer LyX version - I've still got all my LyX 2.0 settings in a backup folder, so I may simply try to restore from backup and see if that fixes the problem.

Tags:

scottkosty
Site Moderator
Posts: 542
Joined: Sat Sep 01, 2012 6:38 am

Postby scottkosty » Fri Sep 04, 2015 8:44 pm

Hi Hiram,

You can get an idea of what conversions are going on in the background by running LyX with

lyx -dbg graphics

That will show you commands being executed in the background to do the conversions. To modify those commands to your liking, go to Tools > Preferences > File Formats > Converters.

Scott

User avatar
Hiram
Posts: 15
Joined: Thu Nov 29, 2012 2:05 am

Postby Hiram » Sat Sep 05, 2015 7:51 pm

Thanks Scott,

After much troubleshooting, it turned out the problem was that my converter settings were all using 'ps2pdf' and 'pdf2ps' for conversion. Maybe that's the default setting LyX reverts to when reinstalled. Unfortunately, when PDFs are included as images in the LyX document, the 'LaTeX > DVI > ps2pdf' conversion pathway converts all the PDFs to (lossy) EPS/PS images, and then creates a PDF using 'ps2pdf'.

The way I had set it up previously was to convert PDF images within the LyX document to EPS/PS via 'pdftops', which is a Poppler/XPDF converter that doesn't create lossy images (You can download it here: http://www.foolabs.com/xpdf/download.html) and THEN to convert to PDF via 'ps2pdf', which reduces file size.

Unfortunately, when I tried to change the converters back to using 'pdftops', LyX just gave me an error message, but didn't tell me why the error happened. I was able to figure out that the error was due to a missing 'pdftops' binary file thanks to this post: http://www.latex-community.org/forum/vi ... 19&t=21751 - it must have been uninstalled somehow via either the LyX update or the TexLive update. So I downloaded Xpdf again, re-installed it, and now the converters work as before.

Much trial-and-error later, I'm back to producing small PDFs with good-quality images.

Thanks again!
Hiram

scottkosty
Site Moderator
Posts: 542
Joined: Sat Sep 01, 2012 6:38 am

Postby scottkosty » Sat Sep 05, 2015 8:44 pm

Hi Hiram,

Thanks for posting the solution that worked for you! LyX will use what it can find. In some cases it prefers to use one converter, but if it can't find it it tries to use a different converter. So sometimes installing a new converter and going to Tools > Reconfigure can improve things.

Glad you got something that works for you. You might want to back up your preferences (located at ~/.lyx/preferences on Ubuntu) so that if something goes wrong you can always restore.

Scott


Return to “LyX”

Who is online

Users browsing this forum: No registered users and 3 guests