title: How to optimize an image (file upload) in Django before it is added to the storage location?
body: <p>We are updating our backend storage for our Django project from a local disk store to an Amazon S3 bucket. Currently, we add the image, then optimize it and at a later time rsync it to our CDN. We control these steps so I just optimize after the upload and before the rsync.</p>
  
  <p>We are moving to Amazon S3 and I would like to now optimize the images before they are uploaded to the S3 bucket, primarily so we don't upload to S3, then download in order to optimize and finally, re-upload. Why have three trips when we can probably do this in one.</p>
  
  <p>My question is this: How can we intercept the upload to optimize the file before it's pushed to the storage backend, in this case, Amazon S3. </p>
  
  <p>If it helps I am using amazon's boto library and django-storages-redux.</p>
  
  <hr>