Map output type to proper extension

This commit is contained in:
Steven Robertson 2012-05-20 13:04:38 -07:00
parent 3666d4bee8
commit 5083fefad7

View File

@ -43,6 +43,7 @@ class PILOutput(Output, ClsMod):
@staticmethod @staticmethod
def save(buf, name, type=None, quality=98): def save(buf, name, type=None, quality=98):
type = dict(jpg='jpeg', tif='tiff').get(type, type)
if type == 'jpeg' or (type is None and name.endswith('.jpg')): if type == 'jpeg' or (type is None and name.endswith('.jpg')):
buf = buf[:,:,:3] buf = buf[:,:,:3]
img = scipy.misc.toimage(buf, cmin=0, cmax=1) img = scipy.misc.toimage(buf, cmin=0, cmax=1)