From 4c66eae19974250c1157bc5291155243c0827567 Mon Sep 17 00:00:00 2001 From: Kazuhiko Shiozaki <kazuhiko@nexedi.com> Date: Tue, 18 Aug 2015 14:03:49 +0200 Subject: [PATCH] use LC_NUMERIC=C in imagemagick conversion. because inkscape DPI handling differs by its value. --- product/ERP5/Document/Image.py | 4 ++++ .../PortalTransforms/libtransforms/imagemagick_transform.py | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/product/ERP5/Document/Image.py b/product/ERP5/Document/Image.py index 8a66451435..5a477f9a4c 100644 --- a/product/ERP5/Document/Image.py +++ b/product/ERP5/Document/Image.py @@ -30,6 +30,7 @@ # ############################################################################## +import os import string import struct import subprocess @@ -342,7 +343,10 @@ class Image(TextConvertableMixin, File, OFSImage): if self.getContentType() == "image/svg+xml": data = transformUrlToDataURI(data) + env = os.environ.copy() + env.update({'LC_NUMERIC':'C'}) process = subprocess.Popen(parameter_list, + env=env, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, diff --git a/product/PortalTransforms/libtransforms/imagemagick_transform.py b/product/PortalTransforms/libtransforms/imagemagick_transform.py index 5418890629..bee96c362b 100644 --- a/product/PortalTransforms/libtransforms/imagemagick_transform.py +++ b/product/PortalTransforms/libtransforms/imagemagick_transform.py @@ -1,4 +1,5 @@ from Products.PortalTransforms.interfaces import ITransform +import os import subprocess from zope.interface import implements @@ -26,7 +27,10 @@ class ImageMagickTransforms: if depth: parameter_list.extend(['-depth', '%s' % depth, '-type', 'Palette']) parameter_list.append('%s:-' % self.format) + env = os.environ.copy() + env.update({'LC_NUMERIC':'C'}) p = subprocess.Popen(parameter_list, + env=env, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, -- 2.30.9