LyX ⇒ pdf to ps conversion results in low quality images
pdf to ps conversion results in low quality images
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: Here's the image file included in the MWE: Here's what the PDFLATEX output gives: Here's what the PS2PDF/DVI output gives: 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.
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
-
- Site Moderator
- Posts: 542
- Joined: Sat Sep 01, 2012 6:38 am
Re: pdf to ps conversion results in low quality images
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
Re: pdf to ps conversion results in low quality images
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
-
- Site Moderator
- Posts: 542
- Joined: Sat Sep 01, 2012 6:38 am
Re: pdf to ps conversion results in low quality images
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