Hi guys
I'm having an issue with a workflow that uploads an image to an FTP server. Here's the code (adapted from a Pythonista example)
import webbrowser
import clipboard
import Image, ImageFile
import datetime
import photos
import ftplib
import urllib
from io import BytesIO
today = datetime.datetime.now()
image = photos.pick_image()
fileName = 'picture_iOS'
fileName = fileName + '_' + today.strftime("%Y-%m-%d-%H%M%S") + '.jpg'
urlBase = 'INSERT URL BASE'
encodedFileName = urllib.quote(fileName)
print fileName
buffer = BytesIO()
image.save(buffer, 'PNG')
buffer.seek(0)
ftp = ftplib.FTP('FTP URL', 'USERNAME', 'PASSWORD')
ftp.storbinary('STOR '+fileName, buffer)
ftp.quit()
clipboard.set(urlBase + encodedFileName)
print 'Success! The link to your uploaded picture is now in your clipboard.'
It works perfectly well, but the image it uploads is not the original image. Somewhere along the lines it has compressed it, and the result is not pretty.
If I upload the same image through Photogene's FTP export option it's perfect. So something must be going wrong in the workflow. Any ideas?
Thanks