| OLD | NEW |
| 1 # coding: utf-8 | 1 # coding: utf-8 |
| 2 | 2 |
| 3 # This file is part of the Adblock Plus build tools, | 3 # This Source Code Form is subject to the terms of the Mozilla Public |
| 4 # Copyright (C) 2006-2014 Eyeo GmbH | 4 # License, v. 2.0. If a copy of the MPL was not distributed with this |
| 5 # | 5 # file, You can obtain one at http://mozilla.org/MPL/2.0/. |
| 6 # Adblock Plus is free software: you can redistribute it and/or modify | |
| 7 # it under the terms of the GNU General Public License version 3 as | |
| 8 # published by the Free Software Foundation. | |
| 9 # | |
| 10 # Adblock Plus is distributed in the hope that it will be useful, | |
| 11 # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 13 # GNU General Public License for more details. | |
| 14 # | |
| 15 # You should have received a copy of the GNU General Public License | |
| 16 # along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | |
| 17 | 6 |
| 18 import os | 7 import os |
| 19 import re | 8 import re |
| 20 from StringIO import StringIO | 9 from StringIO import StringIO |
| 21 | 10 |
| 22 try: | 11 try: |
| 23 from PIL import Image | 12 from PIL import Image |
| 24 from PIL import ImageOps | 13 from PIL import ImageOps |
| 25 except ImportError: | 14 except ImportError: |
| 26 import Image | 15 import Image |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 | 115 |
| 127 for step in steps: | 116 for step in steps: |
| 128 filter, args = re.match(r'([^(]+)(?:\((.*)\))?', step).groups() | 117 filter, args = re.match(r'([^(]+)(?:\((.*)\))?', step).groups() |
| 129 args = re.split(r'\s*,\s*', args) if args else () | 118 args = re.split(r'\s*,\s*', args) if args else () |
| 130 image = globals()['filter_' + filter](image, baseDir, *args) | 119 image = globals()['filter_' + filter](image, baseDir, *args) |
| 131 | 120 |
| 132 f = StringIO() | 121 f = StringIO() |
| 133 f.name = filename | 122 f.name = filename |
| 134 image.save(f) | 123 image.save(f) |
| 135 files[filename] = f.getvalue() | 124 files[filename] = f.getvalue() |
| OLD | NEW |