mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-10-09 02:41:06 +03:00
Icon resizing diagnostics/robustness
This commit is contained in:
parent
055a26d994
commit
eec320a08d
1 changed files with 12 additions and 8 deletions
|
@ -215,14 +215,18 @@ def delete_disabled_builds(apps, apkcache, repodirs):
|
|||
del apkcache[apkfilename]
|
||||
|
||||
def resize_icon(iconpath):
|
||||
im = Image.open(iconpath)
|
||||
if any(length > max_icon_size for length in im.size):
|
||||
print iconpath, "is too large:", im.size
|
||||
im.thumbnail((max_icon_size, max_icon_size), Image.ANTIALIAS)
|
||||
print iconpath, "new size:", im.size
|
||||
im.save(iconpath, "PNG")
|
||||
else:
|
||||
print iconpath, "is small enough:", im.size
|
||||
try:
|
||||
im = Image.open(iconpath)
|
||||
if any(length > max_icon_size for length in im.size):
|
||||
print iconpath, "is too large:", im.size
|
||||
im.thumbnail((max_icon_size, max_icon_size), Image.ANTIALIAS)
|
||||
print iconpath, "new size:", im.size
|
||||
im.save(iconpath, "PNG")
|
||||
else:
|
||||
if options.verbose:
|
||||
print iconpath, "is small enough:", im.size
|
||||
except Exception,e:
|
||||
print "ERROR: Failed processing {0} - {1}".format(iconpath, e)
|
||||
|
||||
def resize_all_icons(repodirs):
|
||||
"""Resize all icons that exceed the max size
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue