Start publishing new repo icons at max 72x72 px

This commit is contained in:
Daniel Martí 2013-08-19 11:20:50 +02:00
parent b55060f4c7
commit a1c2dc1a75
2 changed files with 12 additions and 0 deletions

View file

@ -134,6 +134,8 @@ Ruby (debian packages ruby and rubygems)
Vagrant (gem install vagrant) Vagrant (gem install vagrant)
@item @item
Paramiko (debian package python-paramiko) Paramiko (debian package python-paramiko)
@item
Imaging (debian package python-imaging)
@end itemize @end itemize

View file

@ -31,6 +31,7 @@ from optparse import OptionParser
import time import time
import common import common
from common import MetaDataException from common import MetaDataException
from PIL import Image
def update_wiki(apps, apks, verbose=False): def update_wiki(apps, apks, verbose=False):
"""Update the wiki """Update the wiki
@ -357,6 +358,15 @@ def scan_apks(apps, apkcache, repodir, knownapks):
print "WARNING: Error retrieving icon file" print "WARNING: Error retrieving icon file"
apk.close() apk.close()
im = Image.open(iconfilename)
if any(length > 72 for length in im.size):
print iconfilename, "is too large:", im.size
im.thumbnail((72, 72), Image.ANTIALIAS)
print iconfilename, "new size:", im.size
im.save(iconfilename, "PNG")
else:
print iconfilename, "is small enough:", im.size
# Record in known apks, getting the added date at the same time.. # Record in known apks, getting the added date at the same time..
added = knownapks.recordapk(thisinfo['apkname'], thisinfo['id']) added = knownapks.recordapk(thisinfo['apkname'], thisinfo['id'])
if added: if added: