我使用Picasa網絡相冊API的Python client library將一些JPEG圖像上傳到相冊。但是一旦上傳,照片顯得非常緊湊。在Picasa 3.6中,可以選擇以原始質量上傳圖像而不進行任何壓縮,但是我可以在API中使用類似的選項嗎?如何通過Picasa API上傳圖片時防止JPEG壓縮?
這是一些我用它來創建照片,並將其插入專輯代碼:
upload_photo = gdata.photos.PhotoEntry()
upload_photo.summary = atom.Summary(text=title)
upload_photo.title = atom.Title(text=file_name)
upload_photo.text = atom.Text(text='Test')
upload_photo.author = atom.Author(atom.Name(text='Test Author'))
upload_photo.timestamp = gdata.photos.Timestamp(text='%i' %
int(time.mktime(photo_date.timetuple()) * 1000))
upload_photo.geo = gdata.geo.Where()
upload_photo.geo.Point = gdata.geo.Point()
upload_photo.geo.Point.pos = gdata.geo.Pos(text='%f %f' % (lat, lon))
imgContent = StringIO.StringIO(urlfetch.fetch('http://url.com/image1.jpg').content)
gpclient.InsertPhoto(album_or_uri=album_url, photo=upload_photo,
filename_or_handle=imgContent, content_type='image/jpeg')