Handle scaling of data using Imagick

svn: r1105
This commit is contained in:
Don Allingham 2002-08-03 04:28:44 +00:00
parent ae9ceb17e0
commit f54076cbf7
2 changed files with 3 additions and 4 deletions

View File

@ -69,7 +69,7 @@ class ImgManip:
return buf return buf
def fmt_scale_data(self,x,y,cnv): def fmt_scale_data(self,x,y,cnv):
cmd = "%s -geometry %dx%d '%s' '%s:-'" % (const.convert,x,y,cnv,self.src) cmd = "%s -geometry %dx%d '%s' '%s:-'" % (const.convert,x,y,self.src,cnv)
r,w = popen2.popen2(cmd) r,w = popen2.popen2(cmd)
buf = r.read() buf = r.read()
r.close() r.close()

View File

@ -319,7 +319,6 @@ class RTFDoc(TextDoc):
def add_photo(self,name,pos,x_cm,y_cm): def add_photo(self,name,pos,x_cm,y_cm):
im = ImgManip.ImgManip(name) im = ImgManip.ImgManip(name)
nx,ny = im.size() nx,ny = im.size()
buf = im.jpg_data()
ratio = float(x_cm)*float(ny)/(float(y_cm)*float(nx)) ratio = float(x_cm)*float(ny)/(float(y_cm)*float(nx))
@ -330,11 +329,11 @@ class RTFDoc(TextDoc):
act_height = y_cm act_height = y_cm
act_width = x_cm/ratio act_width = x_cm/ratio
buf = im.jpg_scale_data(int(act_width*40),int(act_height*40))
act_width = twips(act_width) act_width = twips(act_width)
act_height = twips(act_height) act_height = twips(act_height)
im.thumbnail((int(act_width*40),int(act_height*40)))
self.f.write('{\*\shppict{\\pict\\jpegblip') self.f.write('{\*\shppict{\\pict\\jpegblip')
self.f.write('\\picwgoal%d\\pichgoal%d\n' % (act_width,act_height)) self.f.write('\\picwgoal%d\\pichgoal%d\n' % (act_width,act_height))
index = 1 index = 1