Fix bug 3400

* lib/scripts/convertDefault.py: Use the cropbox option when the
	source format is pdf and convert supports it.

	* lib/configure.py: Don't define a PDF->PNG converter in order to
	avoid the EPS->PDF->PNG route when converting EPS to a loadable
	format.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17668 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Enrico Forestieri 2007-03-31 18:21:54 +00:00
parent f428433c08
commit b343446bd4
2 changed files with 12 additions and 8 deletions

View File

@ -409,13 +409,6 @@ def checkConverterEntries():
checkProg('an EPS -> PDF converter', ['epstopdf'], checkProg('an EPS -> PDF converter', ['epstopdf'],
rc_entry = [ r'\converter eps pdf "epstopdf --outfile=$$o $$i" ""', '']) rc_entry = [ r'\converter eps pdf "epstopdf --outfile=$$o $$i" ""', ''])
# #
path, convert = checkProg('a PDF -> PNG converter', ['convert'])
if convert != '':
# check whether convert supports the -define option
conv_opts = "-define pdf:use-cropbox=true -depth 8"
if not 'Unrecognized' in cmdOutput('convert ' + conv_opts + ' 2>&1'):
addToRC(r'\converter pdf png "convert %s pdf:$$i png:$$o" ""' % conv_opts)
#
# no agr -> pdf converter, since the pdf library used by gracebat is not # no agr -> pdf converter, since the pdf library used by gracebat is not
# free software and therefore not compiled in in many installations. # free software and therefore not compiled in in many installations.
# Fortunately, this is not a big problem, because we will use epstopdf to # Fortunately, this is not a big problem, because we will use epstopdf to

View File

@ -18,7 +18,18 @@
# converts an image from $1 to $2 format # converts an image from $1 to $2 format
import os, sys import os, sys
if os.system(r'convert -depth 8 "%s" "%s"' % (sys.argv[1], sys.argv[2])) != 0:
opts = "-depth 8"
# for pdf source formats, check whether convert supports the -define option
if sys.argv[1][:4] == 'pdf:':
defopt = "-define pdf:use-cropbox=true"
fout = os.popen('convert ' + defopt + ' 2>&1')
output = fout.read()
fout.close()
if not 'unrecognized' in output.lower():
opts = defopt + ' ' + opts
if os.system(r'convert %s "%s" "%s"' % (opts, sys.argv[1], sys.argv[2])) != 0:
print >> sys.stderr, sys.argv[0], 'ERROR' print >> sys.stderr, sys.argv[0], 'ERROR'
print >> sys.stderr, 'Execution of "convert" failed.' print >> sys.stderr, 'Execution of "convert" failed.'
sys.exit(1) sys.exit(1)