我正在使用 Picasa 网络相册 API 的 Python客户端库将一些 JPEG 图像上传到相册。但是这些照片在上传后显得非常压缩。在 Picasa 3.6 中,可以选择以原始质量上传图片而不进行任何压缩,但是我可以在 API 中使用类似的选项吗?
这是我用来创建照片并将其插入相册的一些代码:
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')