| Index: packagerChrome.py |
| diff --git a/packagerChrome.py b/packagerChrome.py |
| index d75203d17b9e63262e69f44e5112cfc729005d8d..54630bfc12ff5b7e98e9a671e806d4b43e9f9cfe 100644 |
| --- a/packagerChrome.py |
| +++ b/packagerChrome.py |
| @@ -43,13 +43,11 @@ def processFile(path, data, params): |
| def makeIcons(files, filenames): |
| - try: |
| - from PIL import Image |
| - except ImportError: |
| - import Image |
| icons = {} |
| for filename in filenames: |
| - width, height = Image.open(StringIO(files[filename])).size |
| + magic, width, height = struct.unpack('>8s8xii', files[filename][:24]) |
|
Sebastian Noack
2017/09/20 21:36:10
This is different from my suggestion:
1. If you u
tlucas
2017/09/21 11:34:55
Sorry, i somehow overlooked this part from your co
|
| + if magic != '\x89PNG\r\n\x1a\n': |
| + raise TypeError('{} is no valid PNG.'.format(filename)) |
|
Sebastian Noack
2017/09/20 21:36:10
Nit; from https://adblockplus.org/coding-style#pyt
tlucas
2017/09/21 11:34:55
Done.
|
| if(width != height): |
| print >>sys.stderr, 'Warning: %s size is %ix%i, icon should be square' % (filename, width, height) |
| icons[width] = filename |