Convert hangs when pinging text file
Posted: 2015-04-24T01:23:00-07:00
convert ~/Desktop/formats.txt -ping -format %[fx:w]x[fx:h] :info
Killed: 9
This seems to get into an infinite loop. The file can be retrieved from https://dl.dropboxusercontent.com/u/247 ... ormats.txt
I am running ImageMagick 6.9.1-0 Q16 x86_64 2015-04-06 on OSX 10.10.3 (Yosemite)
There seems to be a problem with this particular file. I can ping other text files. My client has hundreds of thousands of images in a wide variety of formats that I need to convert to JPG. I'm in the process of testing what might go wrong. The relevant lines from my python script are
When it hits this file, the call to subprocess.check_output() never returns, and I have to restart my Mac. I plan to filter out text files, of course, but I'm worried that this might happen with a corrupt image file. Can you suggest a defensive measure I might take?
I ran this again, using a python script attributed to Alex Martelli that I found at http://stackoverflow.com/questions/1191 ... th-timeout. (It's about the fourth answer down, or so.) This time it runs to completion, and gives the output '612x792612x792612x792612x792'. Perhaps it's splitting the document up into 4 pages? Watching the script in a debugger, it looks like convert has filled its output buffer, and is waiting for someone to read it, but that's just a guess; I don't really know what I'm talking about.
Since I was expecting output in the form "w x h" I don't know if this is user error or a bug.
Thanks.
Killed: 9
This seems to get into an infinite loop. The file can be retrieved from https://dl.dropboxusercontent.com/u/247 ... ormats.txt
I am running ImageMagick 6.9.1-0 Q16 x86_64 2015-04-06 on OSX 10.10.3 (Yosemite)
There seems to be a problem with this particular file. I can ping other text files. My client has hundreds of thousands of images in a wide variety of formats that I need to convert to JPG. I'm in the process of testing what might go wrong. The relevant lines from my python script are
Code: Select all
size = subprocess.check_output(['convert', fd.oldPath, '-ping', '-format', '%[fx:w]x%[fx:h]', 'info:'], stderr=log)
subprocess.call(['convert', fd.oldPath, '-size', size, 'tile:pattern:checkerboard',
'-brightness-contrast', '20,10', '+swap', '-compose',
'over', '-composite', '-quality', str(self.quality), fd.newPath],
stdout=log, stderr=log)
I ran this again, using a python script attributed to Alex Martelli that I found at http://stackoverflow.com/questions/1191 ... th-timeout. (It's about the fourth answer down, or so.) This time it runs to completion, and gives the output '612x792612x792612x792612x792'. Perhaps it's splitting the document up into 4 pages? Watching the script in a debugger, it looks like convert has filled its output buffer, and is waiting for someone to read it, but that's just a guess; I don't really know what I'm talking about.
Since I was expecting output in the form "w x h" I don't know if this is user error or a bug.
Thanks.