mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2024-12-11 19:12:17 +00:00
b509390575
Copied from http://cucc@cucc.survex.com/svn/trunk/expoweb/troggle/, rev. 8338 by cucc @ 5/11/2009 3:08 AM
16 lines
338 B
Python
16 lines
338 B
Python
""" ImageKit utility functions """
|
|
|
|
import tempfile
|
|
|
|
def img_to_fobj(img, format, **kwargs):
|
|
tmp = tempfile.TemporaryFile()
|
|
if format != 'JPEG':
|
|
try:
|
|
img.save(tmp, format, **kwargs)
|
|
return
|
|
except KeyError:
|
|
pass
|
|
img.save(tmp, format, **kwargs)
|
|
tmp.seek(0)
|
|
return tmp
|