Commit 3a197f00 authored by Tristan Cavelier's avatar Tristan Cavelier Committed by Xiaowu Zhang

XXX Image.py: remove some warnings from 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 ef505eab
...@@ -408,6 +408,9 @@ class Image(TextConvertableMixin, File, OFSImage): ...@@ -408,6 +408,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