chiark / gitweb /
Start publishing new repo icons at max 72x72 px
authorDaniel Martí <mvdan@mvdan.cc>
Mon, 19 Aug 2013 09:20:50 +0000 (11:20 +0200)
committerDaniel Martí <mvdan@mvdan.cc>
Mon, 19 Aug 2013 09:20:50 +0000 (11:20 +0200)
docs/fdroid.texi
fdroidserver/update.py

index 094dad62845969ca48d7e7913b9267d256a0bdf1..9cdced2903cdaee914854d12f2cdad5ba9fd2809 100644 (file)
@@ -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
 
 
index d40773d5c7f36c1e4a1c3a2129369f362df0cca2..bd6306579f9c78d5cd749402cbba2fc1495575bd 100644 (file)
@@ -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: