Python Imaging LIbrary fixes

svn: r109
This commit is contained in:
Don Allingham 2001-06-10 01:25:35 +00:00
parent 1215614d56
commit b869c782a8
5 changed files with 11 additions and 11 deletions

View File

@ -29,7 +29,7 @@ import utils
cnv = utils.fl2txt cnv = utils.fl2txt
try: try:
import Image import PIL.Image
no_pil = 0 no_pil = 0
except: except:
no_pil = 1 no_pil = 1
@ -86,7 +86,7 @@ class AbiWordDoc(TextDoc):
cmd = "%s -geometry %dx%d '%s' '%s'" % (const.convert,width,height,file,base) cmd = "%s -geometry %dx%d '%s' '%s'" % (const.convert,width,height,file,base)
os.system(cmd) os.system(cmd)
else: else:
im = Image.open(file) im = PIL.Image.open(file)
im.thumbnail((width,height)) im.thumbnail((width,height))
im.save(base,"PNG") im.save(base,"PNG")

View File

@ -22,7 +22,7 @@ from TextDoc import *
from latin_utf8 import latin_to_utf8 from latin_utf8 import latin_to_utf8
try: try:
import Image import PIL.Image
no_pil = 0 no_pil = 0
except: except:
no_pil = 1 no_pil = 1

View File

@ -30,7 +30,7 @@ cnv = utils.fl2txt
try: try:
import Image import PIL.Image
no_pil = 0 no_pil = 0
except: except:
no_pil = 1 no_pil = 1
@ -443,7 +443,7 @@ class OpenOfficeDoc(TextDoc):
cmd = "%s -geometry %dx%d '%s' '%s'" % (const.convert,width,height,file,image_name) cmd = "%s -geometry %dx%d '%s' '%s'" % (const.convert,width,height,file,image_name)
os.system(cmd) os.system(cmd)
else: else:
im = Image.open(file) im = PIL.Image.open(file)
im.thumbnail((width,height)) im.thumbnail((width,height))
im.save(name,"JPEG") im.save(name,"JPEG")

View File

@ -30,7 +30,7 @@ import reportlab.lib.styles
from latin_utf8 import latin_to_utf8 from latin_utf8 import latin_to_utf8
try: try:
import Image import PIL.Image
no_pil = 0 no_pil = 0
except: except:
no_pil = 1 no_pil = 1
@ -231,14 +231,14 @@ class PdfDoc(TextDoc):
def add_photo(self,name,x,y): def add_photo(self,name,x,y):
if no_pil == 0: if no_pil == 0:
im = Image.open(name) im = PIL.Image.open(name)
nx,ny = im.size nx,ny = im.size
scale = float(y)/float(nx) scale = float(y)/float(nx)
act_width = int(nx * scale) act_width = int(nx * scale)
act_height = int(ny * scale) act_height = int(ny * scale)
self.story.append(Image(name,act_width*0.5,act_height*0.5)) self.story.append(PIL.Image(name,act_width*0.5,act_height*0.5))
self.story.append(Spacer(1,0.5*cm)) self.story.append(Spacer(1,0.5*cm))
self.image = 1 self.image = 1

View File

@ -31,7 +31,7 @@ from gnome.ui import *
_ = intl.gettext _ = intl.gettext
try: try:
import Image import PIL.Image
no_pil = 0 no_pil = 0
except: except:
no_pil = 1 no_pil = 1
@ -72,7 +72,7 @@ def import_photo(filename,path,prefix):
cmd = "%s '%s' '%s'" % (const.convert,filename,name) cmd = "%s '%s' '%s'" % (const.convert,filename,name)
os.system(cmd) os.system(cmd)
else: else:
Image.open(filename).save(name) PIL.Image.open(filename).save(name)
except: except:
return None return None
@ -116,7 +116,7 @@ def mk_thumb(source,dest,size):
os.system(cmd) os.system(cmd)
else: else:
try: try:
im = Image.open(source) im = PIL.Image.open(source)
im.thumbnail((size,size)) im.thumbnail((size,size))
im.save(dest,"JPEG") im.save(dest,"JPEG")
except: except: