Commit 0a40c8e6 authored by Tristan Cavelier's avatar Tristan Cavelier

Image.py: remove some warnings from imagemagick stdout

    **** Warning: considering '0000000000 XXXXX n' as a free entry.

https://codeyarns.com/2014/03/10/free-entry-warning-with-ghostscript-and-imagemagick/

> This warning turns out to be from the Ghostscript program, which is used by
> ImageMagick internally to perform this format conversion. This page explains
> that this error has been fixed in a recent version of Ghostscript. I used a
> newer version of Ubuntu, that is 13.11, that had a newer version of gs and I
> was able to perform the format conversion. It still gave off the warning,
> but the conversion was done.

Image.py tells imagemagick to convert to stdout.
Warnings are also returned via stdout before actual rendering.
parent 61d51dbe
...@@ -34,6 +34,7 @@ import os ...@@ -34,6 +34,7 @@ import os
import string import string
import struct import struct
import subprocess import subprocess
import re
from cStringIO import StringIO from cStringIO import StringIO
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
...@@ -369,6 +370,9 @@ class Image(TextConvertableMixin, File, OFSImage): ...@@ -369,6 +370,9 @@ class Image(TextConvertableMixin, File, OFSImage):
# XXX: The only portable way is to pass what stdin.write can accept, # XXX: The only portable way is to pass what stdin.write can accept,
# which is a string for PIPE. # which is a string for PIPE.
image, err = process.communicate(data) image, err = process.communicate(data)
# XXX Hack to remove some warnings from imagemagick stdout !
# https://codeyarns.com/2014/03/10/free-entry-warning-with-ghostscript-and-imagemagick/
image = re.sub(r"^( \*\*\*\* Warning: considering '0000000000 XXXXX n' as a free entry.\n)+", "", image)
finally: finally:
del process del process
if image: if image:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment