Process images using an SDK

更新时间:
复制 MD 格式

This topic describes how to use the OSS Python SDK to access the image processing service for a private bucket. The image processing service retrieves processed images using a GET operation. When you use the OSS Python SDK, you can call the `get_object` method. The required parameters for this method are the bucket and the object.

OSS Python SDK code example

This example retrieves the `example.jpg` object from the `image-demo` bucket.

bucket = 'image-demo'
object = 'example.jpg'
self.oss.get_object(bucket, object)

Image Service

Retrieve the example.jpg object from the image-demo bucket.

  • Resize

    Transformation string: 100w_100h.jpg

    bucket = 'image-demo'
    object = 'example.jpg'
    query = '100w_100h.jpg'
    object = object + '@' + query 
    self.oss.get_object(bucket, object)
  • Watermark

    Processing string: watermark=1&object=cGFuZGEucG5n&t=90&p=5

    bucket = 'image-demo'
    object = 'example.jpg'
    query = 'watermark=1&object=cGFuZGEucG5n&t=90&p=5'
    object = object + '@' + query 
    self.oss.get_object(bucket, object)
  • Style

    Style name: pipe1

    bucket = 'image-demo'
    object = 'example.jpg'
    style = 'pipe1 '
    object = object + '@!' + style
    self.oss.get_object(bucket, object)
  • Pipeline

    Pipeline operation: 200w.jpg|watermark=1&object=cGFuZGEucG5n&t=90&p=5

    bucket = 'image-demo'
    object = 'example.jpg'
    query = '200w.jpg|watermark=1&object=cGFuZGEucG5n&t=90&p=5'
    object = object + '@' + query
    self.oss.get_object(bucket, object)