jfinkels  committed 8a20666

Uploaded photos should be saved with maximum quality using JPEG compression.

  • Participants
  • Parent commits 521608a
  • Branches noimagecompression

Comments (0)

Files changed (1)

File ophot/api/

 from .queries import Q_UPDATE_PHOTO_DISPLAYPOS
+"""The quality (as an integer between 1 and 100, inclusive) of the JPEG image
+saved after the used uploads an image file to the application.
+A value greater than 95 is not recommended by the Python Image Library; see
+here_ for more information.
+.. _here:
 def _get_last_display_position(categoryid):
     """Helper method which returns the index in the display sequence of the
     last photo in the specified category.
         height = int(app.config['SPLASH_PHOTO_HEIGHT'])
         if img.size[0] > width or img.size[1] > height:
             img = img.resize((width, height), Image.ANTIALIAS)
-, imagetype)
+, imagetype, quality=IMAGE_QUALITY)
         return make_response(None, 204)
         thumbnail = img.copy()
         thumbnail.thumbnail(app.config['THUMBNAIL_SIZE'], Image.ANTIALIAS)
         # save the image and the thumbnail
-, imagetype)
+, imagetype, quality=IMAGE_QUALITY), imagetype)
         # get the category and display position to set for this photo
         categoryid = int(request.form['categoryid'])