From a1c2dc1a756c95416259c68b9d78de9d2ab8676b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Mon, 19 Aug 2013 11:20:50 +0200 Subject: [PATCH] Start publishing new repo icons at max 72x72 px --- docs/fdroid.texi | 2 ++ fdroidserver/update.py | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/docs/fdroid.texi b/docs/fdroid.texi index 094dad62..9cdced29 100644 --- a/docs/fdroid.texi +++ b/docs/fdroid.texi @@ -134,6 +134,8 @@ Ruby (debian packages ruby and rubygems) Vagrant (gem install vagrant) @item Paramiko (debian package python-paramiko) +@item +Imaging (debian package python-imaging) @end itemize diff --git a/fdroidserver/update.py b/fdroidserver/update.py index d40773d5..bd630657 100644 --- a/fdroidserver/update.py +++ b/fdroidserver/update.py @@ -31,6 +31,7 @@ from optparse import OptionParser import time import common from common import MetaDataException +from PIL import Image def update_wiki(apps, apks, verbose=False): """Update the wiki @@ -357,6 +358,15 @@ def scan_apks(apps, apkcache, repodir, knownapks): print "WARNING: Error retrieving icon file" 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.. added = knownapks.recordapk(thisinfo['apkname'], thisinfo['id']) if added: