Hello,

the problem seemed to be an incompatibility of the ImageMagick and Ghostscript versions that are shipped with MacTeX-2007 (I used 20070520).

\ImageMagick 6.3.3 03/06/07 Q16 http://www.imagemagick.org
GPL Ghostscript 8.57 (2007-05-11)


LyX calls convertDefault.py, which calls ImageMagick's convert, which calls gs, with a parameter '-sDEVICE=pam' which my ghostscript does not support.

The following posting
http://www.imagemagick.org/discourse-server/viewtopic.php?f=1&t=8353
suggest to change this parameter to -sDEVICE=bmpsep8. This did not work very well for my images. This is what I did and seems to work (I am not sure of any side effects though this might imply):

Edit the file
/usr/local/lib/ImageMagick-6.3.3/config/delegates.xml
and replace the occurence of "-sDEVICE=pam" by "-sDEVICE=ppm".

Regards,
Konrad


Konrad Hofbauer wrote:
Gerard,

thanks for your investigations!
I tried what you suggested but it still does not work.

My ImageMagick (convert) is I assume the one that is by default installed by the MacTeX package. It lives in the default locations /usr/local/bin and /usr/local/lib.

Nevertheless I tried to set the variables you suggested:

dhcp-50-221:~ khofbaue$ cat .MacOSX/environment.plist <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd";>
<plist version="1.0">
<dict>
        <key>DYLD_LIBRARY_PATH</key>
        <string>/usr/local/lib</string>
        <key>MAGICK_HOME</key>
        <string>/usr/local</string>
</dict>
</plist>

And I also reverted the security patch you mentioned:
dhcp-50-221:~ khofbaue$ ls /var/db/.AllowDYLDEnvironmentVariables
-rw-r--r-- 1 root wheel 0 Sep 18 10:27 /var/db/.AllowDYLDEnvironmentVariables

I also rebooted and reconfigured LyX after these changes. I also (independently) tried to set the variables in LyX's info.plist.

However, LyX still does not display eps figures.

Any further ideas?

Thanks,
Konrad


Gerard Ateshian wrote:
Konrad,

I had the same problem recently as well. I traced it to my new installation of ImageMagick.

I had downloaded the latest version of ImageMagick onto my Mac (binary release from http://www.imagemagick.org/script/index.php) and installed it according to the instructions on the website. Unlike my earlier installation, which placed the binary files in /usr/local/bin and library files in /usr/local/lib, this version put them in /usr/local/ImageMagick-6.3.5/bin and /usr/local/ImageMagick-6.3.5/lib . The installation instructions say to define the environmental variables MAGICK_HOME=/usr/local/ImageMagick-6.3.5 and DYLD_LIBRARY_PATH=$MAGICK_HOME/lib. This works fine when running LyX from a Terminal window. However clicking on the LyX icon directly fails to provide these environmental variables to ImageMagick.

At first, searching the web, I found instructions to define these environmental variables through the RCEnvironment preference pane (freeware, http://www.rubicode.com/Software/RCEnvironment/). However, I found that RCEnvironment only sets the MAGICK_HOME environment, but fails to set DYLD_LIBRARY_PATH.

After much frustration, I found that the problem can be traced to a recent (May 07) security update in Mac OS X 10.4.9 (http://docs.info.apple.com/article.html?artnum=305509). The workaround, as indicated on Apple's website, is either to modify the Info.plist file in the LyX.app folder (which didn't work for me, perhaps I am missing something) or restore the pre-update permission to set DYLD_LIBRARY_PATH (which worked, but presumably defeats the security update). After implementing the suggested change (and using RCEnvironment to set MAGICK_HOME and DYLD_LIBRARY_PATH, and including /usr/local/ImageMagick-6.3.5/bin in the LyX path), I got ImageMagick to work again.

Gerard

On Sep 17, 2007, at 3:10 PM, Konrad Hofbauer wrote:

Hello,

I am sure it is something on my side (as nobody else complained about this so far), but I cannot figure out where the problem is.

I fairly recently made a new install on an Intel-based Apple using a standard install of MacTeX-20070520.dmg, and I also updated to LyX 1.5.1.

However, EPS files do not show up in LyX anymore (Error converting to loadable format). They are fine in the Latex output.

Removing the LyX-1.5 directory in ~/Library/Application Support (so that a new configuration is created) does not change anything.

Below the console output, the convert-version, and the (longish) debug output from "lyx -dbg graphics"

Basically, LyX uses convertDefault.py which complains about:
> Unknown device: pam
> Unrecoverable error: undefined in .uninstallpagedevice
> Operand stack:
>     defaultdevice

Any ideas what this could mean?

Thanks,
/Konrad



The console.log says:
Unknown device: pam
Unrecoverable error: undefined in .uninstallpagedevice
Operand stack:
    defaultdevice
Unknown device: pam
Unrecoverable error: undefined in .uninstallpagedevice
Operand stack:
    defaultdevice
convert: Postscript delegate failed `/tmp/lyx_tmpdir162527NVBpw/gconvert016252uLFDGv.eps'. convert: missing an image filename `ppm:/tmp/lyx_tmpdir162527NVBpw/CacheItem162525Nr3Vk.ppm'. /Applications/TeX/LyX.app/Contents/Resources/scripts/convertDefault.py ERROR
Execution of "convert" failed.

The convert version:

khofbaue-al:~ khofbaue$ which convert
/usr/local/bin/convert
khofbaue-al:~ khofbaue$ convert --version
Version: ImageMagick 6.3.3 03/06/07 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2007 ImageMagick Studio LLC


Starting Lyx with -dbg graphics

khofbaue-al:~ khofbaue$ /Applications/TeX/LyX.app/Contents/MacOS/lyx -dbg graphics
Setting debug level to graphics
Debugging `graphics' (Graphics conversion and loading)
LoaderQueue: priority set to 10 images at a time, 100 milliseconds between calls
filetools(getFormatFromContents)
        Couldn't find a known format!
Recognised Fileformat: agr
filetools(getFormatFromContents)
        Couldn't find a known format!
filetools(getFormatFromContents)
        Couldn't find a known format!
filetools(getFormatFromContents)
        Couldn't find a known format!
filetools(getFormatFromContents)
        Couldn't find a known format!
filetools(getFormatFromContents)
        Couldn't find a known format!
filetools(getFormatFromContents)
        Couldn't find a known format!
filetools(getFormatFromContents)
        Couldn't find a known format!
filetools(getFormatFromContents)
        Couldn't find a known format!
filetools(getFormatFromContents)
        Couldn't find a known format!
filetools(getFormatFromContents)
        Couldn't find a known format!
filetools(getFormatFromContents)
        Couldn't find a known format!
filetools(getFormatFromContents)
        Couldn't find a known format!
filetools(getFormatFromContents)
        File type not recognised before EOF!
filetools(getFormatFromContents)
        Couldn't find a known format!
filetools(getFormatFromContents)
        Couldn't find a known format!
filetools(getFormatFromContents)
        Couldn't find a known format!
Recognised Fileformat: pdf
Recognised Fileformat: pdf
Recognised Fileformat: jpg
Recognised Fileformat: jpg
Recognised Fileformat: jpg
Recognised Fileformat: jpg
Recognised Fileformat: jpg
Recognised Fileformat: pdf
Recognised Fileformat: eps
Recognised Fileformat: eps
Recognised Fileformat: eps
filetools(getFormatFromContents)
        File type not recognised before EOF!
filetools(getFormatFromContents)
        Couldn't find a known format!
filetools(getFormatFromContents)
        File type not recognised before EOF!
filetools(getFormatFromContents)
        Couldn't find a known format!
filetools(getFormatFromContents)
        Couldn't find a known format!
filetools(getFormatFromContents)
        Couldn't find a known format!
filetools(getFormatFromContents)
        Couldn't find a known format!
filetools(getFormatFromContents)
        Couldn't find a known format!
filetools(getFormatFromContents)
        Couldn't find a known format!
filetools(getFormatFromContents)
        Couldn't find a known format!
filetools(getFormatFromContents)
        Couldn't find a known format!
filetools(getFormatFromContents)
        Couldn't find a known format!
filetools(getFormatFromContents)
        File type not recognised before EOF!
filetools(getFormatFromContents)
        Couldn't find a known format!
filetools(getFormatFromContents)
        Couldn't find a known format!
filetools(getFormatFromContents)
        Couldn't find a known format!
filetools(getFormatFromContents)
        Couldn't find a known format!
filetools(getFormatFromContents)
        File type not recognised before EOF!
filetools(getFormatFromContents)
        Couldn't find a known format!
filetools(getFormatFromContents)
        Couldn't find a known format!
filetools(getFormatFromContents)
        Couldn't find a known format!
filetools(getFormatFromContents)
        Couldn't find a known format!
filetools(getFormatFromContents)
        File type not recognised before EOF!
filetools(getFormatFromContents)
        Couldn't find a known format!
filetools(getFormatFromContents)
        Couldn't find a known format!
filetools(getFormatFromContents)
        Couldn't find a known format!
filetools(getFormatFromContents)
        Couldn't find a known format!
filetools(getFormatFromContents)
        Couldn't find a known format!
filetools(getFormatFromContents)
        Couldn't find a known format!
filetools(getFormatFromContents)
        Couldn't find a known format!
filetools(getFormatFromContents)
        Couldn't find a known format!
filetools(getFormatFromContents)
        File type not recognised before EOF!
filetools(getFormatFromContents)
        Couldn't find a known format!
filetools(getFormatFromContents)
        Couldn't find a known format!
Token: 'filename'
Token: 'width'
Token: 'keepAspectRatio'
Token: '\end_inset'
Token: 'filename'
Token: 'lyxscale'
Token: 'width'
Token: 'keepAspectRatio'
Token: '\end_inset'
Token: 'filename'
Token: 'width'
Token: '\end_inset'
Token: 'filename'
Token: 'lyxscale'
Token: 'width'
Token: '\end_inset'
Token: 'filename'
Token: 'lyxscale'
Token: 'width'
Token: '\end_inset'
Token: 'filename'
Token: 'width'
Token: '\end_inset'
Token: 'filename'
Token: 'lyxscale'
Token: 'width'
Token: 'keepAspectRatio'
Token: '\end_inset'
Token: 'filename'
Token: 'width'
Token: '\end_inset'
The font scaling factor is 109.35

The image loader can load the following directly:
bmp, pbm, pgm, png, ppm, xbm, xpm,
Of these, LyX recognises the following formats:
bmp, pbm, pgm, png, ppm, xbm, xpm

LoaderQueue: waking up
LoaderQueue: 2 items in the queue
Recognised Fileformat: eps
[graphics::CacheItem::Impl::convertToDisplayFormat]
Attempting to convert image file: /Users/khofbaue/Publications/2007_09 Corpus Report/eurocontrol_logo_text_clean.eps with displayed filename: ~/Publications/2007_09 Corpus Report/eurocontrol_logo_text_clean.eps
Recognised Fileformat: eps

        The file contains eps format data.
Unable to convert from eps to bmp
Unable to convert from eps to pbm
Unable to convert from eps to pgm
Unable to convert from eps to png
Unable to convert from eps to ppm
Unable to convert from eps to xbm
Unable to convert from eps to xpm
        No conversion needed (file in file cache)!
Loading image.
Image loading succeeded.
graphics::Image::getScaledDimensions()
        params.scale       : 10
        width              : 80
        height             : 70
Recognised Fileformat: eps
[graphics::CacheItem::Impl::convertToDisplayFormat]
Attempting to convert image file: /Users/khofbaue/Publications/2007_09 Corpus Report/TUG_logo_lang.eps with displayed filename: ~/Publications/2007_09 Corpus Report/TUG_logo_lang.eps
Recognised Fileformat: eps

        The file contains eps format data.
Unable to convert from eps to bmp
Unable to convert from eps to pbm
Unable to convert from eps to pgm
Unable to convert from eps to png
Unable to convert from eps to ppm
Unable to convert from eps to xbm
Unable to convert from eps to xpm
        Converting it to ppm format.
Converter c-tor:
from_file: /Users/khofbaue/Publications/2007_09 Corpus Report/TUG_logo_lang.eps
        to_file_base: /tmp/lyx_tmpdir16287QOTZ2M/CacheItem16287uf6uFO
        from_format:  eps
        to_format:    ppm
build_script ...        No converter defined! I use convertDefault.py
python -tt "/Applications/TeX/LyX.app/Contents/Resources/scripts/convertDefault.py" eps:' + '"' + infile + '"' + ' ppm:' + '"' + outfile + '"' + '
ready!
        Conversion script:
--------------------------------------
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os, shutil, sys, locale

def unlinkNoThrow(file):
  ''' remove a file, do not throw if an error occurs '''
  try:
    os.unlink(file)
  except:
    pass

def utf8ToDefaultEncoding(file):
  ''' if possible, convert to the default encoding '''
  try:
    language, output_encoding = locale.getdefaultlocale()
    if output_encoding == None:
      output_encoding = 'latin1'
    return unicode(file, 'utf8').encode(output_encoding)
  except:
    return file

infile = utf8ToDefaultEncoding("/Users/khofbaue/Publications/2007_09 Corpus Report/TUG_logo_lang.eps") outfile = utf8ToDefaultEncoding("/tmp/lyx_tmpdir16287QOTZ2M/gconvert016287P03tEs.eps")
shutil.copy(infile, outfile)
os.chdir(utf8ToDefaultEncoding('/tmp/lyx_tmpdir16287QOTZ2M/'))
infile = outfile
outfile = utf8ToDefaultEncoding("/tmp/lyx_tmpdir16287QOTZ2M/CacheItem16287uf6uFO.ppm")

if os.system(r'python -tt "/Applications/TeX/LyX.app/Contents/Resources/scripts/convertDefault.py" eps:' + '"' + infile + '"' + ' ppm:' + '"' + outfile + '"' + '') != 0:
  unlinkNoThrow(outfile)
  sys.exit(1)

if not os.path.isfile(outfile):
  if os.path.isfile(outfile + '.0'):
    os.rename(outfile + '.0', outfile)
    import glob
    for file in glob.glob(outfile + '.?'):
      unlinkNoThrow(file)
  else:
    sys.exit(1)

unlinkNoThrow(infile)

fromfile = utf8ToDefaultEncoding(outfile)
tofile = utf8ToDefaultEncoding("/tmp/lyx_tmpdir16287QOTZ2M/CacheItem16287uf6uFO.ppm")

try:
  os.rename(fromfile, tofile)
except:
  try:
    shutil.copy(fromfile, tofile)
  except:
    sys.exit(1)
  unlinkNoThrow(fromfile)

--------------------------------------
ForkedCallQueue: waking up
LoaderQueue: I'm going to sleep
Unknown device: pam
Unrecoverable error: undefined in .uninstallpagedevice
Operand stack:
    defaultdevice
Unknown device: pam
Unrecoverable error: undefined in .uninstallpagedevice
Operand stack:
    defaultdevice
convert: Postscript delegate failed `/tmp/lyx_tmpdir16287QOTZ2M/gconvert016287P03tEs.eps'. convert: missing an image filename `ppm:/tmp/lyx_tmpdir16287QOTZ2M/CacheItem16287uf6uFO.ppm'. /Applications/TeX/LyX.app/Contents/Resources/scripts/convertDefault.py ERROR
Execution of "convert" failed.
ForkedCallQueue: I'm going to sleep
Image conversion failed.
Unable to find converted file!




Reply via email to