/usr/share/pyaimt/src/imgmanip.py is in pyaimt 0.8.0.1-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | # Copyright 2004-2006 Daniel Henninger <jadestorm@nc.rr.com>
# Licensed for distribution under the GPL version 2, check COPYING for details
import config
if not config.disableAvatars:
try:
import Image
import StringIO
def convertToPNG(imageData):
inbuff = StringIO.StringIO(imageData)
outbuff = StringIO.StringIO()
Image.open(inbuff).save(outbuff, "PNG")
outbuff.seek(0)
imageData = outbuff.read()
return imageData
def convertToJPG(imageData):
inbuff = StringIO.StringIO(imageData)
outbuff = StringIO.StringIO()
img = Image.open(inbuff)
if img.size[0] > 64 or img.size[1] > 64:
img.thumbnail((64,64))
elif img.size[0] < 15 or img.size[1] < 15:
img.thumbnail((15,15))
img.convert().save(outbuff, "JPEG")
outbuff.seek(0)
imageData = outbuff.read()
return imageData
except ImportError:
import sys
print "ERROR! PyAIM-t requires the Python Imaging Library to function with avatars. Either install the Python Imaging Library, or disable avatars using the <disableAvatars/> option in your config file."
sys.exit(-1)
|