【问题标题】:How to I specify image size of google slide API PNG export?如何指定谷歌幻灯片 API PNG 导出的图像大小?
【发布时间】:2021-06-19 20:41:27
【问题描述】:

我能够成功运行以下代码以生成带有我的谷歌幻灯片图像的 URL,但是当我尝试指定 thumbnailProperties 时,它显示:“得到了一个意外的关键字参数“thumbnailProperties””。我遵循了这个文档:https://developers.google.com/slides/api/reference/rest/v1/presentations.pages/getThumbnail?hl=es

对我需要更改的内容有什么想法吗?

service = build('slides', 'v1', credentials=creds)

img = service.presentations().pages().getThumbnail(
        presentationId=PRESENTATION_ID, 
        pageObjectId='gd7f6eed13a_1_17',
        # thumbnailProperties = {'thumbnailSize': 'LARGE'}
        ).execute()

【问题讨论】:

    标签: python google-slides-api


    【解决方案1】:

    在这种情况下,请进行如下修改。

    修改脚本:

    service = build('slides', 'v1', credentials=creds)
    
    img = service.presentations().pages().getThumbnail(
            presentationId=PRESENTATION_ID, 
            pageObjectId='gd7f6eed13a_1_17',
            thumbnailProperties_thumbnailSize='LARGE' # Modified
            ).execute()
    

    由此,得到以下结果。当您要检索缩略图时,请从以下contentUrl 下载。在这种情况下,不需要使用访问令牌。

    {
      'height': 900,
      'width': 1600,
      'contentUrl': 'https://lh3.googleusercontent.com/###=s1600'
    }
    

    参考:

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-02-09
      • 1970-01-01
      • 2023-01-26
      相关资源
      最近更新 更多