omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular
    1. Home
    2. britishgaming

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 2
    • Best 0
    • Controversial 0
    • Groups 0

    britishgaming

    @britishgaming

    0
    Reputation
    380
    Profile views
    2
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    britishgaming Unfollow Follow

    Latest posts made by britishgaming

    • FTP uploads compressed image

      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

      posted in Editorial
      britishgaming
      britishgaming
    • RE: FTP uploads compressed image

      I've just been doing some extra testing

      If I upload an image from a URL, it's fine. So the FTP code is perfect and isn't compressing anything.

      I suppose it's the "photos.pick_image()" part. And I assume it's picking the compressed image (which iOS makes to speed up the Photos app) and not the original file.

      Hmm...

      posted in Editorial
      britishgaming
      britishgaming