On Dec 3, 2013, at 6:44 PM, Jens Nöckel <noec...@uoregon.edu> wrote:

> 
> On Dec 3, 2013, at 2:14 PM, Jerry wrote:
> 
>> 
>> On Dec 3, 2013, at 1:53 PM, Stephen Buonopane <sbuon...@bucknell.edu> wrote:
>> 
>>> Try the solution given here…
>>> http://michael.orlitzky.com/articles/fixing_pdf_graphics_in_lyx.php
>>> which creates a direct conversion from pdf to png.
>>> 
>>> It solved a related problem for me in the past where the conversion through 
>>> eps subtly changed the graphics dimensions making on screen cropping near 
>>> impossible.
>> 
>> Thanks, Stephen! That has fixed the problem.
>> 
>> There remain some unanswered questions. It looks like the converter pdftops 
>> is broken, at least on my machine. Your fix bypassed it, and elsewhere in 
>> this thread I reported that a manual conversion created an EPS file that was 
>> invalid. Is this a known problem?
>> 
>> Since PDF is truly a native file format on OS X, it seems that your fix 
>> should be incorporated into LyX permanently because OS X users are trying to 
>> paste PDFs into LyX very frequently. Have you suggested this fix to the 
>> developers?
>> 
>> Jerry
> 
> 
> As an alternative to Stephen's suggestion, you could also add the following 
> converter for PDF to PNG. In my preferences, I chose the "From format" as 
> 
> PDF (ps2pdf)
> 
> and entered this code for "Converter":
> 
> sips -s format png $$i --out $$o
> 
> This uses the OS X built-in command sips instead of Ghostscript.

Thanks for that tip, Jens. I really like the idea of using OS X's built-in 
image processing. However, this command scales the image by 200% so I added an 
option to scale to a width of 560 pixels which seems comfortable for me, and 
preserves the aspect ratio. (I know that I could use LyX to scale the on-screen 
size manually but this is laborious and makes the image ugly.)

In addition, there is a pink background behind the image which I don't like and 
which the GhostScript-and-convert command suggested earlier in the thread does 
not do. This is fixed by Preferences -> Look and Feel -> Colors -> graphics 
background to white, but that leaves the question of why the GhostSript 
approach did not result in a pink background--I'l bet it did not render the PDF 
with a solid background but left it transparent. This (putting a solid 
background) can be an issue which causes the image to appear bigger than it is 
and can cause centering problems in the output PDF, but I'll leave that to 
solve another day.

So for the record, the sips command I'm using is:

sips --resampleWidth 560 --setProperty format png $$i --out $$o

Again, thanks.

Jerry

Reply via email to