From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Goldish Subject: Re: [PATCH KVM-AUTOTEST 2/2] Convert images to JPEG using PIL instead of an external program Date: Wed, 12 Aug 2009 06:13:14 -0400 (EDT) Message-ID: <1342750479.1809731250071994472.JavaMail.root@zmail05.collab.prod.int.phx2.redhat.com> References: <1587932675.1809681250071942865.JavaMail.root@zmail05.collab.prod.int.phx2.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org, Lucas Meneghel Rodrigues To: Avi Kivity Return-path: Received: from mx1.redhat.com ([66.187.233.31]:33322 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932390AbZHLKNP (ORCPT ); Wed, 12 Aug 2009 06:13:15 -0400 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n7CADG05012944 for ; Wed, 12 Aug 2009 06:13:16 -0400 In-Reply-To: <1587932675.1809681250071942865.JavaMail.root@zmail05.collab.prod.int.phx2.redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: ----- "Avi Kivity" wrote: > This is faster since we don't need to fork/exec/wait for an external > program each time. > > Signed-off-by: Avi Kivity > --- > client/tests/kvm/kvm_guest_wizard.py | 6 +++--- > 1 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/client/tests/kvm/kvm_guest_wizard.py > b/client/tests/kvm/kvm_guest_wizard.py > index 73b830e..f9e5476 100644 > --- a/client/tests/kvm/kvm_guest_wizard.py > +++ b/client/tests/kvm/kvm_guest_wizard.py > @@ -1,6 +1,7 @@ > import os, time, md5, re, shutil, logging > from autotest_lib.client.common_lib import utils, error > import kvm_utils, ppm_utils, kvm_subprocess > +import PIL.Image > > """ > Utilities to perform automatic guest installation using step files. > @@ -110,9 +111,8 @@ def barrier_2(vm, words, params, debug_dir, > data_scrdump_filename, > history_scrdump_filename = os.path.join(history_dir, > "scrdump-step_%s-%s.jpg" % (current_step_num, > > time.strftime("%Y%m%d-%H%M%S"))) > - kvm_subprocess.run_fg("convert -quality 30 %s %s" % > - (scrdump_filename, > history_scrdump_filename), > - logging.debug, "(convert) ", > timeout=30) > + image = PIL.Image.open(scrdump_filename) > + image.save(history_scrdump_filename, format = 'JPEG', > quality = 30) OK, makes sense -- assuming PIL is as common as ImageMagick, this should be fine. (I personally prefer to conform to PEP 8, and the spacing around the keyword arguments doesn't as far as I know, but that is really a very minor issue.) > > # Compare md5sum of barrier region with the expected md5sum > calced_md5sum = ppm_utils.get_region_md5sum(w, h, data, x1, > y1, dx, dy, > -- > 1.6.3.3 > > -- > To unsubscribe from this list: send the line "unsubscribe kvm" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html