Paul:
I don't understand this. You're saying that LyX will display the PPM
file properly (if you include it directly in the document) but GIMP
thinks the file is bad?
LyX displays the ppm file but not properly. I mean, it appears an
image on the screen, but this image has less to do with the original
ps figure. Therefore, ImageMagick is converting the ps file into a ppm
file containing some strange information that LyX is able to display
but GIMP is not able to open ("plugin cannot open image")
Do you have problems converting non-Adobe formats (e.g., figure1.jpg)
to PPM? The reason I ask is that ImageMagick relies on Ghostscript
when converting Postscript and Encapsulated Postscript to other
formats. So if the problem is only with PS/EPS and not with
JPG/PNG/..., then the place to look is your Ghostscript installation.
If I run
convert figure1.ps figure1.jpg
and then
convert figure1.jpg figure1.ppm
then both jpg and ppm files are correctly converted (I am able to open
them in GIMP) and LyX displays the ppm file without problems. However,
if I try to load the jpg file in LyX then I get the "Error converting
to loadable format". So I believe that the problem is not with
Ghostscript.
Meanwhile, I'm not sure any of this explains your problem entirely,
particularly since you indicated conversion to PPM (the format LyX uses
for internal display) failed for all sorts of image types. You might
try the following. Open a DOS window and cd to the LyX bin directory.
Run 'lyxc -dbg graphics' there. (Note that it's lyxc, not lyx.) Start
a new document. The DOS window will have all sorts of progress
messages from LyX that we don't care about; make a note where they end.
Now insert an image with the option to display in LyX turned on. More
messages will spew into the DOS window. Copy the ones that came after
you inserted the image and mail them to the list; maybe they'll tell us
where the script is failing.
Here is the debug log (it is quite a lot of stuff):
Token: '\end_inset'
[readBB_from_PSFile] no(e)ps-format
[controller().bb_Changed set to true]
[controller().bb_Changed set to true]
[controller().bb_Changed set to true]
[controller().bb_Changed set to true]
[readBB_from_PSFile] no(e)ps-format
Token: 'filename'
Token: '\end_inset'
LoaderQueue: waking up
Recognised Fileformat: eps
Recognised Fileformat: eps
[readBB_from_PSFile] 39 24 480 523
[controller().bb_Changed set to true]
[controller().bb_Changed set to true]
[controller().bb_Changed set to true]
[controller().bb_Changed set to true]
Recognised Fileformat: eps
Recognised Fileformat: eps
[readBB_from_PSFile] 39 24 480 523
LoaderQueue: 1 items in the queue
Recognised Fileformat: eps
[graphics::CacheItem::Impl::convertToDisplayFormat]
Attempting to convert image file: C:/TEST/figure1.ps
with displayed filename: C:\TEST\figure1.ps
Recognised Fileformat: eps
The file contains eps format data.
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
Unable to convert from eps to bmp
Unable to convert from eps to pbm
Unable to convert from eps to pgm
Converting it to png format.
Error returned from iconv
EILSEQ An invalid multibyte sequence has been encountered in the input.
When converting from UTF-8 to UCS-4LE.
Input: 0x43 0x3a 0x2f 0x44 0x6f 0x63 0x75 0x6d 0x65 0x6e 0x74 0x73
0x20 0x61 0x6e 0x64 0x20 0x53 0x65 0x74 0x74 0x69 0x6e 0x67 0x73 0x2f
0x66 0x72 0x6f 0x69 0x67 0x2f 0x43 0x6f 0x6e 0x66 0x69 0x67 0x75 0x72
0x61 0xe7 0xf5 0x65 0x73 0x20 0x6c 0x6f 0x63 0x61 0x69 0x73 0x2f 0x54
0x65 0x6d 0x70 0x2f 0x6c 0x79 0x78 0x5f 0x74 0x6d 0x70 0x64 0x69 0x72
0x33 0x30 0x36 0x30 0x61 0x30 0x33 0x30 0x36 0x34
Converter c-tor:
from_file: C:/TEST/figure1.ps
to_file_base: C:/Documents and Settings/froig/Configuracoes
locais/Temp/lyx_tmpdir3060a03064/CacheItem3060a03064
from_format: eps
to_format: png
build_script ... Error returned from iconv
EILSEQ An invalid multibyte sequence has been encountered in the input.
When converting from UTF-8 to UCS-4LE.
Input: 0x43 0x3a 0x2f 0x44 0x6f 0x63 0x75 0x6d 0x65 0x6e 0x74 0x73
0x20 0x61 0x6e 0x64 0x20 0x53 0x65 0x74 0x74 0x69 0x6e 0x67 0x73 0x2f
0x66 0x72 0x6f 0x69 0x67 0x2f 0x43 0x6f 0x6e 0x66 0x69 0x67 0x75 0x72
0x61 0xe7 0xf5 0x65 0x73 0x20 0x6c 0x6f 0x63 0x61 0x69 0x73 0x2f 0x54
0x65 0x6d 0x70 0x2f 0x6c 0x79 0x78 0x5f 0x74 0x6d 0x70 0x64 0x69 0x72
0x33 0x30 0x36 0x30 0x61 0x30 0x33 0x30 0x36 0x34
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("C:/TEST/figure1.ps")
outfile = "C:/Documents and Settings/froig/Configuracoes
locais/Temp/lyx_tmpdir3060a03064/gconvert03060a03064.ps"
shutil.copy(infile, outfile)
os.chdir("C:/Documents and Settings/froig/Configuracoes
locais/Temp/lyx_tmpdir3060a03064/")
infile = "C:/Documents and Settings/froig/Configuracoes
locais/Temp/lyx_tmpdir3060a03064/gconvert03060a03064.ps"
infile_base = "C:/Documents and Settings/froig/Configuracoes
locais/Temp/lyx_tmpdir3060a03064/gconvert03060a03064"
outfile = "C:/Documents and Settings/froig/Configuracoes
locais/Temp/lyx_tmpdir3060a03064/gconvert03060a03064.png"
if os.system(r'convert eps:' + '"' + infile + '"' + ' png:' + '"' +
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 = outfile
tofile = "C:/Documents and Settings/froig/Configuracoes
locais/Temp/lyx_tmpdir3060a03064/CacheItem3060a03064.png"
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
Traceback (most recent call last):
File "C:/Documents and Settings/froig/Configuracoes
locais/Temp/lyx_tmpdir3060a03064/lyxconvert0.py", line 24, in <module>
shutil.copy(infile, outfile)
File "C:\Arquivos de programas\LyX15\python\lib\shutil.py", line 80, in copy
copyfile(src, dst)
File "C:\Arquivos de programas\LyX15\python\lib\shutil.py", line
47, in copyfile
fdst = open(dst, 'wb')
IOError: [Errno 2] No such file or directory: 'C:/Documents and
Settings/froig/Configuracoes
locais/Temp/lyx_tmpdir3060a03064/gconvert03060a03064.
ps'
ForkedCallQueue: I'm going to sleep
Image conversion failed.
Unable to find converted file!