【问题标题】:how to upload Image Array (Pillow Object) in Python to Google Cloud如何将 Python 中的图像数组(枕头对象)上传到 Google Cloud
【发布时间】:2021-05-29 08:57:42
【问题描述】:

您好,我有这个看起来像这样的 sn-p 代码


from matplotlib import pyplot as plt 
from PIL import Image 

# Use PIL instead of cv2. 
image = Image.fromarray((image_1).astype(np.uint8))
plt.imshow(image)
image.save("test.jpg")

所以我想在 Cloud Function 上运行这个函数。有没有办法让我不需要先使用image.save("file.jpg") 将其设为文件,然后直接将 ImageArray 上传到 Google Cloud 存储桶?

【问题讨论】:

    标签: python google-cloud-platform google-cloud-functions google-cloud-storage python-imaging-library


    【解决方案1】:

    据我所知,使用 Python 和 GCS,您有 3 个函数可以将文件上传到存储桶。

    我不确定我是否完全理解您的需求,但也许第三个选项可能有用。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-11-29
      • 2016-08-08
      • 2020-03-07
      • 2017-08-11
      • 1970-01-01
      • 2016-11-09
      • 1970-01-01
      相关资源
      最近更新 更多