我使用以下Python代码从Google云端硬盘获取文件:
theGoogleDriveFile = service.files().get(fileId=<googleDriveFileId>).execute()
如果图像是图像,我该如何调整此文件的大小?我尝试过以下方法:
resizedImage = images.resize(theGoogleDriveFile['downloadUrl'], 32, 32)
但是我收到以下错误:
raise NotImageError()
NotImageError
答案 0 :(得分:0)
这有效:
theGoogleDriveFile = service.files().get(fileId=<googleDriveFileId>).execute()
result = urlfetch.fetch(theGoogleDriveFile['webContentLink'])
resizedImage = images.resize(result.content, 32, 32)