Page 1 of 1
convert: no images defined `temp3.tiff' @ error/convert.c/ConvertImageCommand/3273
Posted: 2019-09-03T04:49:31-07:00
by Rubert
I am able to convert PDF image to tiff image from terminal. But I am not able to execute the same command through python or java program. I am getting "convert: no images defined `temp3.tiff' @ error/convert.c/ConvertImageCommand/3273." . Any suggestions on how to resolve it?
Re: convert: no images defined `temp3.tiff' @ error/convert.c/ConvertImageCommand/3273
Posted: 2019-09-03T05:04:28-07:00
by snibgo
What version of IM? What version of Ghostscript? What was your exact command? What is the text output when you insert "-verbose" in the command? Can you convert from other input formats? If so, then I suspect you can't access Ghostscript from within python or java. Perhaps you have a path or privilege problem.
Re: convert: no images defined `temp3.tiff' @ error/convert.c/ConvertImageCommand/3273
Posted: 2019-09-03T05:23:44-07:00
by Rubert
Thanks for your response! ImageMagick 7.0.8-59 and gs --> 9.27. Below is my python code. I am able to convert tiff image to PDF using the same code. I think I have problem converting PDF images
Code: Select all
convert_exe_name = '/usr/local/bin/convert'
args = [convert_exe_name, 'File3.pdf', 'temp3.tiff']
proc = subprocess.Popen(args, shell=False)
retcode = proc.wait()
Re: convert: no images defined `temp3.tiff' @ error/convert.c/ConvertImageCommand/3273
Posted: 2019-09-03T05:36:03-07:00
by snibgo
Can you execute a Ghostscript command from python? Perhaps that need the full path to the GS program. If so, then check your delegates.xml file, and ensure that has the same full path.
Re: convert: no images defined `temp3.tiff' @ error/convert.c/ConvertImageCommand/3273
Posted: 2019-09-03T07:10:59-07:00
by Rubert
This command works for me from my mac terminal(gs -sDEVICE=pngalpha -sOutputFile=gs_out.png -r144 git.pdf). I tried to run the same command through python program. I am not getting any error, however I am not seeing output file anywhere. Below is my python code. What I am missing.
Code: Select all
import sys
import locale
import ghostscript
args = [
"-sDEVICE=pngalpha",
"-sOutputFile=/Users/z063183/python/ocr/gs_out.png",
"-r144",
"/Users/z063183/python/ocr/git.pdf"
]
# arguments have to be bytes, encode them
encoding = locale.getpreferredencoding()
args = [a.encode(encoding) for a in args]
ghostscript.Ghostscript(*args)
Re: convert: no images defined `temp3.tiff' @ error/convert.c/ConvertImageCommand/3273
Posted: 2019-09-03T07:21:27-07:00
by snibgo
I thought you might try running GS with subprocess.Popen(). Anyhow, if you can't run GS from within python, there is no chance of IM running GS within python.
Sorry, I don't know what the problem is or how to fix it. But you might check privileges of the required files.