# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+from __future__ import print_function
+
try:
from PIL import Image
except ImportError:
import logging
import argparse
+import six
+
from mediagoblin import mg_globals as mgg
from mediagoblin.db.models import Location
from mediagoblin.processing import (
resize_filter = PIL_FILTERS[filter.upper()]
except KeyError:
raise Exception('Filter "{0}" not found, choose one of {1}'.format(
- unicode(filter),
+ six.text_type(filter),
u', '.join(PIL_FILTERS.keys())))
resized.thumbnail(new_size, resize_filter)
# Copy the new file to the conversion subdir, then remotely.
tmp_resized_filename = os.path.join(workdir, target_name)
- with file(tmp_resized_filename, 'w') as resized_file:
+ with open(tmp_resized_filename, 'wb') as resized_file:
resized.save(resized_file, quality=quality)
store_public(entry, keyname, tmp_resized_filename, target_name)
or im.size[1] > new_size[1]\
or exif_image_needs_rotation(exif_tags):
resize_image(
- entry, im, unicode(keyname), target_name,
+ entry, im, six.text_type(keyname), target_name,
tuple(new_size),
exif_tags, conversions_subdir,
quality, filter)
class ImageProcessingManager(ProcessingManager):
def __init__(self):
- super(self.__class__, self).__init__()
+ super(ImageProcessingManager, self).__init__()
self.add_processor(InitialProcessor)
self.add_processor(Resizer)
clean = clean_exif(result)
useful = get_useful(clean)
- print pp.pprint(
- clean)
+ print(pp.pprint(clean))