New template file

svn: r767
This commit is contained in:
Don Allingham 2002-02-11 01:36:48 +00:00
parent d476628336
commit e0c99fe452
2 changed files with 340 additions and 345 deletions

View File

@ -76,12 +76,6 @@ class ImgManip:
w.close() w.close()
return buf return buf
def eps_data(self):
return self.fmt_data("eps")
def eps_scale_data(self,x,y):
return self.fmt_scale_data("eps")
else: else:
def size(self): def size(self):
@ -122,34 +116,6 @@ class ImgManip:
im = im.convert("RGB") im = im.convert("RGB")
return im.tostring(string.upper(pil),"RGB") return im.tostring(string.upper(pil),"RGB")
def eps_data(self):
g = StringIO.StringIO()
im = PIL.Image.open(self.src)
if im.mode != 'RGB':
im.draft('RGB',im.size)
im = im.convert("RGB")
im.save(g,"eps")
g.seek(0)
buf = g.read()
g.close()
return buf
def eps_scale_data(self,x,y):
# need to write to a file-like object, otherwise
# PIL won't generate the header information
g = StringIO.StringIO()
im = PIL.Image.open(self.src)
im.thumbnail((x,y))
if im.mode != 'RGB':
im.draft('RGB',im.size)
im = im.convert("RGB")
im.save(g,"eps")
g.seek(0)
buf = g.read()
g.close()
return buf
def jpg_thumbnail(self,dest,width,height): def jpg_thumbnail(self,dest,width,height):
self.fmt_thumbnail(dest,width,height,"jpeg") self.fmt_thumbnail(dest,width,height,"jpeg")
@ -174,12 +140,18 @@ class ImgManip:
def png_data(self): def png_data(self):
return self.fmt_data("png") return self.fmt_data("png")
def eps_data(self):
return self.fmt_data("eps")
def jpg_scale_data(self,x,y): def jpg_scale_data(self,x,y):
return self.fmt_scale_data(x,y,"jpeg") return self.fmt_scale_data(x,y,"jpeg")
def png_scale_data(self,x,y): def png_scale_data(self,x,y):
return self.fmt_scale_data(x,y,"png") return self.fmt_scale_data(x,y,"png")
def eps_scale_data(self,x,y):
return self.fmt_scale_data(x,y,"eps")
if __name__ == "__main__": if __name__ == "__main__":

File diff suppressed because it is too large Load Diff